transcendental-lisp/fitnesse/FitNesseRoot/FitNesse/UserGuide/WritingAcceptanceTests/DebuggingFitNesseTables/content.txt

21 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

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 execution log for your test run. This is true whether the test fails or succeeds. The execution log is created whenever you run a test. After a test or suite has been executed, a button "Execution Log" appears. Log information of previous runs is available through the Page History.
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 execution 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.