简体   繁体   English

在调试模式下运行Fitnesse

[英]Running Fitnesse in Debug mode

I used to use Fitnesse daily years ago, but forgot how to run tests in debug mode (or have stack trace information be output) - does anyone know? 我以前每天使用Fitnesse,但忘记了如何在调试模式下运行测试(或输出堆栈跟踪信息) - 有人知道吗?

I recall being able to configure it either as a flag when running/starting up fitnesse.jar, or as a URL parameter (eg http://localhost:8090/FitLibraryWeb.MyTest?test&debug=true ) 我记得能够在运行/启动fitnesse.jar时将其配置为标志,或者作为URL参数(例如http:// localhost:8090 / FitLibraryWeb.MyTest?test&debug = true

要在.Net中调试fixture,我通常在C#fixture代码中添加Debugger.Break()

Add the following line just before the your test target location 在测试目标位置之前添加以下行

!|debug|

For further details, refer to Michael Sorens' excelent article , the most comprehensive article on Fitnesse debug techniques. 有关详细信息,请参阅Michael Sorens的精彩文章 ,这是关于Fitnesse调试技术的最全面的文章。

Your thinking of using RunnerW.exe as opposed to the Runner.exe. 您考虑使用RunnerW.exe而不是Runner.exe。

If you change your test runner to be RunnerW a pop-up window will appear with a 'go' button on it, and will not start the fitnesse test until you hit it. 如果您将测试运行器更改为RunnerW,则会出现一个弹出窗口,其上带有“go”按钮,并且在您点击它之前不会启动fitnesse测试。

Before hitting go you can attach to any process (via 'Attach To Process' in the debug menu if your using VS) and the execution will pause at the break points set. 在点击之前,您可以附加到任何进程(如果使用VS,则通过调试菜单中的“附加到进程”),执行将在设置的断点处暂停。

Note : You must have the same build being used by FitNesse as the code you are debugging. 注意 :FitNesse必须使用与您正在调试的代码相同的构建。

You can also attach to a remote process, using the Remote Debugger. 您还可以使用远程调试器连接到远程进程。

Also, if you attach the the RunnerW.exe process, you can debug the fixtures themselves. 此外,如果您附加RunnerW.exe进程,您可以自己调试fixture。

Although my prefered development solution has already been pointed out on Rustin's DebugBreak() suggestion , and alternate solution is to invoke RunnerW.exe , which requires adding the following line to your target Fitnesse test page 虽然我已经在Rustin的DebugBreak()建议中指出了我的首选开发解决方案,但是备用解决方案是调用RunnerW.exe ,这需要将以下行添加到目标Fitnesse测试页面

[[Press me to start in remote debug mode][?responder=test&remote_debug=true]]

Please, bear in mind that I am assuming your test page already defines REMOTE_DEBUG_RUNNER pointing to RunnerW.exe , as stated in Fitnesse guide's Customizing Test Execution section 请记住,我假设您的测试页已经定义了指向RunnerW.exe的 REMOTE_DEBUG_RUNNER ,如Fitnesse指南的定制测试执行部分所述

For the sake of simplicity, I will present a sample fit test header. 为简单起见,我将提供一个样本拟合测试标题。

So, here is how to Remote Debug using Visual Studio : 那么,这里是如何使用Visual Studio进行远程调试

  1. Make sure you fitnesse test page starts with the following lines 确保您的fitnesse测试页面以以下行开头
 !define TEST_RUNNER {FitSharp\\Runner.exe} !define REMOTE_DEBUG_RUNNER {FitSharp\\RunnerW.exe} [[Press me to start in remote debug mode][?responder=test&remote_debug=true]] The rest of your test specification goes here 
  1. In Visual Studio , set target code breakpoint Visual Studio中 ,设置目标代码断点
  2. On fit test page, click on Press me to start in remote debug mode , defined above. 在适合测试页面上,单击按我以上面定义的远程调试模式启动 This starts the RunnerW.exe process (winform app called Fitsharp ) which will wait for 30 seconds (I am not sure). 这将启动RunnerW.exe进程(winform app称为Fitsharp ),它将等待30秒(我不确定)。
  3. In Visual Studio > Debug menu > Attach to process , locate RunnerW.exe and press Attach button. Visual Studio >“ 调试”菜单>“ 附加到进程”中 ,找到RunnerW.exe并按“ 附加”按钮。
  4. On Fitsharp window ( RunnerW.exe process), click GO button and you are on your way. Fitsharp窗口( RunnerW.exe进程)上,单击“ GO”按钮,即可开始使用。

As pratical solution, I use the following strategy: 作为实际解决方案,我使用以下策略:

  1. I create static page called SetupEngine and add the 3 lines stated on previous step 1. 我创建名为SetupEngine的静态页面,并添加上一步骤1中所述的3行。
  2. On the top of every test page , I just put the following header, so I don't have to repeat those 3 lines. 在每个测试页面的顶部 ,我只是放下以下标题,所以我不必重复这3行。

!include .SetupEngine !include .SetupEngine

Note that . 请注意 (dot) on .SetupEngine (which is a path) refers to your Fitnesse root page. (dot)on .SetupEngine (这是一个路径)是指您的Fitnesse根页面。 You may have to adjust it. 您可能需要调整它。

I had this ideia when I was referring to Fitnesse.UserGuide's remote debug section 当我指的是Fitnesse.UserGuide的远程调试部分时,我有这个想法

Hope it helps 希望能帮助到你

I haven't had to do it in a while, but the current documentation that comes with FitNesse indicates that you are close. 我暂时没有这么做,但FitNesse附带的当前文档表明你很接近。 You should be using remote_debug instead of debug . 您应该使用remote_debug而不是debug

The best thing is to start with the documentation that comes with your copy of FitNesse, as it matches what you are running. 最好的方法是从您的FitNesse副本附带的文档开始,因为它与您正在运行的文档相匹配。 If you are running on port 8080, then the following link should work: http://localhost:8080/FitNesse.UserGuide.DebugingFixtureCode . 如果您在端口8080上运行,则以下链接应该可以工作: http:// localhost:8080 / FitNesse.UserGuide.DebugingFixtureCode

Assuming you are using Java, these instructions should help. 假设您使用的是Java,这些说明应该会有所帮助。 If you are using a different language I am not sure I can help. 如果您使用的是其他语言,我不确定是否可以提供帮助。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM