问题描述
我想为我的 Unity 项目编写 xUnit
测试。
虽然我对 Unity 本身还是很陌生,但我有 xUnit
的经验,因此是这个测试框架而不是另一个。
现在我在 Visual Studio 2019 中创建了一个新解决方案并创建了一个 xUnit
项目。
测试解决方案位于我的 Unity 项目旁边的文件夹结构中,就像在此线程中建议的那样:Unit tests are inconclusive when adding xUnit project to Unity project。
我还添加了(临时)Unity 项目 csproj
文件(每当 Unity 构建新项目时,它似乎都是新创建的)。
现在,当我想运行 xUnit
测试时,每当我运行“Unity 特定代码”时都会出错,例如 UnityEngine.Debug.Log
或 UnityEngine.JsonUtility.FromJson
。
错误消息例如读取以下内容
Message:
System.Security.SecurityException : ECall methods must be packaged into a system module.
Stack Trace:
DebugLogHandler.LogFormat(LogType logType,Object context,String format,Object[] args)
Logger.Log(LogType logType,Object message)
Debug.Log(Object message)
Settings.get_AppSettings() line 25
SettingsTest.AppSettings_Default_test() line 25
我该怎么做才能在 Visual Studio 中运行我的 xUnit
测试?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)