Fitnesse test against empty string result
Asked Answered
P

3

7

I'm using Fitnesse SliM and I want to check if the result of a fixture is the empty string. Leaving the result field in Fitnesse empty just results in an ignored test which is obviously not what I want. I could solve this by extending the fixture code, but I wonder if this can be handled within Fitnesse itself.

Paderna answered 5/7, 2010 at 9:52 Comment(0)
V
6

It seems that Slim implies an empty string as an ignore, at least for the QueryTable fixture: A cell that is left blank in the table will be filled in from the result and counted as ignored.

Even though this is not considered a good solution, if you really have to you could use a regular expression to test on an empty string by matching on

=~/^$/

Another option is using the null fixture driver, as seen in http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.SlimSymbolsCanBeBlankOrNull

Venusberg answered 25/10, 2012 at 15:30 Comment(0)
S
5

passing the word 'blank' simulates a empty string.

like:

|Check|That the returned string is | blank |

Smirk answered 10/7, 2010 at 16:17 Comment(1)
I know the 'blank' keyword works with fitSharp (the .NET version) but AFAIK it's not supported for SLIM.Guesthouse
C
4

In this case - when you need to check with SLIM usage, whether the result is an empty string, you can use markup variable. Just define it somewhere on your page with test, like:

!define blank {}

And then call it anywhere you want:

|check|SomeFixtureName|${blank}|

Cochineal answered 24/6, 2014 at 12:16 Comment(2)
This works for SLIM, thanks for the answer! For non-SLIM it seems 'blank' should be the preferred option as @ryber's answer.Circumfluous
This doesn't work for me. It still ignores the test.Shaughnessy

© 2022 - 2024 — McMap. All rights reserved.