PlayMode tests in Assembly-CSharp (with UTF 1.3.7)

We recently upgraded to UTF 1.3.7. We have play mode tests in our Assembly-CSharp assembly (due to legacy reasons). Since the upgrade our build process is failing with compilation errors (fails to find UnityTest attribute).

I know this is related to the upgrade, so i’d like to ask the following questions:

  • Is the scenario of keeping tests (playmode) under Assembly-CSharp still supported (with 1.3.7 release) ?
  • I suspect that our build fails since the UTF assembly is marked with a scripting define (which is probably not set anywhere in our project - UNITY_TESTS_FRAMEWORK - can / should we set it to make our build work as before ?

As long as I an remember tests had to have their own assembly. This is mainly to ensure that test code and anything the tests reference are not included in builds.

This script define is what prevents tests from included in builds if I remember correctly. So if you set that your whole project would become a test. :wink:

Try to put your testcode under a test assembly. You will need to add all dependencies to the asmdef and then it should work again - provided there aren’t any dependency cycles where non-testcode references testcode.

It’s difficult as most of our code is still in the built-in Assembly-CSharp and so we cannot create an assembly just for tests (it won’t be able to reference any code). Looking for workarounds at the moment.

You can create one assembly for your code, add all necessary dependencies and off you go, :wink: