编辑2016-10-19:
最初的问题是关于VS2015 CTP6与XUnit测试运行器特有的问题.从答案中可以清楚地看出,Visual Studio中的单元测试发现存在更广泛的问题,这可能在许多不同的情况下发生.我已经清理了我的问题以反映这一点.
我还在我自己的答案中加入了一个脚本,我今天仍然使用它来解决类似的问题.
许多其他答案也证明有助于更好地理解VS测试运行器的复杂性.我感谢人们仍在分享他们的解决方案!
原始问题2015-04-10:
从昨天开始,我的Visual Studio Test Explorer将不会发现任何项目的测试.建筑后也没有显示绿色装载栏.
当我转到Visual Studio Test Explorer并单击"全部运行",或者当我右键单击任何测试方法并选择"运行测试"时,我在输出窗口中得到以下内容:
Could not load file or assembly 'Microsoft.VisualStudio.Web.ProjectSystem, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
我在Windows 10 Pro Technical Preview上运行Visual Studio 2015 CTP 6,构建10041. .NET Framework版本似乎并不重要 - 它发生在4.0,4.5.2和4.6.
我尝试使用以下测试框架,所有这些都给出了相同的行为:
Microsoft.VisualStudio.QualityTools.UnitTestFramework v14.0.22609.0xunit v2.1.0-beta1-build2945 同 xunit.runner.visualstudio v2.1.0-beta1-build1051NUnit v2.6.4 同 NUnitTestAdapter v2.0.0我在GitHub(xunit)上发现了一个类似的问题:无法通过xunit团队的评论发现测试#295:
请注意,据报道,Visual Studio 2015 CTP 5被一般的单元测试(不仅仅是xUnit.net)打破了,所以不要指望它可以工作.
此外,请确保您已清理Visual …
unit-testing xunit test-runner visual-studio-2015 visual-studio-2017
这似乎是JetBrains Resharper 9.1 Ultimate Test Runner引用旧版NUnit的错误.我在我的程序集中使用NUnit 3.0.
[Window Title]
Unit Test Runner
[Main Instruction]
Unit Test Runner failed to run tests
[Expanded Information]
at NUnit.Core.Builders.TestAssemblyBuilder.GetCandidateFixtureTypes(Assembly assembly, String ns)
at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
at JetBrains.ReSharper.UnitTestRunner.nUnit.BuiltInNUnitRunner.RunTests(IRemoteTaskServer server, Dictionary`2 tests, Dictionary`2 fixtures, List`1 explicitly, Boolean useAddins, List`1 assemblies)
Run Code Online (Sandbox Code Playgroud)
编辑:问题消失了升级到Resharper的第10版.
Visual Studio 2012 在单元测试资源管理器中添加了"在构建后运行测试"按钮,但似乎该选项在专业版中不可用.事实上,我的"单元测试资源管理器"只是被称为"测试资源管理器",根本没有该按钮:

