简体   繁体   English

Fitnesse Framework在决策表中使用正则表达式?

[英]Fitnesse Framework using regular expression in decision table?

How to use regular expression in Fitnesse for making a decision when decision string contains static text and dynamic text? 当决策字符串包含静态文本和动态文本时,如何在Fitnesse中使用正则表达式进行决策? I am interested in matching dynamic text with regexp? 我有兴趣将动态文本与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. 我的灯具代码是用Java编写的。

I have tried below Fitnesse test but it didn't work. 我曾在Fitnesse测试以下尝试过,但没有用。 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. 在此测试中,Java夹具方法validLink()返回一个字符串输出,其中Token和clientId的值是随机的(a到z和1到9的组合)并且是动态的。 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 曼尼什·班萨(Manish Bansal)
Social Coding @ AspiroTV / github.com/AspiroTV 社交编码@ AspiroTV / github.com/AspiroTV

You are really close. 你真的很亲近 The annotation for regex in goes around the entire contents of the cell, not just the regular expression part. regex in的注释涉及单元格的全部内容,而不仅仅是正则表达式部分。

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]+)/|

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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