NUnit Test Adapter and NUnit both discovering and running tests - unit-testing

I have the NUnit test adapter (3.X) installed and my test project references NUnit (3.8.0.0). However, I'm seeing duplicate tests discovered (during build) and run by the NUnit Adapter 3.8.0.0 and NUnit 1.2.0.0. What could be causing this? I can't work out where NUnit 1.2.0.0 is coming into this.

Related

How can I run Django unit test in Microsoft TFS automatically?

How can I run django unit test in Microsoft TFS automatically?
By default the Python-Django test feature is not integrated in TFS.
However vNext build (TFS 2015 and later) have more flexible steps, so you can use the Command line task or Utility: Batch script task to run pytest or django test. That means if you can run the Django unit test in command line, then you can run the tests in TFS.
Please reference this article to do that: Running Python Unit Test in a VSTS/TFS build
Other articles for your reference to run the Django unit test:
Writing and running tests
DJANGO UNIT TEST CASES WITH FORMS AND VIEWS
Setting a Full Testing Framework for Django (and more!)
Besides, you can also have a try for this extension : Python Test

NUnit 2.6.4 and 3.0.0 test adapters installed at the same time: How do I prevent both from running?

I am using Visual Studio 2013.
Let's say I have a version 1.0 of a product which is currently using the NUnit Test Adapter.
I now want to move v1.0 to a branch and start working on v1.1. I want to upgrade from NUnit 2.6.4 to NUnit 3.0.0 for v1.1 but keep using NUnit 2.6.4 for v1.0 hotfixes.
To this end, I upgrade my test projects to NUnit 3.0.0 and install the new NUnit 3 Test Adapter in order for the tests to show up in Test Explorer.
I now have both of the NUnit Test Adapter and NUnit 3 Test Adapter extensions installed and enabled at the same time.
The result of this is that when I run the unit tests for v1.0 I get the following in the Output window:
------ Run test started ------
NUnit VS Adapter 2.0.0.0 executing tests is started
Loading tests from c:\MyApplication\_test\MyApplication.Test\bin\MyApplication.Test.dll
Run started: c:\MyApplication\_test\MyApplication.Test\bin\MyApplication.Test.dll
NUnit VS Adapter 2.0.0.0 executing tests is finished
NUnit Adapter 3.0.7.0 executing tests is started
Running all tests in c:\MyApplication\_test\MyApplication.Test\bin\MyApplication.Test.dll
NUnit failed to load c:\MyApplication\_test\MyApplication.Test\bin\MyApplication.Test.dll
========== Run test finished: 137 run (0:00:07,356) ==========
When I open the v1.1 solution and run the tests I get the following instead:
------ Run test started ------
NUnit VS Adapter 2.0.0.0 executing tests is started
Exception NUnit.Core.UnsupportedFrameworkException, Exception thrown executing tests in C:\MyApplication11\_test\MyApplication.Test\bin\MyApplication.Test.dll
NUnit VS Adapter 2.0.0.0 executing tests is finished
NUnit Adapter 3.0.7.0 executing tests is started
Running all tests in C:\MyApplication11\_test\MyApplication.Test\bin\MyApplication.Test.dll
Loading tests from C:\MyApplication11\_test\MyApplication.Test\bin\MyApplication.Test.dll
NUnit Adapter 3.0.7.0 executing tests is finished
========== Run test finished: 136 run (0:00:08,224) ==========
Is it possible to have both test adapters installed and enabled at the same time in order to support two solutions that are making use of different versions of NUnit?
In other words, I would like to be able to switch between solutions without having to disable the test adapter that does not fit the currently loaded solution.
Can each VS2013 solution be configured to only make use of a specific test adapter?
You can run the unit test from VSTest. and specify adapter by setting /TestAdapterPath:[ path ] command line option.

Test cases discovery using django-jenkins

