It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Integrating xUnit with Bamboo

We are using xUnit to run our Unit testing for our .NET Core project . I'm a newbie to Bamboo and we are using Bamboo for  CI and Octpopus for CD.

What's the best way to implement the xUnit testing framework and also best practice to run the Unit test whether its before or after a deployment.

 

Thanks,

 

2 answers

@Jijo Varghese Not sure if there’s an xUnit task available out of the box; the lack of documentation for xUnit on Bamboo leads me to believe there isn’t.

Having said that, there’s always the Script task, so you can just execute the xUnit CLI as part of a script.

As for whether it’s best practice to run unit tests before or after, that’s the same as answering the question: “Is it better to catch bugs and fix them before your product gets released or after?”.

Always run unit tests before deploying!  The whole point is to fail the build if tests fail so that you do not deploy faulty code.

xUnit Integration to Bamboo:

It's a one-line script:

  1. Create a "Script" task in your Bamboo job.
  2. Set the script to use whatever shell you are comfortable with
  3. Enter the below command in the inline editor:
    1. dotnet test --logger "trx;LogFileName=someNameForResults.trx" mySolution.sln or test.csproj path
  4. Add a task for MSTest Parser
  5. Give the parser the folder path to where someNameForResults.trx is saved.

 

It may be helpful to run the dotnet test command outside of Bamboo to see where the files are being saved.  You can also view the logs to see where Bamboo is saving and looking at for the .trx

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted Friday in Statuspage

Statuspage has 3 new integrations with Zendesk!

Incident response is a team sport, and customer support is an integral part of any team. While Ops is working hard to solve the problem at hand, support is on the front lines communicating with custo...

48 views 1 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you