I’m just learning how to implement tests in unity and I’ve been trying but apparantly failing to add assembly definition references to my testing project. I’m unable to reference the class from my test every time I try
Folder structure is:
PlayTests.asmdef:
{
"name": "PlayTests",
"references": [
"Scripts",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}
Scripts.asmdef:
{
"name": "Scripts",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
Still unable to reference the class in my testing script:
Scripts is showing up in the references:
What I’ve tried:
- Starting the whole project from scratch, creating test folder & script from unity editor
- Closing unity, visual studio, re-opening, cleaning solution then build
- Deleted csproj, script.dll etc. then re-opened c# project
- Using GUIDs for script references
I seem to get the same issue every time and really don’t think this is me, does anyone have any suggestions?