Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get output of sql queries in FitNesse + DbFit?

Tags:

fitnesse

dbfit

I am trying to get sql query output in DBfit using i.e. !|Execute|select * from abc| but don't know how it will display in DBfit.

like image 962
Ash Avatar asked Dec 20 '22 10:12

Ash


2 Answers

I think that you are looking for the Inspect Query table (you can find reference docs about it here).

!|Inspect Query|select * from abc|

When executed, this will print the resultset of the query.

like image 58
benilov Avatar answered Jan 09 '23 04:01

benilov


First, the execute fixture is typically used for actions that do not return data, e.g.:

!|Execute|insert into tablename values (…)|

or

!|Execute|update tablename st... where...|

However, even some non-data actions have more specific commands. The above update can be done with, for example, with:

!|Update|tablename               |
|field_to_change=|field_to_select|
|new value       |matching value |

For returning data, use the query fixture

!|query|select Id, BatchNum from tablename|
|Id    |BatchNum?                         |
|1     |>>Bat1                            |
|2     |<<Bat1                            |

As shown, just put your field names in the row below the fixture, then your data rows below that.

like image 36
Michael Sorens Avatar answered Jan 09 '23 04:01

Michael Sorens