Unity Test Runner and CI

Hi Guys,

I’m in love with the Unity Test Runner. Being able to use unit testing with timed events is amazing. I want to set up continuous integration. I can use simple NUnit with TeamCity for CI, however I want to ideally use the timed events in the Unity Test Runner. Is there a way?

Thanks!

Well, I don’t know much about TeamCity CI, but I think you should something like this:

  1. Setup TeamCity CI
  2. Setup a TeamCity project for running the tests, which executes commandline code that looks like this:

Unity.exe
-projectPath PATH_TO_YOUR_PROJECT
-runEditorTests [/code]


More about → Unity - Manual: Unit Testing

  1. Setup some projects for building the games for the different platforms, which also executes commandline code that looks like this:

“C:\Program Files\Unity\Editor\Unity.exe” -quit -batchmode -serial SB-XXXX-XXXX-XXXX-XXXX-XXXX -username “JoeBloggs@example.com” -password “MyPassw0rd”


More about Unity build commands (and other command line commands) → Unity - Manual: Command-line arguments

More info at: Unity - Manual: Unit Testing

Could not be more helpful, thank you.

Now JetBrains provides Unity plugin for TeamCity, feel free to try it.

We are actually using TeamCity for building our game clients as well as running tests for some time (PlayMode, Edit Mode).

If you need any help give me a shout !

Hi @liortal ,

My team and I are trying to setup TeamCity to do our builds and run tests. I was wondering if you could answer a few questions:

  • what are your thoughts on TeamCity vs other CIs i.e. Jenkins?
  • How did your team set up TeamCity to run tests and builds? - not sure what to do besides adding the plugin to TeamCity

Thanks in advance!

@mikegoh97 I am the biggest TeamCity fanboy alive !! i love it !

This would be the 3rd company i am using it in. In the 1st and and in current one i actually set it up from scratch.
The administration, setup and usage are very simple and friendly. So i can only recommend using TeamCity :slight_smile:

For running tests - we simply invoke Unity from the command line, passing the correct options to execute tests (edit mode, play mode).

I can help you set it up or troubleshoot it, if you like, shoot me a private message here, or email me at: liortal53@gmail.com

Hi, could you help me to implement this in Jenkins?

I am using these commands but when I create a compilation in Jenkins, it stays in loop.

Unity.exe -runTests -proyectPath C:\Users\Erick\Documents\Bitbucket -runEditorTests\Test -testResults c:\temp\results.xml -testPlatform pc