Error while running Nunit 3.0.1 in Bamboo CI - unit-testing

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.

Related

"No test is available" when attempting to run VSTest for a GoogleTest exe

I have a C++ project that I am attempting to build and run using Azure Pipelines.
The build is working fine but I can't seem to get the unit tests to run in VSTest task using GoogleTest.
It was my understanding Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest is installed (as per https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md) so it can't be that.
Looking at the log I see:
No test is available in D:\a\1\s\Release\UnitTests.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
I also attempted a Command Line Script task but running the UnitTests.exe just yields:
'UnitTests.exe' is not recognized as an internal or external command,
operable program or batch file.
I solved this in the end by installing the Nuget package "GoogleTestAdapter" by Christian Soltenborn. All now seems to work fine but still very puzzled why this workaround is needed

Generate dotcover coverage report with jenkins

I have ci server setup on jenkins which builds the .net core 2.2 application. and then generates Test Coverage report using dotcover.
I am executing following command from jenkins job to generate coverage report using dotcover in the directory where Test project's .csproj file exist.
dotnet restore
dotnet dotcover test --dcReportType=HTML --dcOutPut="%WORKSPACE%\TestReport\index.html"
It gives me following error.
[JetBrains dotCover] Failed to perform coverage analysis. Operation
was canceled by the user.
Failed to register x86 core COM object: RegSvr32 failed to register
the core. Exit code is 00000003. Probably you haven't rebooted after a
Windows update. Please reboot the computer and try again.
I have already updated and rebooted as suggested in error but it doesn't solves the issue.
If I run this command directly from Command Line it works fine and generates report properly with the same commands.
Don't know what I am missing in jenkins.

.Net Core solutions build locally, but fails build on Azure DevOPS pipeline

My .Net Core 2.1 app builds successfully on my local machine, however on my Azure DevOPS pipeline, it fails in the build stage with the following error:
##[error]Error: C:\hostedtoolcache\windows\dncs\2.1.500\x64\dotnet.exe failed with return code: 1
##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\API\API.csproj,D:\a\1\s\AuthCore\AuthCore.csproj,D:\a\1\s\DomainModel\DomainModel.csproj,D:\a\1\s\Repo\Repo.csproj
I have added the .Net Core SDK installer before the restore step in the pipeline (and tried various versions) but it fails the same way every time.
The full log file of the build stage is available here: LINK
.Net Core solutions build locally, but fails build on Azure DevOPS pipeline
According to the error messages in your link, like following:
The type or namespace name 'DataAnnotations' does not exist in the
namespace 'System.ComponentModel'
It seems you are missing the references when you build the project/solution. So, if you add those references with nuget, you may need also add a nuget restore task to restore those nuget packages.
Check the details info from .NET Core task
Hope this helps.

UWP unit testing with Jenkins

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

How to use python build script with teamcity CI?

I am currently researching using the TeamCity CI software for our comapanies CI automation needs but have had trouble finding information about using different build scripts with TeamCity. We have C++ projects that need to have build/test automation and we currently have licenses for TeamCity. I have looked into using scons for the build automation but havent been able to find much information about using a python build script with TeamCity. If anyone could provide information about this to a CI beginner would be much appreciated.
Thanks
We use TeamCity to run our acceptance test suite (which uses Robot Framework - done in python).
Getting it to run was as simple as wrapping the python call with a very simple NAnt script. It does 2 things:
Uses an exec task to run python with the script as an argument.
Gets the xml output from the build and transforms it into something teamcity can understand.
There are probably tasks to run python scripts directly with NAnt but we've not had to use them - it was pretty easy to get up and running. You could do the same sort of thing using Ant or whatever depending on what your platform was.