You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 27, 2019. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 27, 2019. It is now read-only.
How to define variables for scenarios on a test page? #160
I have a number of generic test scenarios that contain variables. I now want to combine these scenarios in test pages to create user stories. The definition of the variables will be different in each test page.
When I define the variables in the ScenarioLibrary page it works flawless. However, when I define the variables in a test page and create a script combining a number of scenarios, Fitnesse is unable to grab the definition of the variables...
I am aware it's possible to use variables by placing a variable name after the scenario logical name, calling the variable in the scenario and then defining this variable again in the test page. Like this in ScenarioLibrary
| scenario | add product | productname |
| ensure | do | sendKeys | on | id=product_name | @productname|
I actually have created an issue in the Fitnesse project for a similar
issue. The variables are not picked up by scenario's in a library that is
higher in the project structure. The issue has not been solved, because the
Fitnesse team at that point was scared it would somehow result in
compatibility problems with exiting users.
I can't remember quite how I worked around it.
One question, is the idea you're aiming to reuse identical test pages with
a variaty of different products? In other words, what is the exact need for
the use of variables here. If you do not want to reuse the entire test
page, this would be the way to use your scenario.
I have a number of generic test scenarios that contain variables. I now
want to combine these scenarios in test pages to create user stories.
The definition of the variables will be different in each test page.
When I define the variables in the ScenarioLibrary page it works flawless.
However, when I define the variables in a test page and create a script
combining a number of scenarios, Fitnesse is unable to grab the definition
of the variables...
I am aware it's possible to use variables by placing a variable name after
the scenario logical name, calling the variable in the scenario and then
defining this variable again in the test page. Like this in ScenarioLibrary
| scenario | add product | productname |
| ensure | do | sendKeys | on | id=product_name | productname|
and this in the test page
!define productname {iPad}
|script|
|add product | $productname|
but this seems to work only for 1 variable ...
Does anyone have a tip or a work-around to get this working?
Thanks.
—
Reply to this email directly or view it on GitHub #160.
Which was a wrong and premature assumption on my side.
I found out that each variable in the scenario title needs a preceding descriptor in order to work. So my current workaround is to add all variables in the relevant scenario in the Scenario Library, so you get this:
|Scenario| Add new product | PRODUCT| with color | COLOR | and memory| MEMORY |
| ensure | do | type | on | id=name| with | @PRODUCT |
| ensure | do | select| on | id=colortype | with | lablel=@COLOR |
| ensure | do | select | on | id=gb-memory| with | label=@MEMORY |
In the test page I add the following variables:
!define PRODUCT {iPAD}
!define COLOR {Space Grey}
!define MEMORY {16gb}
And the sript as:
|script|
| Add new product | ${PRODUCT}| with color | ${COLOR} | and memory| ${MEMORY} |
Which results in:
|script|
| Add new product | iPad | with color | Space Grey | and memory| 16gb |
So now i can create different test-pages for different products or simply change the variables on the test page accordingly to quickly run new tests.
This is working perfectly so far and gives the business a clear idea of what is being tested.
but this seems to work only for 1 variable ...
Which was a wrong and premature assumption on my side.
I found out that each variable in the scenario title needs a preceding
descriptor in order to work. So my current workaround is to add all
variables in the relevant scenario in the Scenario Library, so you get this:
|Scenario| Add new product | PRODUCT| with color | COLOR | and memory| MEMORY |
| ensure | do | type | on | id=name| with | Product |
| ensure | do | select| on | id=colortype | with | lablel=Color (@color) |
| ensure | do | select | on | id=gb-memory| with | label=memory |
In the test page I add the following variables:
!define PRODUCT {iPAD}
!define COLOR {Space Grey}
!define MEMORY {16gb}
And the sript as:
|script|
| Add new product | ${PRODUCT}| with color | ${COLOR} | and memory|
${MEMORY} |
Which is working for now.
—
Reply to this email directly or view it on GitHub #160 (comment).
Activity
cwortel commentedon Mar 7, 2016
Hey,
I actually have created an issue in the Fitnesse project for a similar
issue. The variables are not picked up by scenario's in a library that is
higher in the project structure. The issue has not been solved, because the
Fitnesse team at that point was scared it would somehow result in
compatibility problems with exiting users.
I can't remember quite how I worked around it.
One question, is the idea you're aiming to reuse identical test pages with
a variaty of different products? In other words, what is the exact need for
the use of variables here. If you do not want to reuse the entire test
page, this would be the way to use your scenario.
|script|
|add product | ipad |
For my initial issue:
unclebob/fitnesse#37
On Mon, Mar 7, 2016 at 2:47 PM, pmmvr notifications@github.com wrote:
pmmvr commentedon Mar 9, 2016
Hi,
Thanks for your answer. I found a workaround.
In my OP i wrote:
Which was a wrong and premature assumption on my side.
I found out that each variable in the scenario title needs a preceding descriptor in order to work. So my current workaround is to add all variables in the relevant scenario in the Scenario Library, so you get this:
In the test page I add the following variables:
And the sript as:
Which results in:
So now i can create different test-pages for different products or simply change the variables on the test page accordingly to quickly run new tests.
This is working perfectly so far and gives the business a clear idea of what is being tested.
cwortel commentedon Mar 9, 2016
excellent ;)
On Wed, Mar 9, 2016 at 10:33 AM, pmmvr notifications@github.com wrote: