1

I want to get sql query which is to be passed in dbfit dynamically. I used columnfixture for this. I can set the query from my java fixture as variable in my fit test table but when I tried passing the same variable to dbfit it just consider that as a string than a variable. Below is my code.

!path lib/*.jar
!|dbfit.MySqlTest|

|set option|bind symbols|true|



!|fixture.GetSQLPojo|
|url|=getSQLQuery()|
|giturl| query | <--- this gives the value returned from custom fixture


!|Connect|jdbc connection|

!|Query|<<query| <--- here when i tried using the variable it wasn't working
|a|b|c|d|
|14|x|null|y|

so can anyone tell me how to pass variable from test data table to dbfit. I am a newbie to fitnesse and db fit pardon me if it a silly question or something. Was breaking my head for almost one day with this. Thanks in advance.

Update----

I have used symbolutil.setsymbols to save my SQL and when I can get the SQL by doing like this <

Rajkumar
  • 189
  • 5
  • 19

1 Answers1

0

The symbol should be prefixed with : not <<

!|Query|:query|
Mike Stockdale
  • 5,256
  • 3
  • 29
  • 33
  • I tried with this and I finally got my query in this table... But it is getting prepended and appended with two single quotes ' 'select * from table' ' – Rajkumar Feb 17 '17 at 17:00
  • OK - may be a limitation of DBFit that you can't include an entire SQL statement from a symbol. – Mike Stockdale Feb 20 '17 at 05:23
  • This problem occurs only when I give set option|bind symbols|true| this is the case for all strings not only SQL. For eg if I give xyz to the symbol it is changed to 'xyz' with quotes added to the actual string – Rajkumar Feb 21 '17 at 05:00