Automatically run tests before a build and cancel the build if the tests fail?

I have a IPreprocessBuildWithReport that I’m using. Is there a snippet of code I can put in there to run all tests before I build and set it to cancel the build if any tests fail? I’ve accidentally forgotten to do this before and sent people broken builds. I don’t want to have to remember to do this every time when I could just script it (I hope).

Hey. Currently there is not an exposed way for code to trigger a test run. It is however something that we expect to have an API exposed for in the 2018.2 timeframe.

1 Like

2019.2?

1 Like

Nice!

Yes, sorry. Meant to write 2019.2.

Are you going to backport it?

So, has the API been exposed? I looked through the patch notes and didn’t see it mentioned.

Yes. It is exposed in version 1.1.0 of the package and forward. The package supports unity 2019.2+.

2 Likes

That’s great news. Is there doc/blog/tut on how we can do this? (auto-run tests and quit the build if they/subset fail?) Thx

In the talk they gave at Unite they showed how to do that: https://discussions.unity.com/t/761114

1 Like

awesome, thx!