TFS Build VS Test Runner - Run only tests with no TestCategory - visual-studio-2012

I currently have around 6000+ tests running on over 30+ projects.
Some of these tests are only able to run locally, so have been decorated with the attribute:
TestCategory="Manual Tests"
this also applies to any functional tests, these are decorated with:
TestCategory="Functional Tests" etc...
I have read a number of MSDN and user articles on this and have setup a build to run only the Functional Tests
Test Case Filter: TestCategory=Functional Tests
(This successfully runs only the Functional Tests)
Question is, is there a test case filter I could use that will ignore both the TestCategory "Functional Tests" and "Manual Tests" and only run the tests that have not been decorated with a TestCategory Attribute.
If have used the below filter cases with no joy:
**Test Case Filter:**
!Functional Tests|!Manual Tests
TestCategory!=Functional Tests|Manual Tests
TestCategory!=Functional Tests|!Manual Tests
TestCategory!=Functional Tests|TestCategory=Manual Tests
TestCategory!=Functional Tests||TestCategory=Manual Tests
(TestCategory!=Functional Tests)|(TestCategory=Manual Tests)
(TestCategory!=Functional Tests)||(TestCategory=Manual Tests)
I am running this on Visual Studio 2012 (Update 4) with TFS 2012 (Update 4)
Many Thanks

Fix the issue by using "()" around your filter. Also | is or, and & is and so using x!=y or y!=z will not work. Use & for not equal to evaluations.
/TestCaseFilter:"(TestCategory!=PreTest&TestCategory!=PostTest&TestCategory!=CleanUp)"

Start small then build up..have you just tried one statement, say:
TestCategory!='Functional Tests'
Looking at the documentation my first punt for the full command would be:
TestCategory!='Functional Tests'&TestCategory!='Manual Tests'

Related

Android Studio Unit Tests With Coverage Showing 0% On Everything

I'm trying to check my unit test coverage, all my tests are passing, but when I run the tests with 'Run Tests With Coverage' by right clicking on my test file, when it completes, everything comes back as 0%?
Looks like it's supposed to just work reading https://developer.android.com/studio/test/index.html and can't find anything saying why it would be returning 0% for everything?
Is there some hidden setting I'm missing to get this working?
Go to Run->Edit Configuration->Code coverage.
Add your package/class for which you want to run tests, in Packages and classes to record coverage data section.
Also, check Enable coverage in test folders option.
Click Apply and Ok. Re-run your tests with coverage.

TFS Test - mstest log output - final test results

A couple of days ago our vs2012 mstest started producing two logs of test results in the one session, the initial "Results Top Level Tests" then Final Test Results:" "Results Top Level Tests"
As we parse the file, naturally we came undone with two lots of results.
Why is their two lots of results and - or how was this triggered ?
What is "Final Test Results" about?
(the console output from mstest is piped to a file)
Thanks
Based on my test, the issue should be caused by the test cases or the test processes which have something wrong. And the "Final Test Results" will appear there.
Simply say, when the message "Final Test Results" appears, that means maybe there are something wrong with the configuration of your test project or test processes.
So, please check and debug the test cases, processes, environments etc...
Firstly make sure the tests running without any error within local Visual Studio.
Reference:
MSTest hangs when used from command line
MSTest.exe command-line options

Fail code coverage if no tests exist for code

I have a simple Node JS application and am using Istanbul with Mocha to generate code coverage reports. This is working fine.
If I write a new function, but do not create any tests for it (or even create a test file) is it possible to check for this?
My ultimate goal is for any code which has no tests at all to be picked up by our continuous integration process and for it to fail that build.
Is this possible?
One way you could achieve this is by using code coverage.
"check-coverage": "istanbul check-coverage --root coverage --lines 98 --functions 98 --statements 98 --branches 98"
Just add this in your package.json file, change the threshold if needed. If code is written but no test then the coverage will go down.
I'm not sure if this is the correct way to solve the problem but by running the cover command first and adding the parameter --include-all-sources this then reported on any code without a test file and added them to the coverage.json file it generated.
Then running the check-coverage would fail which is what I'm after. In my CI process I would run cover first, then check-coverage
Personally I find the documentation on Istanbul a little bit confusing/un-clear which is why I didn't see this at first!

Using cucumber to run different tagged features sequentially

I'm attempting to run tagged features in the order that they are submitted.
example:
I have tests that i'd like to run in a specific order (#test1, #test2, #test3). After looking at the cucumber documentation is looks like i'm only able to run them in an and/or option like
cucumber features/.feature --t #test1; cucumber features/.feature --t #test2; cucumber features/*.feature --t #test3;
but this prevents me from having a single report which contains all of the results.
Is there anyway which I can run these tests in their respective order and have all of the results contained in the same report?
If you put the tests that have to run in a specific order in a feature file together cucumber will run them in the order they are given. As this will be in your normal test run it should all show up in the same report.
But it might be worth looking into why your tests are dependant on each other and if there is a way to remove this dependancy as it is generally bad practice to have it.

nUnit Test Runner - Test stays in "Not run" if it takes over a certain amount of time

We have some Selenium tests built with nUnit that take quite a while to complete. We are finding that they stay in the "Not run tests" grouping even though they should pass.
After some initial investigation we found that if we remove some long running steps the tests will pass correctly but as soon as we shove a sleep in the code that waits for a couple of minutes the problem comes back.
We are using Visual Studio 2012 with the nUnit Test Runner extension as shown here: http://nunit.org/index.php?p=vsTestAdapter&r=2.6.2
Is there some hidden timeout in nUnit or the test runner that we need to change to get our tests (no matter how long they take) to pass or is there some other problem at work here?

Resources