core-jgi/fitnesse/FitNesseRoot/FitNesse/UserGuide/DebuggingFitNesseTables/content.txt

23 lines
2.3 KiB
Plaintext

So, you'd like to debug your fixtures? Remember that fixtures are run in a ''completely'' different process from !-FitNesse-! It's not easy to set a breakpoint in a fixture and then hope to trap there when the fixture is going to be run in a different process. But don't worry too much. If your fixture is written in java, then you can use !style_code(&debug), otherwose you can still use print statements.
!4 &debug
When you hit the test button it runs the test by issuing the URL !style_code(!-http://myHost:myPort/MyPage?test-!). You can force the execution to take place in the same JVM that FitNesse is running in by modifying that url to !style_code(!-http://myHost:myPort/MyPage?test&debug-!). If you have connected your debugger to fitnesse, then you should be able to set breakpoints in your fixtures. Of course this will only work if the fixtures are written in Java.
!4 Print Statements
Anything you print to standard out, or standard ''error'' will be placed in the error log page for your test run. This is true whether the test fails or succeeds. The error log page is created whenever you run a test. IF output has been captured on the error log paid, then you'll see the ''warning icon'' that says ''Output Captured'' at the upper right of the test results page. You can click on this to see the error logs.
The name of the error log page is !-.ErrorLogs.-!''yourPageName''. So, for example, if you just pushed the test button on a page named !-TestTheDravnitzTarget-! then the error log page will be at !-.ErrorLogs.TestTheDravnitzTarget-!
Debugging your fixtures should be something you rarely need to do. After all, the code in your fixtures shouldn't be doing very much. At most it should be simply wiring and piping to get the data from your tables into your application and back.
An error log page looks like this:
-----
|'''Date: '''|!-6:49:19 PM (CST) on Thursday, February 26, 2004-!|
|'''Command: '''|!-java -cp fitnesse.jar;classes fit.FitServer-!|
|'''Exit code: '''|!-0-!|
|'''Time elapsed: '''|!-0.28 seconds-!|
----'''Standard Error:'''
{{{ This is an error
}}}
-----
Notice that you can see the command that was used to run your test. This is very useful if you are concerned that your fixtures aren't running with the right classpaths. You can see the classpaths sent to the test in the ''-cp'' argument of the ''java'' command.