Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build and run unit-tests with two distinct jobs

I have a basic setup: some source files stored in GitHub that are pulled and built by a Jenkins job.

Now I'd like to run the unit-tests automatically when the build is done (I'm using NUnit if it can help).

I could add another build step to the "build" job to run nunit-console but I'd like to separate the build task from the unit-testing task, so that in the Jenkins dashboard I can directly see what is broken: the build or "only" the tests.

I could create another job that would pull the code-source too but it would duplicate the first job.

What's the simplest way to run the unit-tests directly on the binaries produced by the first job (run second job in the same workspace? copy the binaries? ...) ?

Thanks for any input.

like image 813
Pragmateek Avatar asked Nov 02 '22 07:11

Pragmateek


1 Answers

You could use the Copy Artifact Plugin to copy the artefacts to another job and then run the unit tests but this may not work, depending on how C# handles packaging and the project is structured.

It look like you can use the NUint Plugin to publish the results of your tests so you may be able to use a single job as I don't think that the tests will run if the previous build step fails as they don't for JUnit tests

like image 141
GrahamA Avatar answered Nov 09 '22 06:11

GrahamA