-1

In our FitNesse tests, we use a ScriptTable to call an external tool, which imports some data to our database. The table looks like this:

!| script | Fixtures.MyClass |
| Update Dir | c:\FitNesse\XXXX\XXXXX |
| check | Message | |

UpdateDir is a function defined in our fixtures. It sets log-content to a variable called "Message". The content of Message looks like this:

Daten aus der Tabelle 'Table1' wurden gelöscht.Datei 'c:\FitNesse\XXX\File1.xml' konnte nicht importiert werden: ORA-00904: "ColX": ungültiger Bezeichner
Daten aus der Tabelle 'Table2' wurden gelöscht.Datei 'c:\FitNesse\XXX\File2.xml' wurde erfolgreich importiert.

With "check Message" the content of the variable is displayed at Runtime in the table, but not checked so far.

Now i want to extend the table with a row to check the content with a contain function.

If the variable "Message" does not contain the text "ORA-" Then Success Else Error

I tried to add the folllowing row to the ScriptTable:

| ensure | Message | should not contain | ORA- |

But now the table throws an error "ensure Method messageora not found in PassivPlusFixtures.MyClass" Can somebody help me to achive the desired behavior? Thank you so much in advance.

Chris2011931
  • 106
  • 1
  • 1
  • 10

1 Answers1

1

You can check using regular expressions in script tables, using that feature you should be able to do what you need. But given the horrible regular expression, I recommend to hide the check in a scenario.

Something like:

|script    |Fixtures.MyClass         |
|Update Dir|c:\FitNesse\XXXX\XXXXX   |
|check     |Message|=~/^((?!ORA).)*$/|
Fried Hoeben
  • 3,247
  • 16
  • 14