问题描述
我最近安装了 Visual Studio 2013,CodeLens 很棒!我发现的问题是,每当我打开一个包含方法的类文件时,如果它不是用 MSTest 编写的,它似乎找不到与该方法关联的单元测试.我需要做些什么才能找到像 MSpec 这样的其他单元测试吗?
I recently installed Visual Studio 2013 and CodeLens is amazing! The problem that I find is that whenever I open a class file that has methods in it, it doesn't seem to find the Unit Tests associated to the method if it is not written in MSTest. Is there anything that I have to do so that it can find other Unit tests like MSpec?
是否因为 Machine Specifications 在创建单元测试时采用了与 MSTest 或其他测试框架不同的方法?
Is it because Machine Specifications has a different approach when creating unit tests vs MSTest or other testing framework out there?
推荐答案
测试者和测试状态指示器由测试资源管理器提供支持.
The tested by and test status indicators are powered by the test explorer.
因此,如果您的 MSpec 测试显示在测试资源管理器中并且是用 C# 或 VB 编写的,它们也应该显示在 CodeLens 中.
So if your MSpec tests show up in the test explorer and are written in C# or VB, they should also show up in CodeLens.
(与 Visual带有 NUnit 的 Studio 2013 功能代码镜头)
我只是通过在扩展管理器中安装 Nunit 和 Nunit 扩展,在干净的机器上使用 NUnit 完成的.这里Main
显示一个引用和一个通过测试,测试本身在成功运行后显示对勾.
I just did it with NUnit on a clean machine by installing Nunit and the Nunit extension in extension manager. Here Main
shows one reference and one passing test, and the test itself shows the checkmark after successfully running.
这篇关于CodeLens 只找到用 MSTests 编写的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!