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?
Related
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.
So my nunit 2.6 tests run in team city, the results appear in a 'tests' tab. I just select the built in nunit build step, type the name of the file with the tests in "Runs Tests from:" and the name of the category(s) in "NUnit categories include:"
However, If I upgrade my tests and select NUnit3 from the "NUnit runner" drop down things start to go wrong.
After much googling and mucking round for command lines and console runners I can't get this working with the full 'results in a tab' level of compatibility.
There is a lot of advice out there on how to make this work, but the best articles are at least a year old and I'm not at all clear that they apply to 3.5.0
Has anyone got this fully working or is it no longer supported? Can you explain how you managed it?
NUnit 3.5.0 does work with TeamCity, but it requires that you use the NUnit TeamCity Event Listener Extension. You can install it along with the NUnit Console Runner package or use the NUnit Console Runner with Extensions which includes the TeamCity extension along with other commonly used NUnit extensions.
Once you have the extension, TeamCity should automatically add the --teamcity command line option to the nunit3-console.exe.
Check here more information on the various NUnit Runner NuGet packages and what is included in each.
You add these packages to one of your test projects. That will cause them to be installed in the package directory of your solution root. From there, the built in NUnit 3 step will work, just update the executable location to point to 3.5.0. See the Getting Started With NUnit and TeamCity document. I would use the Case 4, NUnit Build Step.
If you only want to test certain categories, you will need to add your --where clause as an additional command line parameter.
My quick build has three steps:
Repository : Which is checking out the source from svn - running fine
Run the nunit script via devenv.com and generate the abc.xml file - NOT WORKING
Publish the report from that abc.xml - running fine with one sample xml
Could you help with this 2nd step?
i.e generating .xml automatically via quickbuild from nunit test cases.
Please use the NUnit console runner like this:
nunit-console /result:console-test.xml nunit.tests.dll
More information on the runner can be found here: http://www.nunit.org/index.php?p=consoleCommandLine&r=2.6.2
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'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