Section 27.4. Debugging FitNesse Tests


27.4. Debugging FitNesse Tests

Given that FitNesse runs as a Web server, it is not so easy to debug fixtures. The simplest, most direct approach is to display diagnostics with System.out.println(). These diagnostics can be accessed through a link at the bottom of the report page that's generated when the test is run.

If you need to run a debugger, use Fit directly. To use Fit with a FitNesse page, take the source of the HTML that FitNesse generates for the browser. Discard the extra level of table that's used to organize the whole page, and use what remains with Fit.

If the test tables have identified some problems within the application, it will be simpler to use JUnit to help track down the problem. You can use a debugger with that. And this will encourage you to create suitable JUnit tests into the heart of the application.

Questions & Answers

Q1:

When should we use Fit tables and when JUnit tests?

A1:

Usually, Fit tables are used for testing the business rules and the use of the system. Ideally, someone who knows what's needed, such as a business analyst, writes these tests, in collaboration with testers and other developers. Usually, JUnit tests are written by developers and testers to test and to drive the development of the inner parts of the software.

Sometimes, each may be used in the other role. For example, Fit tables may be used for programmer testing when the amount of tabular test data is easier to manage in Fit tables than by using JUnit.

Q2:

Are there any differences in the way Fit and FitNesse handle tests?

A2:

There are some small differences; tables are written in a different way in FitNesse, which converts a wiki page into HTML before running Fit. FitNesse passes on to Fit any HTML that you put in table cells, such as <BR>; this can be used to better format the report or to signify line breaks to the fixture, for example.

Q3:

Is there a way to have FitNesse run Fit tests automatically as a part of a build?

A3:

Yes. See the FitNesse manual for details.



    Fit for Developing Software. Framework for Integrated Tests
    Fit for Developing Software: Framework for Integrated Tests
    ISBN: 0321269349
    EAN: 2147483647
    Year: 2005
    Pages: 331

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net