骑手运行Unity单元测试

时间:2016-12-20 07:52:08

标签: c# unity3d rider

如何从Rider-EAP运行统一单元测试?它在Unity中运行良好。

当我尝试运行测试时出现此错误:

Error:null: /Users/xxx/NavigationTest.sln :  error :
Target named 'Assembly-CSharp-Editor' not found in the project.

但我可以在Rider-EAP中构建解决方案。

来自Unity的

sln文件:

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008

Project("{6394337E-A760-107E-A1B5-972965181127}") = "NavigationTest", "Assembly-CSharp.csproj", "{09AAC607-4433-B8FC-AE7F-1AD11A119684}"
EndProject
Project("{6394337E-A760-107E-A1B5-972965181127}") = "NavigationTest", "Assembly-CSharp-Editor.csproj", "{E38ED05D-5652-068C-C70B-013EED402A29}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {09AAC607-4433-B8FC-AE7F-1AD11A119684}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {09AAC607-4433-B8FC-AE7F-1AD11A119684}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {09AAC607-4433-B8FC-AE7F-1AD11A119684}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {09AAC607-4433-B8FC-AE7F-1AD11A119684}.Release|Any CPU.Build.0 = Release|Any CPU
        {E38ED05D-5652-068C-C70B-013EED402A29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {E38ED05D-5652-068C-C70B-013EED402A29}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {E38ED05D-5652-068C-C70B-013EED402A29}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {E38ED05D-5652-068C-C70B-013EED402A29}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(MonoDevelopProperties) = preSolution
        StartupItem = Assembly-CSharp.csproj
    EndGlobalSection
EndGlobal

1 个答案:

答案 0 :(得分:1)

右键单击解决方案,然后单击“跳转到源”,或双击错误以显示相同的内容。你会得到这样的东西:

# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PROJECTNAME", "Assembly-CSharp.csproj", "{F9618595-3187-105D-65DC-297934AE12BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PROJECTNAME", "Assembly-CSharp-Editor-firstpass.csproj", "{E7257D3B-0894-2E39-2141-C8FE4E9BCA6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{C481669B-1E22-4D7C-8B33-7AB3A9D464FE}"
EndProject

该问题似乎与PROJECTNAME无关,不等于项目名称。重命名两个PROJECTNAME条目以匹配其项目:

# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{F9618595-3187-105D-65DC-297934AE12BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor-firstpass", "Assembly-CSharp-Editor-firstpass.csproj", "{E7257D3B-0894-2E39-2141-C8FE4E9BCA6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{C481669B-1E22-4D7C-8B33-7AB3A9D464FE}"
EndProject

然后您可以运行测试。

此问题为discussed on GitHubtracked by Jetbrains

我在应用此解决方法后遇到了this issue,但正如问题所示,第二次运行测试工作正常。