I run specs in my local machine and in a CI server. In the first case I want specs to fail fast, and in the other I want run all of them. I've set --fail-fast in my .rspec file. How can I override it on the CI server? I run there RSpec using rake spec and I set SPEC_OPTS env variable.
The simplest answer is to remove .rspec from your repo. It is used only by you and any other contributor don't need to see that you are using NyanCat to see how your test's are doing.
You can add a .rspec file in your home directory so that the settings only apply to your local machine, and then the .rspec in the project directory will override any settings there.
--no-fail-fast has since been added.
https://relishapp.com/rspec/rspec-core/docs/command-line/fail-fast-option#using-%60--no-fail-fast%60
Related
I am trying to use script aliases in the package.json file.
In order for something like this to open the test runner,
"cy:open:prod": "cypress open --env ENV=production",
I run the command npm run cy:open:prod in the command line in the same folder that package.json is located.
The script runs and opens the test runner, however no spec files are found.
In all the examples I have found it describes this approach. Is there something I am missing in configuation to point it to where my spec files are?
Thanks in advance.
There is nothing basically wrong with the scripts in package.json, they look normal and would not cause the problem you mention.
I suggest you check the specPattern setting in configuration, it should match the naming convention you have chosen to use for your specs.
See e2e settings for more details.
Of you still have trouble with it, start a new project and let Cypress set the configuration for you, it will automatically match up the specPattern to the default value.
Im currently building a project using Rspec in which I sepparated in two different folders with domain code and infrastructure code. Both folders have their own specs in a spec folder. The domain/spec folder is the one containing the spec_helper.rb file, thats required from the tests inside the other folder infrastructure/spec
I'd like to know how to have a spec folder in the root of the project, including the spec_helper file and also tests, and being able to run all the tests with just one command (right now I do it running rspec domain/ infrastructure/)
RSpec is designed to work with all tests in one folder. By default, this folder is called spec/, but you can use a different name with the --default-path option.
So, your options as I see it are:
Edit the source code of rspec-core to let that configuration support multiple directories. Hopefully your PR will be approved and merged.
Or, write a simple wrapper script that runs rspec against both directories. For example, you could alias rspecs='rspec domain/ infrastructure/'.
Or (what I would recommend!), you could just restructure your tests slightly to use spec/domain/ and spec/infrastructure/ folders -- and then everything will just work, by convention, out of the box.
I have this repository on bitbucket
bitbucket.org/alu0100786330/prct08
And when I clone it in my cloud 9, the Rspec don't show me the its
I have this workspace that containt the repository and here it works right:
ide.c9.io/alu0100786330/lpp_67
Expected output:
[
BUT in the second workspace dont show me the results.
The commands that I made:
git clone bitbucket.org/alu0100786330/prct08
bundle install
And when I execute the rspec with the rake show me this, without its:
[]
What can I do to show the its?
RSpec reads from the .rspec configuration file in the directory you run it from. It sounds like in one workspace, that contains --format documentation, and in the other, it contains --format progress (or nothing, progress is default). You just need to add a .rspec file to your second workspace, or run rspec with the options you want (See rspec --help).
If you or your team has an .rspec you like, check it into the repository. Individuals can still create a .rspec-local that doesn't go in the repository if they want to override some settings just for themselves.
So my situation is that I finally finished configuring TeamCity for CI. I got it to run my unit tests with some friendly help on SO.
However, many unit tests fail because there needs to be a config file alongside the unittests.dll once it's built and ready to run.
I've written a simple Command Line step with:
copy %system.teamcity.build.checkoutDir%\xx.configfile <destination>
The destination is the problem, I need it to be the Out directory teamcity creates.
TC creates SYSTEM_<machinename> <datetime>\OUT. An example:
C:\TeamCity\buildAgent\temp\buildTmp\SYSTEM_GIDEON 2015-07-02 16_51_09\Out
In there is my unittests.dll and I want to copy my config file there. What environment var or (anything else) can I use in the command line script?
The (1) Build Tests is a Step then I want to run the (2) Copy Config Step Then (3) Run Tests. After step (1) I have that xxx\xxx\Out directory and I need that directory from some variable.
I'm using Teamcity 9.0.2
Your problem is not to do with TeamCity I don't think, it's to do with the way that MSTest works. You need your .config file to be a DeploymentItem and have your tests deploy it to the directory that MSTest will run the tests in.
To be honest I'm surprised that you don't have this problem running locally, and it makes me think that you must be using some other test runner (like ReSharper) to run the tests if you have not seen this problem on your local machines.
I'm using the new Capybara DSL with rspec following the short guideline located here
And the tests added to the spec/features directory run well alone, ie.
rails_project$ rspec spec/features/my_first_feature.rb
However the spec/features directory is totally ignored when I try to run the tests for the entire spec/ directory like this:
rails_project$ rspec .
There is no mention in the guide about how to include this directory (or other directory) to accomplish this inclusion that I desire. I really need this for continuous integration of my project.
Can anybody please tell me how to do it?
Thanks!
You need to make sure all of your specs end in_spec.rb.
Change the filename to spec/features/my_first_feature_spec.rb
This is how I do it:
rspec spec
You may also want to use guard-rspec, which gives you better control.