Search code examples
javaapijenkinsfitnesse

Access Fitnesse Results shown in jenkins in java


I have scheduled a fitnesse job in Jenkins. Now when the job is complete we can see the result of the job in Fitnesse Results link. I want to access these results through java. Is there any API or something that can help me to access these results?


Solution

  • we can call direct fitnesse test If you want to run the test append your test page by ?test&format=xml and ?suite&format=xml

    for ex:- http://localhost:8086/QaTestPage?test&format=xml 
    it will return the results something like below
    
    <testResults>
    <FitNesseVersion>v20140418</FitNesseVersion>
    <rootPath>QaTestPage</rootPath>
    <result>
    <counts>
    <right>0</right>
    <wrong>1</wrong>
    <ignores>0</ignores>
    <exceptions>2</exceptions>
    </counts>
    <runTimeInMillis>50220</runTimeInMillis>
    <content>
    {{{ this will have content in HTML format
    }}}
    </content>
    <relativePageName>QaTestPage</relativePageName>
    </result>
    <finalCounts>
    <right>0</right>
    <wrong>1</wrong>
    <ignores>0</ignores>
    <exceptions>0</exceptions>
    </finalCounts>
    <totalRunTimeInMillis>52985</totalRunTimeInMillis>
    </testResults>
    

    When we call fitNesse server will return the results as shown above you can parse this XML in your java file