How to generate Allure2 report for Xunit.net project - report

Does Allure2 support xunit project? I do not find it in the Allure2 documentation https://docs.qameta.io/allure/2.0/ But is there some adapter to implement it?

Allure2 does support xunit project. It does not require special adapter. Allure2 has inbuilt plugin trx-plugin and xunit-xml-plugin.
Steps taken for .netcore2 xunit test project using allure-commandline.
Refer to the docs to install allure commandline
Mac OS X brew brew install allure
Windows scoop scoop install allure
Linux for debian-based repositories a PPA is provided
sudo apt-add-repository ppa:qameta/allure
sudo apt-get update
sudo apt-get install allure
TRX report
Generated output xunit trx report with command: dotnet test --logger:trx
Generate Allure report with command: allure serve /home/path/to/project/target/surefire-reports/
XML Report
Add a reference to the Xunit Logger nuget package in test project.
Generate output xunit xml report with command: dotnet test --logger:xunit
Generated Allure report with command: allure serve /home/path/to/project/target/surefire-reports/

Related

dotnet publish does not pull NuGet packages

I am trying to automate deployment of an ASP.NET WebAPI on a Linux server using the following command:
dotnet publish --configuration Release
However, when adding a new NuGet package to the solution, and then trying to run the dotnet publish command, I get an error because the compiler does not know the new package. Is there a way to tell the dotnet command to pull all NuGet packages ? (I'm kind of looking for an equivalent for pip install -r requirements.txt in python).
For information, I add the NuGet packages via VisualStudio without compiling the solution.
Edit : it seems like, unless I build the solution in VisualStudio, just adding a NuGet packet will only add the packet name and version in the file projectname.csproj.nuget.dgspec.json, but will not add the PackageReference projectname.csproj file, hince the not pulling new packets issue.
I assume you are using some CI/CD pipeline which could publish your web application somewhere.
Feels like you are missing steps before publish:
# Restore (restores nuget packages)
run: dotnet restore
# Build
run: dotnet build --configuration Release --no-restore
# Test (if you have tests in project)
run: dotnet test --no-restore --verbosity normal
# Publish
run: dotnet publish --no-restore --no-build --framework netcoreapp3.1
May be this link may be helpful: github .net CI/CD

I installed a tool for dotnet CLI, why command tool list did not show it?

Look at the screenshot so you can better understand my question.
Why dotnetsay tool was not listed?
Why is dotnetsay tool not listed?
Please note that dotnet tool list command does help list all local tools available in the current directory, if you installed dotnetsay as a global tool, you can use following command to list all global tools.
dotnet tool list -g
Test Result
For more information about dotnet tool list command, please check:
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-list#examples
The answer for your question, to show your installed tool, use one of these ways:
dotnet tool list -g
dotnet tool list --global
dotnet tool list --tool-path C:\Users\samue
Practices these commands
Case install global:
dotnet tool uninstall dotnetsay --global
dotnet tool list
dotnet tool install dotnetsay --global
dotnet tool list --global
dotnetsay
Case install local:
mkdir C:\foo
dotnet tool uninstall dotnetsay --tool-path C:\foo
dotnet tool list --tool-path C:\foo
dotnet tool install dotnetsay --tool-path c:\foo
dotnet tool list --tool-path C:\foo
cd /d C:\foo
dotnetsay
Reference:
dotnet tool install https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-install
dotnet tool list https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-list

Can not use or detect global .net tools on Linux

I have installed the dotnet-ef and a number of other packages but for some reason, I can't use them.
I added $HOME/.dotnet/tools as shown here:
https://learn.microsoft.com/en-us/dotnet/core/tools/troubleshoot-usage-issues
but running dotnet tool list still shows no packages.
Please note that dotnet tool list command checks for local tools by default. Try dotnet tools list -g to look for globally installed tools. Make sure your PATH contains the global tools folder location before running the installed tool. You can check your PATH by running echo $PATH. You can also check globally installed tools by running dotnet tool list --tool-path $HOME/.dotnet/tools. Following steps work for me:
dotnet tool install --global dotnet-ef
export PATH="$PATH:$HOME/.dotnet/tools"
dotnet tool list -g
dotnet-ef
HTH

How to use dotnet tool during Travis-CI build?

I'm trying to use dotnet-warp as a global tool in my .NET Core Travis-CI build, because I like the idea of a single executable so much better than a folder full of 75ish files.
I can successfully add the tool and verify there's a tools/dotnet folder in the $PATH...
But the log indicates that because .NET Core has been added recently, I'll need to restart or logout before I can actually use the tool.
Is anyone aware of a way to make this work in the Travis-CI environment?
Ran into the same issue, using the info from the Travis CI Installing Dependencies page and this comment on an issue about it, adding the following following to to my .travis.yml solved the problem:
before_script:
- export PATH=$PATH:/home/travis/.dotnet/tools
My build log:
$ export PATH=$PATH:/home/travis/.dotnet/tools
$ dotnet tool install -g dotnet-warp
You can invoke the tool using the following command: dotnet-warp
Tool 'dotnet-warp' (version '1.0.9') was successfully installed.
The command "dotnet tool install -g dotnet-warp" exited with 0.
$ cd ./src/[my project]/
The command "cd ./src/[my project]/" exited with 0.
$ dotnet-warp
Running Publish...
Running Pack...
Saved binary to "[my project]"
The command "dotnet-warp" exited with 0.

How to fix the error: No executable found matching command "dotnet-install"

I installed the dotnetcore 2.1.0-preview1-final and running the following command to install the certs.
dotnet install tool dotnet-dev-certs -g --version 2.1.0-preview1-final
But I get the error:
No executable found matching command "dotnet-install"
What should I do to fix this?
Before the release of 2.1.0 SDK - the one that introduce the tool feature - the dotnet install tool command was changed to dotnet tool install.
In fact, the current guideline is that all commands should be of the form:
$ dotnet [context] [action]
So, for example:
$ dotnet tool install
$ dotnet new console
$ dotnet sln add ...
$ dotnet sln remove ...
The only context that is implicit is "project", because of historical reasons. In the future, the following might work:
$ dotnet project restore
$ dotnet project build
See the official guidelines for more information on the current designs of commands.

Resources