有没有可以取代这个缺失功能的扩展?与现有测试资源管理器UI集成的东西将是理想的.(免费选项也是首选,因为如果我可以说服我的公司领主为VS Ultimate/Premium掏空,这不会是一个问题)
最近进入测试驱动开发我使用Nunit测试运行器作为resharper的一部分.它有一些缺点,没有运行测试的快捷方式,我必须寻找Nunit测试运行器,使用鼠标调用它.它有一个很好的GUI,并将结果显示为IDE的一部分.
其他人用什么来运行针对.net项目的单元测试?我用谷歌搜索了包括MBUnit在内的其他应用程序和来自Nunit.org的单元测试应用程序,并且想知道什么是最重要的人物.
我已经编写了一些工作正常的检测测试,但是现在获得错误无法在将依赖项升级到之后解决ActivityTestRule错误
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Run Code Online (Sandbox Code Playgroud)
我正在使用android支持版本27.1.1
它与依赖项工作正常
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
Run Code Online (Sandbox Code Playgroud) android test-runner android-espresso android-instrumentation
如何让JUnit ClassLoader为它执行的每个测试类使用一个单独的?
我正在TestRunner为一个设置很多静态变量的库编写一个JUnit .我基本上想要在每个测试类之间重置所有这些,而不需要知道它们是什么.我不想加入对框架的深入了解,因为每当库内部发生变化,我的TestRunner意志就会破裂.
在我进一步发展之前,我想明确表示我确实想要这样做.
我可以在StackOverflow上找到的其他答案只是说"不要那样做",这没有用.第一个回答"静态变量愚蠢"的人赢得了甜甜圈.
我正在Eclipse中运行一个maven项目来进行我的Cucumber测试.我的测试运行器类看起来像这样:
@RunWith(Cucumber.class)
@CucumberOptions(
tags = { "@Now" },
// tags = { "@Ready" },
// tags = { "@Draft" },
features = { "src/test/java/com/myCompany/FaultReporting/Features" },
glue = { "com.myCompany.myApp.StepDefinitions" }
)
public class RunnerTest {
}
Run Code Online (Sandbox Code Playgroud)
我不想将标签硬编码到测试运行器中,而是希望使用.command文件传递它们.(即使用System.getProperty("cucumber.tag")
但是,当我将代码行添加到上面的测试运行器时,我收到错误:
@RunWith(Cucumber.class)
@CucumberOptions(
tags = { System.getProperty("cucumber.tag") }
// tags = { "@Now" },
// tags = { "@Ready" },
// tags = { "@Draft" },
features = { "src/test/java/com/myCompany/FaultReporting/Features" },
glue = { "com.myCompany.myApp.StepDefinitions" }
)
public class RunnerTest {
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:"注释属性CucumberOptions.tags的值必须是常量表达式". …
我正在尝试使用Gitlab主持一个新项目.这是一个私有的Python项目.我能够用Gitlab CI测试一些初始测试.
我在运行测试时不使用缓存,
在设置中探索跑步者部分时,会显示警告,
GitLab Runners不为它们构建的项目提供安全隔离.您正在信任所有GitLab用户,他们可以将代码推送到项目A,B或C,以便在托管运行器X的机器上运行shell脚本.
使用共享测试运行器有哪些安全风险?在共享跑步者上运行私人项目是否安全?在共享跑步者上运行测试时可以采取哪些预防措施?
感谢您的任何见解.
security testing continuous-integration test-runner gitlab-ci
是否有一个resharper的testrunner允许我运行我的nodejs mocha测试?
我个人在视觉工作室中使用Wallaby.js,但在办公室我们只有resharper许可证.我可以让NTVS使用标准的visual studio runner运行测试,但由于大多数人使用resharper窗口,因此它非常混乱.
无法在Visual Studio 2017上运行所有XUnit测试. Version 15.6.4
可以在TestExploer中查看它们,当我从那里运行它时,我会得到这样的结果:
[27.03.2018 12:21:46 Informational] ------ Load Playlist started ------
[27.03.2018 12:21:46 Informational] ========== Load Playlist finished
(0:00:00,0215566) ==========
[27.03.2018 12:22:27 Informational] Executing test method 'Lebara.Remittance.Test.ServiceImplementation.RiskEngineServiceTest.ShouldTest'
[27.03.2018 12:22:27 Informational] ------ Run test started ------
[27.03.2018 12:22:29 Warning] Multiple test adapters with the same uri
'executor://xunit/VsTestRunner2' were found. Ignoring adapter
'Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner'. Please uninstall the
conflicting adapter(s) to avoid this warning.
[27.03.2018 12:22:29 Warning] [xUnit.net 00:00:00.0209459] Skipping:
Lebara.Remittance.Test (could not find dependent assembly
'Microsoft.Extensions.DependencyModel, Version=1.1.0')
[27.03.2018 12:22:29 Warning] …Run Code Online (Sandbox Code Playgroud) test-runner ×10
unit-testing ×4
java ×2
nunit ×2
testing ×2
xunit ×2
android ×1
c# ×1
classloader ×1
cucumber-jvm ×1
eclipse ×1
gitlab-ci ×1
ide ×1
junit ×1
mocha.js ×1
node.js ×1
properties ×1
resharper ×1
security ×1