Search code examples
javafitnessefitnesse-slim

FitNesse getting the suite name in SuiteSetUp java Class


I have 2 pages a Suite page Suite1 and a SuiteSetUp page. Inside the suiteSetUp page I am calling a java constructor with the suite name as parameter.

now When I run my fitnesse suite I am getting the string 'SuiteSetUp' in java. I should get Suite1.. is it doable in FitNesse using java?

!|library |
|suite set up|${USERNAME}|${suiteName}|

suiteName is defined in a template which is included to this page

suiteName is defined as follows.
!define suiteName {${RUNNING_PAGE_NAME}}

this is how I included the template to the page the !define command is written inside the template page
!include -c .FrontPage._TEMPLATE


Solution

  • I guess you include the template page in the SuiteSetUp page, which means the RUNNING_PAGE_NAME will be "SuiteSetUp", thats why you are getting that value. (ok it may sound like I did not say anything... but that's a simple fact).

    You can switch to RUNNING_PAGE_PATH or PAGE_PATH and perform string manipulation to retrieve the last token in java if you want to do it in a similar way.