Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Sharing a storeText variable between tests in a testsuite? #161

Open
pmmvr opened this issue Jun 3, 2016 · 3 comments
Open

Sharing a storeText variable between tests in a testsuite? #161

pmmvr opened this issue Jun 3, 2016 · 3 comments

Comments

@pmmvr
Copy link

pmmvr commented Jun 3, 2016

i'm using | $VariableName= | is | storeText | on | //*[contains(@class, 'testPanel')]| to create a variable and later use this variable with | ensure | do | sendKeys | on | //*[contains(@id, 'textbox')]| with | $VariableName|

This works perfectly within a single test. However, Xebium/Fitnesse, seems to forget this variable when the next test in the suite opens.

How can I share variables between tests within a testsuite ?

@cwortel
Copy link
Contributor

cwortel commented Jun 8, 2016

Tests should not be dependent on each other, so FitNesse does not support
it out of the box. Why is the value for the class not constant? What is the
problem you try to solve, maybe there is an alternative way to reach the
same goal.

On Fri, Jun 3, 2016 at 8:44 AM, pmmvr [email protected] wrote:

i'm using | $VariableName= | is | storeText | on | //[contains(@Class,
'testPanel')]| to create a variable and later use this variable with |
ensure | do | sendKeys | on | //
[contains(@id, 'textbox')]| with |
$VariableName|

This works perfectly within a single test. However, Xebium/Fitnesse, seems
to forget this variable when the next test in the suite opens.

How can I share variables between tests within a testsuite ?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#161, or mute the thread
https://github.com/notifications/unsubscribe/AAq86XjnUVUiFFgESxBinOdKoChV2jM5ks5qH81SgaJpZM4ItP2X
.

@pmmvr
Copy link
Author

pmmvr commented Jun 8, 2016

Thanks for your reply.
Let's say my suite consists out of 5 test cases.

  • In the first test cases there is (1) a new product created and (2) a corresponding product-id is generated.
  • In third test case i want to (1) sell this exact product to a customer and (2) remove this product from the inventory.

The only reliable way of ensuring the product from test case one is selected is by using the unique product ID. Due to heavy use on the test-environment it is almost impossible to predict this generated ID and testing this function is also not part of my testing scope.

If I understand you correctly, you would advice me to group these tests within one Fitnesse-testPage instead of grouping them in a testSuite using individual test-pages for each test-case?

Anyway, i did notice that within a suite, Xebium does reuse a earlier stored variable when using input commands such as typeand sendKeys but seems to "forget" the variable when using assertion commands such as waitForTextor assertValue. Would this be a bug?

@cwortel
Copy link
Contributor

cwortel commented Jun 8, 2016

Hmm that is strange behaviour. There is a differente between ‘fitnesse’ type variables and web driver internal variables. It might be something to do with that. But I would say that if one works the other should have the same behaviour. Unfortunately I don’t have time to dig into it right now. For now he quick workaround would be to store them in one page.

If you really want to make solid tests and solve the problem, I would advise you run the tests in an isolated environment where you have a control over your data. In this setup you would have a fixture that allows to write data to my system, than run a focused tests using precisely that data, and start the next test. The next tests would start with cleaning the data of the first test, write new relevant data and again run a specifically focussed tests.

Automation within a heavy used integrated environment is a bit an anti pattern, as is having depending tests, or combining different tests into one. If one test fails its practically impossible to trace what caused it and all following tests will fail as well. It’s not very fault tolerant or maintenance friendly.

Hope this helps you somehow.

On 08 Jun 2016, at 12:01, pmmvr [email protected] wrote:

Thanks for your reply.
Let's say my suite consists out of 5 test cases.

In the first test cases there is (1) a new product created and (2) a corresponding product-id is generated.
In third test case i want to (1) sell this exact product to a customer and (2) remove this product from the inventory.
The only reliable way of ensuring the product from test case one is selected is by using the unique product ID. Due to heavy use on the test-environment it is almost impossible to predict this generated ID and testing this function is also not part of my testing scope.

If I understand you correctly, you would advice me to group these tests within one Fitnesse-testPage instead of grouping them in a testSuite using individual test-pages for each test-case?

Anyway, i did notice that within a suite, Xebium does reuse a earlier stored variable when using input commands such as typeand sendKeys but seems to "forget" the variable when using assertion commands such as waitForTextor assertValue. Would this be a bug?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #161 (comment), or mute the thread https://github.com/notifications/unsubscribe/AAq86TOaVBJRRYjRIeaflJpJC2MGR8RIks5qJpMWgaJpZM4ItP2X.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants