Assembly Definition Files with Test Runner
Hi,
We started using Unity 2017.3.0f3 that has new feature - Assembly Definition Files (AD). We added AD files to all our scripts files and this caused to disappearance of all unit tests in Test Runner (TR), it seems that TR does not support AD files or does not work with assemblies that are not default project assemblies. After removing AD files from script folders that contain unit test classes, TR started showing these unit tests.
Thanks!
Answer by HaraldNielsen · Jan 14, 2018 at 09:33 PM
Hi @maxim-vr We had a bug where certain assembly names where ignored up by the Test Runner. This is fixed and should be working in the next upcomming patch (2017.3.0p2). What where your asmdef name
, then I can make sure it works
Hi Narald, Thank you for help! One of our desired AD file names is "AD.Inception.Core.Tests.asmdef". BR, $$anonymous$$axim.
@maxim-vr The error we had was assemblies containing '.' in the name. For getting this working now you could remove .
in the asmdef name and the Test Runner should pick up that asmdef. Remeber its not only the asmdef filename but the name property in the asmdef inspector that sets what the compiled assembly are called. 2017.3.0p2 will contain a fix for this
@HaraldNielsen Thank you for the tip. We tried rena$$anonymous$$g file to "AD_Inception_Core_Tests_Edit$$anonymous$$ode" that is placed in folder "Editor/Tests/Scripts". Now, Test Runner recognizes all unit tests in this folder, but shows them under "Play$$anonymous$$ode" tab. Tried giving AD name similar to file name (without dots ".") - did not help, still recognized as Play$$anonymous$$ode assembly.
Hi @HaraldNielsen, we glad to hear that next patch will solve this issue. Our asmdef name is "AD.Inception.Core.Tests.asmdef". BTW on UWP\WSA asmdef won't work, we cannot compile our project without removing them.
Answer by jnbt · Jan 18, 2018 at 11:07 AM
@HaraldNielsen We have the same problem. How do we use Assembly Definitions with EditMode unit tests?
But 2017.3 should handle asmdef's correctly anyway. A fix are underway. Will let you guys know what patch it will be in
Answer by mikael_kalms · Jan 24, 2018 at 07:25 AM
I experienced related problems, but not 100% sure if they are the exact same you have experienced: Even in a minimal example project, Unity would not find any EditMode tests which were inside an asmdef dll, Issue tracker link. Unity QA says that in 2018.1 it will be possible to mark asmdefs as "Test assemblies". This will exclude the assemblies from player builds - and perhaps also make the tests show up in the EditMode list of tests.
Its correct that 2018.1 will include the Test Assemblies flag in asmdef's. The issue here is that asmdef's where only picked up as playmode tests. Even though you marked them as Editor only. If they are still not showing try this: https://answers.unity.com/comments/1454775/view.html