简体   繁体   English

Slim .net:如何使用visual studio调试测试夹具?

[英]Slim .net: How do I debug test fixtures using visual studio?

I've figured out how to run my tests from the commandline using: 我已经弄清楚如何使用命令行运行我的测试:

java -jar fitnesse.jar -c MyFixturePage?test&format=text -d "c:/utils/fitnesse/" -r "FitNesseRoot"

Using this as the startup parameters for my Fixture assembly project in visual studio does not work. 在Visual Studio 将此作为我的Fixture装配项目的启动参数不起作用。 I'm using the Slim runner and executor in my fixtures : http://github.com/jediwhale/fitsharp/downloads 我在我的灯具中使用了Slim runner和executor: http//github.com/jediwhale/fitsharp/downloads

Has any one worked out how to get debugging with Slim working in Visual Studio? 有没有人研究过如何在Visual Studio中使用Slim进行调试?

The problem is that java spawns another process where your .NET code gets executed and then that process shuts down right away. 问题是java会生成另一个执行.NET代码的进程,然后该进程立即关闭。 Here's a way to get a hold of the process where the .NET code runs: 这是一种了解.NET代码运行过程的方法:

http://www.asoftwarecraft.com/2010/01/troubleshooting-with-fitsharp-and.html http://www.asoftwarecraft.com/2010/01/troubleshooting-with-fitsharp-and.html

Another good way is to simply introduce a assertion that launches the debugger. 另一个好方法是简单地引入一个启动调试器的断言。 In our code all of our fixtures derive from some simple custom base fixtures with some utilities in them like |debug| 在我们的代码中,我们所有的灯具都来自一些简单的自定义基础灯具,其中包含一些实用程序,如| debug |

this assertion just launches the debugger like so: 这个断言只是启动调试器,如下所示:

 public void Debug()
    {
        System.Diagnostics.Debugger.Launch();
    }

as soon as the assertion is hit the debugger launches. 一旦断言被调用,调试器就会启动。

this has the advantage in that you can quickly pop it in wherever you like. 这样做的好处在于,您可以快速将其弹出到您喜欢的任何位置。 Sometimes you might have a long test that uses the same assertions over and over, in which case this is nice because you can do it right before the one that's the problem. 有时您可能会进行长时间的测试,反复使用相同的断言,在这种情况下,这很好,因为您可以在问题出现之前做到这一点。

I created a simple utility that calls Debbuger.Launch without needing to change the code or the FitNesse script. 我创建了一个简单的实用程序,无需更改代码或FitNesse脚本即可调用Debbuger.Launch。 This is very useful if your code and fitnesse scripts reside in source-control. 如果您的代码和fitnesse脚本驻留在源代码控制中,这非常有用。 See this blog post for more details. 有关详细信息,请参阅此博客文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Visual Studio在.Net中调试CLR SQL Server用户定义的功能? - How do i debug CLR SQL Server User-Defined Function in .Net using visual studio? 如何在Visual Studio 2017中调试.NET 4.6框架源代码? - How do I debug .NET 4.6 framework source code in Visual Studio 2017? 如何在 Visual Studio 中调试引用的解决方案? - How do I debug a referenced solution in Visual Studio? 如何在 Visual Studio 中调试 Windows PowerShell 模块? - How do I debug a Windows PowerShell module in Visual Studio? 如何在没有Visual Studio的情况下调试.net应用程序 - How to Debug .net applications without Visual Studio 如何使用 Visual Studio 2019 中的控制台项目测试 .net 5 WPF 项目? - How can I test a .net 5 WPF project using a console project in Visual Studio 2019? 如何使用 Visual Studio 测试 .net6 预览 - How I can test .net6 preview with Visual Studio 如何使用Visual Studio GUI设置ASP.NET项目* WITHOUT *? - How do I setup an ASP.NET project *WITHOUT* using the Visual Studio GUI? 如何在visual studio中禁用本机.net代码调试? - How do I disable native .net code debugging in visual studio? 如何在Visual Studio中实际创建.NET Core项目? - How do I actually create a .NET Core project in Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM