Fitnesse Framework using regular expression in decision table?

1.7k Views Asked by At

How to use regular expression in Fitnesse for making a decision when decision string contains static text and dynamic text? I am interested in matching dynamic text with regexp?

I am using Decision table in slim test system and wants to match dynamic part of response in decision column against a regexp. My fixture code is written in Java.

I have tried below Fitnesse test but it didn't work. In this test, Java fixture method validLink() returns a string output, in which value of Token and clientId are random (with combination of a to z and 1 to 9) and dynamic. I want to apply regexp for these dynamic values.

!define TEST_SYSTEM {slim}
!path c:/fitnesse/myfixture.jar


!|com.example.fixture.ShouldCreateLink|localhost|8080|
|terminal_id|videoclip_id|valid link?|
|3|2250702|http://172.16.18.70/2250702_s156_9405.m3u8?live&ClientID=~/([0-9a-z]+)/&Token=~/([0-9a-z]+)/|

Any help would be highly appreciated.

Thanks in advance.

Manish Bansal
Social Coding @ AspiroTV / github.com/AspiroTV

1

There are 1 best solutions below

0
On

You are really close. The annotation for regex in goes around the entire contents of the cell, not just the regular expression part.

I have't tested this, but I believe the follwing will work

!|com.example.fixture.ShouldCreateLink|localhost|8080|
|terminal_id|videoclip_id|valid link?|
|3|2250702|=~/http:\/\/172.16.18.70\/2250702_s156_9405.m3u8?live&ClientID([0-9a-]+)&Token([0-9a-z]+)/|