使用 xUnit Test 运行 NUnit 测试用例
我希望能够使用 xunit.nunit.dll 之类的东西从 xUnit 运行 NUnit 测试。
I want the ability to run NUnit tests from xUnit using somehting like xunit.nunit.dll.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
示例中有一个 RunWithAttribute 可以做到这一点,但它不再位于主干上。 Codeplex 论坛上有一个帖子解释了为什么必须将其删除。
除非您有大量有趣的遗留测试并且无法移植,否则我强烈建议您不要陷入两个测试框架的境地 - 这不会带来任何好处。
There was a RunWithAttribute in a sample which did just that, but it's no longer on trunk. There's a thread on the Codeplex forum explaining why it had to be removed.
Unless you have a seriously interesting quantity of legacy tests and can't port, I strongly suggest not getting yourself into two-test-frameworks land - no good can come of it.
您可以通过单击工具,转到进程并单击 xunit.exe,将调试器与 Visual Studio 中的 xUnit 测试用例附加在一起,然后当您执行测试用例时,它们将闯入 Visual Studio,因此您能够调试测试用例
You could attach the debugger with the xUnit test cases from visual studio is by clicking on the tools, go to process and click on xunit.exe, then when you execute your testcases, they will break into visual studio and hence you got the ability to debug the test cases
如果您使用 nuget 获取最新版本的 Xunit,则搜索并替换为 .只要您使用基础断言,它就应该可以工作。
If you use nuget to get the latest version of of Xunit, then search and replace to . As long as you are using basics asserts it should just work.
据我了解您的问题,这里的核心问题是您已经在两个单元测试框架中编写了测试:xUnit.net 和 nUnit,并且您希望使用一个运行程序来运行它们(如果这不是问题,请忽略此答案) )。在这种情况下,您可能想看看 Gallio。该软件包的一部分是 Icarus Runner,它至少可以从 nunit、xunit.net、mbunit 运行单元测试。它在某些方面受到限制(例如,当您通过为用于标记测试方法的属性创建自定义子类来扩展 nunit 或 xunit 时,Icarus 不再看到它们),但大多数时候,您应该没问题。
As I understand your question, the core issue here is that you've got tests written in two unit testing frameworks: xUnit.net and nUnit and you want to run them all with one runner (if that's not the issue, please disregard this answer). In this case, you might wanna take a look at Gallio. Part of the package is Icarus Runner that can run unit tests from at least nunit, xunit.net, mbunit. It is in some ways limited (e.g. when you extend nunit or xunit by creating custom subclasses for attributes used to mark the test method, Icarus does not see them anymore), but most of the time, you should be fine.