Menu

#46 Regular expressions in table assertions

Release_2.1
open
Core API (44)
3
2008-11-18
2005-02-02
No

There are cases where I don't know exactly what a table
cell will contain. E.g. a date/time stamp, a randomly
assigned ID, etc. It would be very useful to have
regular expression support in the table assertions.

There are a couple other feature requests dealing with
table assertions that I believe could be accommodated
with regex: the 'startswith' assertion request and the
'assert rows' request. Startswith is easy enough to
implement using regex and one could assert a number of
rows (e.g. 2 rows and 2 cells) using something like:

assertTableEquals("foo", new String[][]
{ ".*", ".*"},
{".*", ".*"});

As far as the interface, you could add another
signature of each of the assertTableXXX methods that
takes a boolean flag useRegex, e.g. Or add methods such
as assertTableEqualsExpr(...).

As a much simpler implementation, you could forget
regular expression support and just accept nulls for
table cell values, which would indicate the user
doesn't care what value exists. This would satisfy the
date/time and random ID issue, but wouldn't help the
guy who wanted 'startswith'.

Just some thoughts.

Discussion

  • Garrett Smith

    Garrett Smith - 2005-02-02

    Logged In: YES
    user_id=448609

    Oops..I just spotted the other regex feature request. Oh
    well :-/

     
  • Jevon Wright

    Jevon Wright - 2008-11-18
    • labels: --> Core API
    • milestone: --> Release_2.1
    • priority: 5 --> 3
    • assigned_to: nobody --> jevonwright
     

Log in to post a comment.