I would like to set up separate commands in my Angular 10 project to run different suites of tests. For example, to have different suites for unit tests and integration tests.
I can see the test configuration in the angular.json file, and that it uses src/test.ts as the entry / main. In the src/test.ts there is a line that finds all of the files with .spec.ts endings.
What I would like to do is to set up 2 separate test configurations so that I can execute command line commands with the intent of:
ng test --unit
or
ng test --integration
The unit tests would pick up all files ending in .spec.ts, while the integration tests would pick up files ending in .int.ts.
However, I think there can be only one test configuration in the angular.json file.
Is there a way that I can achieve the above or something similar?
Related
Is it possible to target specific runner classes or feature files within Jenkins?
Let's say for example I have the following files.
Runner classes:
RunnerClass1.java
RunnerClass1.java
Feature Files:
Login.feature
SignUp.feature
Is there a way to trigger specific runner classes or feature files within the Jenkins UI, I know you can use specific plugins such as: 'Parameterised / String Parameters', has anyone else found a solution to target specific tests from Jenkins?
thanks for your help
You can tag your test cases and maven will be able to run them by these tags.
For example, When I have Login cases with #Login tags and I want to run them with Maven, I am using the following terminal script :
mvn clean test -Dcucumber.options="--tags #Login"
When I create a new Mocha test file I am presented with the expected green gutter icons (▶ and ▶▶) to run each test or the suite. When I select "Run [test name]" I expect it to create a Mocha debug configuration and run it. Instead, IntelliJ creates a NodeJS run configuration, which understandably explodes in a shower of bit-flavored WTF.
If I manually create a configuration for the whole file, everything works as expected, including individual tests afterward. I am hoping that there is a setting somewhere that I have overlooked, something like "Settings -> ... -> Default Debug Configuration".
Does anyone know how I can make IntelliJ default to Mocha when a unit test is executed?
The logic used for determining what test runner is available for a given test file is based on dependencies declarations in package.json nearest to current file. Do you have 'mocha' listed as a dependency/dev dependency in your package.json? How many package.json files do you have in your project?
Note that, if Mocha is not installed locally/included in package.json, you can create a Mocha run configuration with "All in directory" selected and specify a directory where your spec files are located. In this case, clicking the gutter button in a test file inside this directory will suggest to run test with Mocha.
Note also that if you have created Node.js Run configuration with "JavaScript file" set to your mocha test file, IDEA will suggest using this configuration instead of Mocha when clicking on your tests, because explicitly created run configurations associated with current file have priority over the ones auto-generated from context. Deleting the configuration should solve the issue.
I'm running my continuous integration on CircleCI, and have a hard dependency in my tests that they must be run from /vagrant.
How can I copy my files there, and execute all my tests from there?
Thanks
In a teamcity config I have build step which runs PhantomJS tests. It is a "Command Line" step with custom script. The script looks like:
%PhantomJS% CreateEntityPopupTest\unit.htm
%PhantomJS% ExcelImportPopupTest\unit.htm
...
etc.
So it runs each qunit test package mentioned in the htm page. But I didn't manage to find a way to point PhantomJS (phantomjs-1.9.0-windows) to a folder, not to a single file. So there would be no need to change the config each time when we add new files with tests.
I used Chutzpah to wrap this behavior for use in TeamCity. Chutzpah can run tests written in QUnit, Jasmine or Mocha and uses PhantomJS as the headless test runner.
https://github.com/mmanela/chutzpah
I installed it on the build agents and added it to the path on the machine.
Now I simply add a Command line runner step called 'Run JS Test' in my build template. Command line is simply:
chutzpah.console.exe %jsTestFolder%
Then I just define the parameter for each project pointing to a folder... chutzpah does the rest.
I am trying to automate running some tests (in my own test infrastructure) with TeamCity.
We are not using java or ant but I can generate junit test results from a perl script:
run_tests.pl
Which generates junit result files (junit1.xml, junit2.xml etc.).
I have integrated this into Jenkins before by running it as a command line and giving it the path to the junit files.
In TeamCity it appears that due to the closer integration with ant and junit I need to run run_tests.pl from a ant junit task.
So how can I run a command from ant to do this? Or is there an easier way to achieve what I want (junit or other test results reported in teamcity)?
Okay, found a good way to do this. The key thing you need is XML Report processing so you don't need ant or junit tasks http://confluence.jetbrains.net/display/TCD7/XML+Report+Processing.
Summary:
Create your junit1.xml files using a command line build step
Add a build feature to your build configurations of type XML report
processing
Set report type to be ANT JUnit
Add a monitoring rule of +:junit*.xml