0

I'm currently exploring FitNesse/Slim as an automated test tool. Scenarios are defined on a page named Example.ScenarioLibrary, and this particular test is defined on Example.T002Scripts.

I've defined a recurring scenario, which creates a task in the System Under Test, that I want to use in many different tests. However, the task names need to be different. I tried to arrange that by including ${RUNNING_PAGE_NAME} in the Slim table.

!2 Task configuration
|scenario        |create new task with duration           |duration                               |
|click           |New                                                                             |
|enter           |[TEST] ${RUNNING_PAGE_NAME} @{duration}s|as|Name                                |

This sort-of works, except that this produces the following Name: [TEST] <a href="Example.T002Scripts">T002Scripts</a> 20s. I want (and expected) it to be [TEST] T002Scripts 20s or [TEST] Example.T002Scripts 20s (both would be fine). Is there any way to get rid of that HTML markup? I've tried other variables (${PAGE_NAME}, ${PAGE_PATH} and ${RUNNING_PAGE_PATH}) but to no avail.

0

I've found a solution in one of the projects which came packaged with my FitNesse installation: hsac-fitness-fixtures. It contains some methods for string manipulation in the form of StringFixture. One of the methods is replace all which allows removing the HTML tags:

|$testName=|replace all                  |<[^>]*>|in|${RUNNING_PAGE_NAME}|with||
|enter     |[TEST] $testName @{duration}s|as     |Name                         |

The name of the task is now [TEST] T002Scripts 20s as desired.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.