Karma spec classification - karma-runner

Right now when I run karma it takes all "*.spec.js" and run time. We have both unit and integration tests. And when I am running unit tests I don't want integration specs to run. What is the best way to tell karma what spec to load. Like any name pattern, etc. I need to know how to configure karma so that it runs specific type of specs.
Any suggestion with example/link is highly appreciated.

Assuming that you can identify your integration tests by filename (e.g. *.integration.spec.js) then I would have two separate karma.conf.js files. One for integration (with ./*/*.integration.spec.js in the files list), and one for regular work (with the same pattern in exclude). Then just run the one you need - or have them both running in separate consoles.

Related

Store results of unit test run into variables

I have a TeamCity build configuration that builds a C# project, runs some unit tests, and then does some extra things. My question is: Can I get information about my unit test run stored into build configuration variables (i.e. how many tests were run, how many were successful, how many failed, how many were skipped) so that I can then check these variables in a PowerShell script in later build steps and perform different actions depending on how many tests have passed?
AFAIK the best way is to ask these information directly to teamcity server using its REST API (pay attention, maybe the build locator could be a little be tricly to be found, if the build is still running).
By other hand, you can parse your NUnit test result file (or files if you run more than one NUnit test runner step in your build) inside your build agent machine.

How to skip dependent feature file when parent feature file fails in protractor cucumber

I have 5 test scenarios in my 5 different feature files.
TC-1
TC-2
TC-3
TC-4
TC-5
TC-3&TC-4 are dependent test cases when test scenario TC-3 failed automatically TC-4 should skip and TC-5 should execute how we can achieve this in cucumber any suggestions
Thanks in advance.
I never worked with cucumber closely, but I found out it's not possible in jasmine and pytest. So I assume this is how all test frameworks work.
The problem is that both of these^ build a queue of tests to execute before the browser started. And you can't modify it based on a runtime results.
see this answer for jasmine, and see if you can apply this approach to cucumber Nested it in Protractor/Jasmine

Attach Current Build to Test

I'm playing around with Microsoft Test Manager 2013 (though it appears it is just MTM2012) to try and get a better understanding of test cases and test suites as I want to use this at work. So I was hoping that I could run a test suite on a build which gets included in this test suite. That is what I WANT to do, but it could very well be wrong. So maybe a better scope of what I'm doing at work might lend to a better answer.
My company makes tablet PC's. I write programs for those tablets. For sake of argument lets just say there are 5 tablets, that run a similar array of OS's. Tablet1,2,3 and 4 can run WinXP, WinXP embedded, Win7, and Win7 Embeded, and Tablet5 can run Win7, Win7 Embedded, and Win8 embedded. Lets say i'm making a Display test program. Naturally this display test will run differently on each tablet, but the program it self is supposed to be able to handle that along with not being able to worry about OS. So I wrote out a very simple test. Open Program, try to open again, verify only 1 instance, check display, close program.
I figured it would be good to make a Test Suite called "Complete Display Program Test" and put 5 sub test suites to that for each tablet. Then moved the 5 test cases to a single test suite. I configured all test cases to only have the correct tablet/OS configuration. Queued a build and waited for it to finish. I then attached that build to the main test suite. I then clicked on run a test for tablet 1 but I didn't see the build attached to the test runner. I've looked around a little bit to see why or how and haven't found anything. Question is is how do I do that? Or if you are scratching your head and wondering why in the world I am doing it this way then by all means suggest another way. This is the second time I have ever looked into MTM so I might not be doing it right.
Thank you for your time.
When running manual tests from MTM you will not see the build you are using in Test Runner.
But if you complete the test and set the test outcome you will be able to check which build you've ran the test against.
Just double-click on the test or select "View Results" to display test results:
This column is not visible by default. You will have to right-click on the column row and select the column "Buld number" to be displayed.
You will also be able to see the build number in "Analyse Test Runs" area:
The things are slightly different if you are running automated test.
Consider following approach:
Automate your Test Cases
See How to: Associate an Automated Test with a Test Case for details.
Create a Build Definition building your application under test AND assemblies containing your tests.
I strongly recommend build application you want to test and test assemblies using in the same Build Definition. (You will see why a little bit later).
Run this build definition and deploy the latest version of the application to the environment where you want run the tests.
This is very important to understand: if you run automated tests the tests assemblies only would be deployed automatically to the environment.
It's your job to deploy the right version of the application you are going to test.
Now you can run tests from MTM.
You can do it the way described by #AndrewClear in the comment to this answer: "choose "Run with Options" when you're beginning a test run" and select the latest build.
Now test assemblies containing tests which are using to automate Test Cases will be deployed automatically to the test environment and the tests will be executed.
That is the point you should recognize why is it so important to build application and tests with a single Build Definition: since the build number you've just selected when starting the tests will be stored along with the test results on TFS you will later know what version of you application you were testing (assuming you deployed the right version, of course).
You could go a little bit further if you want even more automation (This is the way I'm currently running automated tests)
Use Deploy-Build-Test template (this is a good place to start reading about Setting Up Automated Build-Deploy-Test Workflows).
Using this approach you will be able to automate deployment of the application you want to test.

Tools or plugins for making parallelize NUnit tests in TeamCity

i'am looking for tool which will make a parallelizing NUnit test in TeamCity! i wanna parallelize my tests (which goes near 12 hours) on some PC, not one, which plugin or tool can i use for it?!
If you have several unit test projects, you could create one build configuration per agent which will be running the unit tests. Each build step would run a subset of the unit tests. You could then tie the builds together through dependent builds. Here is an example of an open source project using it (you can visually picture how many agents can be simultaneously running build steps.

Cruise Control.NET, NUnit integration

I currently have a code base which has NUnit tests organised into suites. We currently have a build task on our CC box which runs all of the tests in one CC project.
Is there a way we can configure CC.Net to allow us to individually run the different test suites from the dashboard.
Something along the lines of a list of all the suites and a button next to each to run those tests.
The only way I can think of doing it now is to set each suite up as its own project and control them all from the top level dashboard, but we have alot of test suites and this complicates adding more.
Thanks in advance.
I'm afraid there is no other solution than creating a separate project for each test suite.
How could CCNET be aware of something like a test suite? What about different implementations of test suites?
For CCNET a project is atomic i.e., a project is the smallest available element you can run and evaluate the results for.