Evaluating Circle CI - getting xunit.net tests to run - help!?

dotnet

#1

Hi, fairly new to CI, and especially to Circle CI. I’ve been asked to evaluate some CI platforms by the boss man

Circle CI was a breeze to get integrated with Bitbucket, run a build - but I’m really struggling to work out how to get it to run a suite of xunit.net tests (C# .netcore project). Does anyone have an example, tutorial or similar they could point me in the direction of?

I found: https://circleci.com/docs/manually/#tests which shows an example for php scripts - but I’m not sure what the command line for xunit.net tests would be - I get the feeling it’s just a line or two of code, but a lot of google searching has not turned anything up.


#2

You should be able to just use the dotnet test command as described here.

In order to get this to run you would need to add the following section to your circle.yml

test:
  override:
    - dotnet test

I have a sample dotnet core project here, but it has no tests yet.

Best,
Lev


#3

Thanks Lev, I was hoping it would be a quick fix, but I added a circle.yml file (until that point I’d been able to achieve everything including checkout, builds via your website which was really easy and quick) and pasted the above into it. I now get this output at the test stage:


bash: line 1: dotnet: command not found

dotnet test returned exit code 127


My knowledge here is a little limited - am I failing to include something in the project.json file that results in there being no dotnet.exe available to the build agent, or is there something wrong with the build agent?

Thanks in advance for your help


#4

@levlaz The command “dotnet” doesn’t appear to be available. A sample project with tests in would be great - I’ll be happy to create one on Bitbucket once I get this working, but I could do with some help to understand why “dotnet test” doesn’t work.

Thanks in advance,


#5

Right, you need to install it, we do not have dotnet core installed by default. In the sample project I installed it by adding the following to my circle.yml file

dependencies:
  pre:
    - sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' 
    - sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
    - sudo apt-get update 
  override:
    - sudo apt-get install dotnet-dev-1.0.0-preview2-003131 
  post:
    - dotnet restore

#6

Thank you Lev, that was a big help for someone Windows-centric like me. Builds and tests working just fine now. Much appreciated!


#7

My pleasure! Glad you got this working.

We only have a small number of dotnet core projects building on CircleCI right now. It would be great if you continue to share your experience (and especially any issues that you might run into) here!

Best,
Lev


#8

Hi Lev - I absolutely will do.

Not sure which CI solution my boss / office will go with, but CircleCI is one of my preferences, and the only good hosted solution I’ve found with a free tier, so at the very least I will be using it for a couple of personal projects. :slight_smile:

The tests run, and indicate status to the build properly, but I don’t yet have detailed output/reporting from the tests so I will look into this next.

Once I have something working properly end to end, I will put up a public Bitbucket repository and document what happened - but I’m about to go on holiday for a few weeks, so might not be until late January. (unless it’s very rainy while I’m holiday!)


#9