I am using django framework for my project and now I in order to move to continous integration I am planning to use jenkins. natually django-jenkins is the choice.
I am using django unit test framework for unit testing and using patterns finding for testcases discovery.
./manage.py test --patterns="*_test.py"
I have installed and configured django-jenkins and all other necessary modules. Now when I am running the jenking for running the unit test cases, jenkins is not able to discover the test cases.
./manage.py jenkins
Is there some syntax to be followed while naming the unit test files or unit test cases itself?
I also could not find any pattern searching parameter to be used with jenkins.
All options from standard django test runner should works (https://github.com/kmmbvnr/django-jenkins/pull/207) but i'd newer tested them all.

grails doesn't find geb functional tests

I'm using the example project at https://github.com/geb/geb-example-grails
For some reason, when I run grails test-app functional: it doesn't pick up any tests. It says...
|Loading Grails 2.3.1
|Configuring classpath
.
|Environment set to test
........................................................
|Tests PASSED - view reports in C:\Users\user\src\geb-example-grails\target\test-reports
No browser is opened (what I'm used to with webdriver) and when I view target\test-reports\html\all.html I get...
Unit Test Results - All tests
No tests executed.
I've tried executing with
grails test-app functional:
grails test-app -functional
grails test-app
None appear to run any tests. I've also upgraded the project to grails 2.3.6 with the same result. Am I running the tests incorrectly? Has anyone else had this issue?
Update
I was able to reproduce this problem on my Mac in addition to the Windows 7 machine. When I run on the Mac with...
grails test-app -Dwebdriver.chrome.driver=/Applications/Google\ Chrome.app/Contents/MacOS/chromedriver
Then no tests are run and it reports that all tests pass. (same as the windows machine)
However, when I run via
grails test-app
The tests are run, Google Chrome is launched but no navigation takes place (I suspect I have an outdated chromedriver somewhere in the PATH on the Mac.)
Update 2
After running with...
grails test-app -Dgeb.env=firefox
The tests are found and executed. No nagivation takes place until updating the BuildConfig.groovy with the latest selenium (2.40.0, a webdriver issue I'm familiar with).
With this in mind, I decided to check that the chromedriver was installed properly. While I had placed the chromedriver.exe in the same location as google chrome. I hadn't added that location to my PATH. After doing so... Eureka! Tests run and execute with 100% Passed! Thanks #spikeheap for your suggestion! It appears that tests won't run unless you have the webdriver for your browser setup properly (strange to me, but ok).
I can't reproduce that error. Using 2.3.1 the tests are executed. Have you got the ChromeDriver present? If not I'd expect to see a load of errors...
You could try grails test-app functional: -Dgeb.env=firefox which will attempt to use the FirefoxDriver. If you've got Firefox installed this should work without any additional configuration.
If that doesn't give you anything, try grails test-app functional: PersonCRUDSpec, which will explicitly try to run that test.

Running NUnit tests in TeamCity 6.5.X with NUnit addins

We are using TeamCity 6.5.1 to manage the compilation, testing and deployment of our builds. Up until now we have been using the NUnit Build Runner from TeamCity to run our tests with NUnit 2.5.8 and had great success.
http://confluence.jetbrains.com/display/TCD65/NUnit
All of our tests are written in C# and .Net 4.0 using Visual Studio 2010. The test projects are compiled into an assembly that we reference through the TeamCity interface.
Now we are adding in a new test project for UI tests that require a custom NUnit addin that we developed to extend the native NUnit functionality. When running the tests in a local development environment with NUnit 2.5.8 installed we are able to place the custom addin in the NUnit addins directory. When NUnit is loaded our addin is picked up automatically.
C:\Program Files (x86)\NUnit 2.5.8\bin\net-2.0\addins
Using the NUnit Build Runner in TeamCity 6.5.1 we cannot see of a way to install our addin. Unlike the native installation of NUnit, TeamCity does not appear to pick up an addin just by placing it inside a sub directory of the NUnit installation.
Does anyone know of a way to install/use an addin using the NUnit Build Runner? Existing documentation discusses the NUnit command line console runner which we are not using. We are using the NUnit Build Runner as the method to run all of our tests so it would be most ideal if we could maintain a standard testing mechanism.
Thank you!
I was trying to solve the same problem.
As I found out TeamCity uses its assembly Nunit.
Therefore there is no possibility of expansion. You can use the command line to run tests via Nunit. And TeamCity use step "Build Failure Conditions" for reading logs and view the results.