New to testing. Followed instructions in video but unable to reference script from a test. Have tried in both EditMode and PlayMode. I set up an assembly for both modes. Added an asmdef to my scripts folder and called it scripts. I added it as reference to my asmdef in my EditMode assembly. Maybe I left something out as the test scripts are not seeing any of my game scripts. Attaching a screenshot to show my configuration and the EditMode assembly in the inspector. Sure would appreciate some help on this. Probably something simple and stupid.
This comes up a lot with the test framework. Your own non-test code needs to be defined in an assembly definition as well, and referenced by the test assembly.
Thank you for taking the time to reply. I believe I had created an assembly in my non test code. In the screenshot you can see I have an assembly called Scripts which is in my scripts folder. And that is referenced in the edit mode assembly. At least I thought I did that all correctly. But obviously something is off as it’s not working.
Btw I may have flagged your post inadvertently and don’t see a way to unflag it.
Does the code compile in Unity or is it just your code editor having issues?
I solved my problem. When I created the asmdef file in my Scripts folder, I somehow inadvertently created a new Scripts subfolder and my scripts.asmdef file went there. To fix it, I created a new asmdef file, directly in my Scripts folder, this time calling it ScriptsASM.asmdef. I referenced it from my EditMode.asmdef and now my test cases could see my scripts.
However, it did cause new compilation problems in my scripts folder. My scripts could no longer see TextMeshPro. So I had to add its asmdef file as a reference to my ScriptsASM.asmdef file. I also had another package, ToastUI, that I was using. It did not come with an asmdef file so I had to create one and reference it. Finding the TextMeshPro asmdef was not completely easy. There is a little circle icon next to the add reference field. When you click that, you can type TextMeshPro and it will find it.
Adding all this in case someone else has the same issues.
