0

I'm trying to get FitNesse (slim tests running via fitSharp) to process tables stored in a variable. Both approach A & B below render the same on the page, but only approach B will run.

Approach A

!define test (
| Table:myTest | someValue |
)
${test}

Approach B

| Table:myTest | someValue |

This example is rather superficial, but in my tests I'm looking to vary some parameters and reexecute the same test (without a lot of copy and paste).

Adding additional details requested;

Approach A renders this to page when saving;

   <br><span class="meta">variable defined: test=
| Table:myTest | someValue |
</span>
<br><br><table>
 <tbody><tr class="slimRowTitle">
  <td>Table:myTest</td>
  <td>someValue</td>
 </tr>
</tbody></table>
<br>

...but when running the test the page doesn't seem to process the table and shows just the variable definition

<br><span class="meta">variable defined: test=
| Table:myTest | someValue |
</span>
<br><br><br></div>
Mike Stockdale
  • 5,256
  • 3
  • 29
  • 33
Christoph
  • 4,251
  • 3
  • 24
  • 38
  • 1
    Would including pages or referring to scenarios not work in your situation? Can you elaborate? – Fried Hoeben Jan 14 '17 at 15:24
  • @FriedHoeben - this case I'm defining a test table with 50 or so rows (this is automating the configuration of a product) and I want run this exact test against 3 different products. Therefore I've made one of the values in that test table (the one that controls which product is targeted) a variable. I then just change the variable and use $(test) to write out the test again using the changed variable. This all looks great on screen, but isn't picked up as a test by the runner. Funny thing is I can create the exact same output via copy and pasting the test three times and that works. – Christoph Jan 15 '17 at 03:44
  • Approach A is working for me. Can you post the results you get when you try it with a simple example? – Mike Stockdale Jan 15 '17 at 04:13
  • @MikeStockdale - Modified the questions with the output I'm seeing when running the test. When just saving it looks fine, but test run doesn't seem to pick up the table defined in the variable. – Christoph Jan 16 '17 at 17:03
  • @FriedHoeben - I think I was too quick to dismiss your suggestion... I've defined the core test on a separate static page and am including this 4 times (before each changing the variables used in the test) and this working really well. If you want to post this as an answer I'll except it... unless someone solves the running from variable directly problem first ;) – Christoph Jan 16 '17 at 17:14
  • What version of FitNesse are you running? – Mike Stockdale Jan 17 '17 at 03:11
  • @MikeStockdale v20151230 – Christoph Jan 17 '17 at 21:27
  • I'm running v20161106 and it seems to work, although I can't find a fix that was made for this issue. – Mike Stockdale Jan 17 '17 at 22:45
  • Thanks Mike- I'll try an upgrade (will be a bit) and see if that addresses it. – Christoph Jan 17 '17 at 23:04

1 Answers1

1

Try creating a separate page with the test table.

In your real test page you can include this page multiple times, after assigning values to the variables.

Fried Hoeben
  • 3,247
  • 16
  • 14