简体   繁体   中英

Regular expressions in Fitnesse Tables

I am trying to process a string with a date in Fitnesse:

"2016-06-09T15:20:03.336+01:00 @ Perspective editor; User: admin"

The date part of the string will change on every test run.

My understanding is that I can use =~/regex here/ in my results table ie

|name|Change String|Status|
|ui-comp/P1 Test Perspective.txt|=~/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}\+01:00 @ Perspective editor; User: admin/|ADDED|

AFAIK the regex is good and should work, but my test still fails with:

=~/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}+01:00 @ Perspective editor; User: admin/ expected
2016-06-09T15:20:03.336+01:00 @ Perspective editor; User: admin actual

Any ideas what I am doing wrong here? The java code simply fetches some table rows via selenium and puts them in a setFixture, like this:

@Override
public SetFixture getEventTable() throws Exception {
    return new SetFixture(getTableElement('EventTable').getRows('added'));
}

确保您的实际值的开头或结尾处没有多余的空格,应易于在结果页面中用不同的红色阴影来发现它,其他一切似乎都很好。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM