i am rommel

Starting to write my own history

Using command line to run Fitnesse Test


   Nov 23

Using command line to run Fitnesse Test

Here are the steps in running the Fitnesse Tests from the command line

 

  1. Make sure you have Fitnesse and its running

     

 

 

  1. Use this command line
    1. Basic running of Fitnesse test using command line

       

      java -cp fitnesse.jar fitnesse.runner.TestRunner localhost
      8091
      BlastSuitesOsam
      –v

       

      localhost – the running fitnesse server

      8091 – the port number of fitnesse server

      BlastSuitesOsam – the test page or test suite you want to run

      -v – if you want to output the results in command window

       

      Here is the output of that command


     

    1. Running specific Fitnesse test page from command line

       

      java -cp fitnesse.jar fitnesse.runner.TestRunner localhost 8091 BlastSuitesOsam.ManageAccounts –v

      BlastSuitesOsam.ManageAccounts – the specific page to be run

       

      Here is the output of that command


     

    1. Running Fitnesse Test with XML file output – It will output the test results in xml and command window to be consumed by other application (emailing this file is one common scenario)

       

      java -cp fitnesse.jar fitnesse.runner.TestRunner localhost 8091 BlastSuitesOsam.ManageAccounts –v –xml C:\BlastSuitesOsam.xml

       

      –xml C:\BlastSuitesOsam.xml – any directory that has read-write permission

       

      Here is the output of that command



     

     

    1. Running Fitnesse Test on accessible network other than the localhost – running fitnesse test on Test servers on build servers are the common scenario for this

       

      java -cp fitnesse.jar fitnesse.runner.TestRunner bai-tmg 8080 BlastSuitesOsam.AccountCreation –v –xml C:\BlastSuitesOsam.xml

       

      bai-tmg 8080 BlastSuitesOsam.AccountCreation
      the Fitnesse server host, port and Fitnesse page you want to run

       

      Here is the output of that command



     

Conclusion

With this command line utility you can easily integrate the Fitnesse Test with your Continuous Integration Practices using Nant or other tool that able to used commands. You can run the test even if the Fitnesse Server is on other machine/server, like your build server, test server, development server, etc. And finally, the command line can output XML that contains the test results, very helpful if you want to consume this information such as emailing this results, creating new scrum work item for failed test, etc. Imagination is your limit.

Note:
1. In command line make sure you follow the proper casing of the highlighted text below as Fitnesse is governed by camel casing
java -cp fitnesse.jar fitnesse.runner.TestRunner localhost 80 FitNesse.SuiteAcceptanceTests

2. Running the commands number 2.c or 2.d multiple times will just overwrite the output file (C:\BlastSuitesOsam.xml)

Here is some useful resource

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

blog comments powered by Disqus