I am trying to run some unit tests in teamcity build configuration. I am using NUnit.ConsoleRunner.3.6.1 . However It says "Has no TestFixture". But when I tried to run it in command prompt using same runner it completed successfuly. What are the possible reasons ?
Really, more info is needed to judge what your problem is. However, most errors of that type indicate that the nunit framework has not been deployed with the test assembly that uses it.
Related
I am getting error as mentioned Either assembly contains no tests or proper test driver has not been found.
When i enter "nunit3-console.exe project.dll".
I tried few solutions but it doesn't help me.
Assumming you have not found a new bug in the NUnit engine, then one of the two things in the message is probably true...
You are running an assembly that has no tests
You are running an assembly with tests for which there is no driver installed, IOW tests that the engine does not know how to run.
These two things are combined in one message because it's really all one thing to the engine, which is basically telling you "I can't find anything that looks like a test to me."
Most likely, you do not have any NUnit3 tests, because knowledge of those is built into the engine itself. So, I would guess you are either running NUnit V2 tests or tests from some foreign framework, like xunit or microsoft test.
For more of an answer, please tell us what kind of tests you are running. What testing framework (and version) do your tests reference? If you are running NUnit V2 tests, do you have the V2 Framework Driver extension installed?
So... maybe there is a bug in the NUnit engine.
I had this exact same error message on my build server. At the same time the tests were running fine in Visual Studio (2015 with Resharper).
This happened when I started converting existing xunit to nunit tests in an assembly. As soon as I removed the last xunit test, the error went away.
Try to comment out everything except NUnit tests to see if this fixes the problem for you.
I am running teamcity server and agent in a docker container (https://blog.jetbrains.com/teamcity/2016/06/teamcity-on-docker-hub-its-official-now/). I am trying to build dotnet core application. I have 3 build steps as "dotnet restore", "dotnet build" and "dotnet test"
The build step completed successfully but i am unable to see "tests" tab on the build.
Do i need to configure something or i need to use a different runner i.e. nunit to get the test result on the screen?
You are running your tests correctly, but the NUnit dotnet-test-nunit runner doesn't currently include or support the TeamCity command line option or integration. See https://github.com/nunit/dotnet-test-nunit/issues/72
TeamCity added custom code to NUnit to support their style of integration. In retrospect, the NUnit team regrets doing this and has moved it out to an extension for the main NUnit runner that is maintained by TeamCity. Because of this, we are reluctant to add the custom code back into dotnet-test-nunit for TeamCity when no other CI system requires it, but TeamCity is popular, so it may happen.
I don't use TeamCity so I can't help with alternatives. Do your failing tests fail the build? If so, can you live with just viewing the console output for the results of your tests?
I remember doing this in an older version of Team City in which the NUnit Runner failed, so I tried running NUnit using the Command Line Runner instead.
I think there was an option in the Command Line Runner settings which let you specify the kind of output file: NUnit result.xml was one of them. Doing this, you could see the test result breakdown in the Web GUI, just like when the NUnit Runner worked.
But I don't see this in the latest Team City (6.5.5). Can it still be done?
PS: Before anyone asks, I can't use Team City's NUnit Runner because NUnit has a bug which will be fixed in the soon to come 2.6.0 version. Said bug does not occurr when running nunit-console
This could be done using importdata TeamCity message, this is really helpful when you are running NUnit tests manually executing nunit-console.exe from an MSBuild script, for instance using NUnit MSBuild Community Task, but keep in mind that TeamCity provides built in NUnit tests runner so you do not need this low level TeamCity scripting. Anyway you can import report in this way:
<Message
Text="##teamcity[importData type='nunit' path='...\TestResults.xml']"
Importance="High"/>
See Importing XML Reports
If you prefer to run code coverage, code inspection, test tools or
duplicate finders directly from build script, not as a build runner,
you can use the importData service messages to import generated xml
reports into TeamCity.
The functionality was still there, found it by accident when looking at another build configuration. Importing an XML is now a "Build Feature", see:
I am running nunit-console from a CI configured in TeamCity to run tests from various assemblies. Once one of the TestFixtures has a failing test, then the test execution will stop.
Currently i am able to see the first tests that failed, but am unaware if there are more testfixtures that might fail down the line.
I would like to get a summary that lists the failing tests and test fixtures, without all the details of the exceptions thrown.
Anyone have any ideas?
Thanks.
NUnit should run all of the unit tests in the specified assembly, regardless of the number of test failures. The first thing I would check is the raw xml output from the unit test run. You may find that the tests are being executed, but the build server is failing to display all of the results. If that is the case, there may be a faulty xslt that needs to be modified.
Another thing to try is running all of the tests on your box using the command-line tool, and see if it runs all of the tests. If they run on your box but not the server, you may have a configuration problem on the build box.
Yet another possibility is that the failure is a critical one (failure to load an assembly perhaps) which is causing NUnit itself to error out.
I've successfully managed to get MSTests running for each of the builds on our TeamCity Server.
I've got a couple of projects that use NUnit, so was hoping that getting TeamCity to run NUnit tests would be as simple as running MSTests:
So when I try to do the same for my NUnit Tests the Testing Tab doesn't show up when the Build finishes, so I'm guessing it hasn't run my tests.
Does anyone know what I'm doing wrong?
Not sure if this will help, but this is from the build log:
[Project "AssemblyName.proj.teamcity.patch.tcprojx" (Build;TeamCity_Generated_NUnitTests target(s)):] C:\Program Files\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe "##" "C:\Program Files\TeamCity\buildAgent\temp\buildTmp\tmp2867.tmp"
[13:22:57]: Start TeamCity NUnit Test Runner
[13:22:59]: Build finished
It's like it starts the nunit build runner, then just stops?
Thanks
Dave
NUnit test assemblies path is resolved relative to solution file folder. Try adding %teamcity.build.checkoutDir% at the beginning.
Have you checked out the TeamCity Addin for NUnit?
http://confluence.jetbrains.net/display/TCD4/TeamCity+Addin+for+NUnit