Zenject-2019: Integration tests are not working

Win10 Unity 2018.2.0f2 Zenject 7.1.0

Doing it by guide

you can add an integration test for it by right clicking somewhere in the Project tab and then selecting Create -> Zenject -> Integration Test and then naming it SpaceShipTests.cs. This will create the following template code with everything you need to start writing your test:

Creating UntitledIntegrationTest.cs in Assets/Scripts leads to

Assets/Scripts/UntitledIntegrationTest.cs(5,40): error CS0246: The type or namespace name `ZenjectIntegrationTestFixture’ could not be found. Are you missing an assembly reference?

Assets/Scripts/UntitledIntegrationTest.cs(3,19): error CS0234: The type or namespace name TestTools' does not exist in the namespace UnityEngine’. Are you missing an assembly reference?

Putting it under Assets/Scripts/Editor does not help(nor should it as far as I understand, since it’s an integration test) Copying TestFramework from Plugins into the Scripts helped to move a little forward, but opened yet another can of worms so I felt like this is not intended way in the first place. Am I missing something?

Just for the record, had no problems with unit tests.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16

Most upvoted comments

Thanks, tried first test assemblies proposal and it worked! A small Unity 2018 step-by-step from me for anyone who gets lost on this one

  1. Create -> Assembly Definition, for ex. under /Scripts/Tests/ (no need to have a special folder) “References”: Zenject-TestFramework “Test Assemblies”: Checked
  2. Create -> Zenject -> Integration Test, should be under the same folder as asmdef file
  3. Window -> General -> Test Runner -> PlayMode tab Created test from step 2 should be visible under created asmdef from step 1, happy testing