mercoledì 11 luglio 2012

How to debug a Fitnesse fixture (in order to extend it by creating new methods)



Whenever we want to write a new method to extend the fixture, we would probably need to debug the fixture. Here's how:
  • follow the instructions here http://vikashazrati.wordpress.com/2007/12/05/remote-debugging-fitnesse-with-eclipse/
  • consider the information retrieved here http://fitnesse.org/FitNesse.UserGuide.DebugingFixtureCode
To explain how to debug it step by step:
  • create a java project by importing as a java project the smartrics folder unzipped (smartrics-RestFixture-fb35bc2)
  • In your Eclipse IDE
  • Go to Run->Open Debug Dialog
  • Right click on Remote Java Application option in the left hand menu tree and say new
  • Create a remote java application debug configuration
  • Give it a name
  • As a project, select the java project you just created by importing it
  • As Host write the address (can be localhost) where you usually run Fitnesse
  • As a port, write 8000 (the default one)
  • Select the tab source and add the java project you just created by importing it [Add the sources to the configuration]
  • Add the breakpoints to the source code
  • Add the following line to the Fitnesse page containing the test that you want to debug
!define REMOTE_DEBUG_COMMAND {java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -cp %p %m}
  • Instead of pressing the test button to run the test, add to the url the following parameters and press enter
?responder=test&remote_debug=true
  • Come back to Eclipse, select the project, right click, Debug as -> debug configuration. It appears our debug configuration and we press debug.
  • Now we need to open the debug perspective and we can observe what's happening

Nessun commento:

Posta un commento