I want to execute the tests from this R#/Rider plugin within a GitHub Action and therefore I need to run the tests from the CLI. Simply runnning dotnet test does exactly nothing but building the project.
How can I run tests of a R#/Rider plugin from the CLI so that I can embed this step into a GitHub Action?
Thanks in advance!
Kind of a bug in our template :) It was missing some references to work with the .NET SDK, more specifically these:
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
Also in this commit: https://github.com/matkoch/resharper-fluentassertions/commit/42fdd20f5c6168402d09b47a7e9e3baa1cc9852c
One remark here: dotnet test must be invoked on the solution file (not the test project itself). Otherwise, there was an error about wrong paths. For now, I think that's acceptable.
I haven't tried with dotnet test, but they're just nunit tests, so can be run with the nunit command line.
Related
It is not really an issue I would like to ask today but I search best practices to unit testing a UWP application with Jenkins.
First, I created a Unit Test App for my main application and, on my development machine, I generated appx package using MSBuild command line tool. It works well and I can also execute unit tests with the VS Test console.
Then I tried to automate it with Jenkins on my build server. But the MSBuild command does not work. I have no issue but it produces no output. After lot of research (without any success), my question is the following:
What is the best way to make UWP unit testing with a result dashboard using Jenkins?
Thanks
In order to make MSBuild work correctly, I had to create two subsequent build steps, one with command line argument:
-t:restore
in order to make it restore all the nuget dependencies, and a second one with command line arguments:
/t:Rebuild /p:Configuration=Release
/p:UapAppxPackageBuildMode=StoreUpload
for the real release compilation and the creation of both sideload and storeUpload msix files
I am running NUnit 3.0.1 as a build task in Bamboo CI after the MSbuild task.
I am getting the following error
Invalid argument: -xml=TestResult.xml
Running a bat file as specified in How to run NUnit Runner in Atlassian Bamboo with NUnit 3 also didnt work as it gave me the error nunit3-console.exe is not a recognized command
Bamboo CI doesn't appear to fully support NUnit 3.X yet, see the issue here.
The error you are seeing is because NUnit 3 no longer supports the -xml option.
Looking at the notes on the Bamboo issue, it looks like the best appoach is to run NUnit3 as a script task (using the option --result=YOURPATH;format:nunit2 to format the results as NUnit2 would have), and then adding an NUnit Parser Task to merge the results back in.
Most of the Cordova plugins have a folder called 'tests', which hosts plugin.xml and tests.js. Can anyone shed some light on how to run them, and what is required to run? There seems no relevant documentation. Thanks!
There's an official Cordova library for running the unit tests.
From the Cordova Plugin Test Framework on github:
The org.apache.cordova.test-framework plugin does two things:
Defines the interface for cordova plugins to write tests
Provides a test harness for actually running those tests
Tests run directly
inside existing cordova projects, so you can rapidly switch between
testing and development. You can also be sure that your test suite is
testing the exact versions of plugins and platforms that your app is
using.
Visit that page; there's plenty of information there on running existing tests and using the framework for your own plugins.
There is also a plugin called cordova-paramedic, based on cordova-test-framework which automates manual steps like modifying config.xml:
cd cordova-plugin-name && npm install cordova-paramedic && node node_modules/cordova-paramedic/main.js --platform android --plugin ./ --verbose
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.
I am struggling to get it to run my tests. In the Execute Windows batch command on Jenkins, I have put the following command:
C:\Program Files (x86)\Gallio\bin\Gallio.Echo.exe" /report-type:Html /verbosity:quiet “Project.Tests\bin\Release\*.Tests.dll
It doesn't like the *.Tests.dll bit, in that it says:
Cannot find directory containing file pattern Project.Tests\bin\Release\*.Tests.dll.
My next question would be if I change the report-type to xml, is it straight forward to get my unit test reports published in hudson?
many thanks.
The following extract runs Gallio tests in a Windows Batch command build step (Download Gallio from)
"c:\Program Files\Gallio\bin\Gallio.Echo.exe" %WORKSPACE%\YourTestPro\bin\Debug\YourTestPro.dll /report-directory:%WORKSPACE%\TestResults /report-type:Xml /working-directory:%WORKSPACE%
To setup Jenkins report generation
Add the Gallio Jenkins plugin to your Jenkins installation to publish the report
In your project under the Add post project action build steps add the xUnit test result report
Select the Add button that appears in the xUnit action step
Select Gallio - N/A
Add TestResults/*.xml to the Gallio N/A Pattern
You can use Maven plugin for .Net: http://docs.codehaus.org/display/SONAR/.Net+plugin
It takes care of Gallio command line generation: you can provide a filter :
<visual.test.project.pattern>*.Tests</visual.test.project.pattern>
<gallio.filter>Category:UnitTests</gallio.filter>
Then, the Maven plugin generates the command line.
You also have a lot of advantages using maven: integration with Partcover/NCover, stylecop/fxcop/gendarme, etc.
OR you can make a MSBuild script for that:
<itemGroup>
<TestsDll Include="**\bin\$(Configuration)\*.Tests.dll" />
</itemGroup>
<Exec Command="Gallio.Echo.exe #(TestsDll, ' ')"/>
I am pretty sure you want to look into using the Gallio Plugin instead of using the execute windows batch command.