我有一个使用内置的 Microsoft.VisualStudio.TestTools.UnitTesting
一些测试,但不能让他们跑。
我使用的Visual Studio 2012的最终。
我有两个项目的解决方案;一个人的测试,使用Microsoft.VisualStudio.TestTools.UnitTesting
, [识别TestClass]
上课前, [TestMethod的]
前的测试方法和参考 Microsoft.VisualStudio.QualityTools.UnitTestFramework
(10.0.0.0版,运行版V2.0.50727) 。我曾尝试点净框架3.5,4和4.5别人给一个重新定位的错误。
我试图来构建解决方案和项目。测试浏览器有消息`构建您的解决方案,以发现所有可用的测试。点击运行所有建设,探索,并运行所有测试您的解决方案。
所以,问题是:我如何获得Visual Studio中找到测试
也试图遵循这样的:http://msdn.microsoft.com/en-US/library/ms379625%28v=VS.80%29.aspx但没有成功:我碰到困难的部分起步,当被要求点击右键,选择创建测试
。没有创建测试
。
我有这个测试(它编译,但不会在测试资源管理器显示):
使用Microsoft.VisualStudio.TestTools.UnitTesting;
命名空间测试{
[识别TestClass]
公共类SimpleTest的{
[测试方法]
公共无效测试(){
Assert.AreEqual(一,一个,相同的);
}
}
}
我现在已经发现了(见下文删除回答),这是因为它是一个共享驱动器上,但我不尚未知道怎么去解决它。 (一些有关安全设置可能)。
解决方案我有同样的症状,但根据不同的情况。
我不得不增加一个额外的步骤,以彼得·拉门伯格的解决方案 - 清洁您的解决方案/项目
。我的单元测试项目的目标64。当我创建的项目其最初目标86。
在切换到x64我所有的单元测试消失了。
我不得不去测试菜单 - >测试设置 - 默认处理器架构 - > 64
他们仍然没有露面。
难道一个构建。
仍然没有露面。
最后做了全新
然后,他们出现了。
我觉得清理解决方案和清理是在获得解决方案时,设定改变了打球非常有用。有时我不得不去到了极致,并删除 OBJ
和斌
目录,并做了改造。
I have some tests that use the built in Microsoft.VisualStudio.TestTools.UnitTesting
, but can not get them to run.
I am using visual studio 2012 ultimate.
I have a solution of two projects; One has tests, using Microsoft.VisualStudio.TestTools.UnitTesting
, [TestClass]
before the class, [TestMethod]
before the test methods and reference Microsoft.VisualStudio.QualityTools.UnitTestFramework
(version 10.0.0.0, runtime version v2.0.50727). I have tried dot-net framework 3.5, 4 and 4.5 others give a re-targeting error.
I have tried to build the solution and project. Test explorer has the message `Build your solution to discover all available tests. Click "run all" to build, discover, and run all tests in your solution.
So the question is: How to I get visual studio to find the tests?
Have also tried to follow this: http://msdn.microsoft.com/en-US/library/ms379625%28v=VS.80%29.aspx but with no success: I get stuck in section getting started, when asked to right click and select create tests
. There is no create tests
.
I have this test(it compiles, but does not show up in test explorer):
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace tests {
[TestClass]
public class SimpleTest {
[TestMethod]
public void Test() {
Assert.AreEqual("a","a", "same");
}
}
}
I have now discovered (see deleted answer below) that it is because it is on a shared drive, but I don't as yet know how to get around it. (something about the security setting maybe).
解决方案I had same symptoms, but under different circumstances.
I had to add one additional step to Peter Lamberg's solution — Clean your solution/project.
My unittest project targets x64. When I created the project it was originally targeting x86.
After switching to x64 all my unit tests disappeared.
I had to go to the Test Menu -> Test Setting -Default Processor Architecture -> x64.
They still didn't show up.
Did a build.
Still didn't show up.
Finally did a Clean
Then they showed up.
I find Clean Solution and Clean to be quite useful at getting the solutions to play ball when setting have changed. Sometimes I have to go to the extreme and delete the obj
and bin
directories and do a rebuild.
相关推荐
最新文章