2

I am using dbfit and encounter a problem. A big part of the tests I am doing are querys that shouldn't return any results. But when I leave the result rows empty, and executing the test dbfit tells me that ther was zero right result and zero wrong.

So I am looking for a way that dbfit will tell me that the test was right if their was no result returning.And if any result was showing I could see them(so not using assert with a count of zero)

I have tried the fail[expected result] method but it seems that dbfit regarding it like the result to assert with the returning rows from the query.not like a saved method.

So what I can do? Thanx

Mike Stockdale
  • 5,256
  • 3
  • 29
  • 33
Nadav Nagel
  • 313
  • 1
  • 2
  • 8

2 Answers2

2

What should work for you is the QueryStats table (sorry, it's not documented but there are some examples in the acceptance test suite):

!|Query Stats                                        |
|query                        | row count? |is empty?|
|SELECT * from dual where 0=1 | 0          |true     |
benilov
  • 1,234
  • 11
  • 11
1

I know I'm three years late to the party, but just thought I'd post an alternative answer in case anyone else comes across this.

At first I was going to implement benilov's approach, but then it occurred to me there was a simpler way. Just select the count of records from the table and assert that, rather than trying to select any data :

!|query|!-select count(*) RowCount from table where 0=1-!|
|RowCount?|
|0        |
UberDoodles
  • 618
  • 5
  • 13