开发者

Code coverage tools for regexes? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

Improve this question

Are there tools out there to measure code coverage of regexes? A tool that given a regex and a list of input strings, tells you which parts of the regex are exercised, with measures analogous to statement coverage, branch coverage, condition coverage, etc.

I don't care much what language or enviro开发者_Python百科nment it runs in.

(Update: after some more thought, I was realizing that it's pretty easy to start with a regex and generate various exemplars. There are some tools out there to do this: http://research.microsoft.com/en-us/projects/rex/ , http://code.google.com/p/xeger/ ). They don't seem to try to get full coverage, though; they just take random paths through the DFA.)


I am also interested in testing Regexes, and measuring the coverage achieved by these Regex tests. I have not found an off the shelf tool yet, but a research paper did indirectly measure regex test coverage by first converting the regex to a Brics Automaton, then from a Brics automaton to an XML representation, and then from that XML representation to a c# implementation of the automaton, using a technique inspired by Alekseykin. It appears that this was an automated process. I got this information directly from one of the paper authors, and he also directed me to the project site. I have not yet tried it, but intend to. Perhaps someone can beat me to it and report on their findings.


Regex Buddy - It allows you to open a testfile and run it against your regex and show you matches etc. It's pretty cheap considering how useful it is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