Page 1 of 1

Transfer of parameters

Posted: Tue Apr 10, 2018 12:29 pm
by kathrin
Hi everyone :),

my test case is composed as follows:

Code: Select all

- open mask 1
- SmartFolder 1 (3 iterations)
      - order something
- close mask 1
- open mask 2
- Smartfolder 2 (3 iterations)
      - View Order
      - read value
- Close mask 2
- Smartfolder 3 (3 iterations)
      - validate value
All smartfolders access the same SQL DataContext.

My problem now is that the values ​​read out in Smartfolder 2 are no longer available in Smartfolder 3.

Can I somehow achieve that?

Many Thanks :)

Re: Transfer of parameters

Posted: Tue Apr 10, 2018 12:58 pm
by odklizec
Hi,

The easiest solution is to create a global parameter(s) at test suite level. Then bind the global parameter(s) to a module variable from smart folder 2. This way you can store the obtained value at place, which is accessible from smart folder 3. Then you simply have to create a module variable in smart folder 3 and bind it with global parameter, which contains the value obtained in smart folder 2. Hope this helps?

Re: Transfer of parameters

Posted: Tue Apr 10, 2018 2:24 pm
by kathrin
Hi,
I'm not sure if that helps.
The point is that I select one value each in the iterations. That means I would need three (or number of iterations) different global parameters. But I can not bind these to a specific iteration of the Smartfolder 2.
Or do I miss something?

So for me, the question would be how to prevent the modified data context from being reset within the test case.

K

Re: Transfer of parameters

Posted: Tue Apr 10, 2018 2:56 pm
by odklizec
Ah sorry, I overlooked the smart folders are iterated. Well, I personally would do validation directly in smart folder 2, instead of separately reading data in one smart folder and then validating them in another smart folder.

If you, from whatever reason, must stick with current test design, then your only chance is to save obtained data to file/db and then load and validate them in smart folder 3. But in my opinion, the easiest way is to validate each iteration of smart folder 2 directly, instead of doing the validation in a separate loop.

Re: Transfer of parameters

Posted: Tue Apr 10, 2018 11:18 pm
by tvu
I created a user code module file that simply declared static variables. I think reference those variables from another user code module.

For example, you will have a file called ParameterPassing.cs that declares the following:

Code: Select all

public static List<string> myValues = null;
Then in your Smart Folder 2 > ReadValue.cs file, you write to that static variable or append to it. Of course, you must initialize it first if you're appending:

Code: Select all

ParameterPassing.myValues = listOfReadStringValues;
Then in your Smart Folder 3 > ValidateValues.cs file, you read the static variable:

Code: Select all

foreach (string s in ParameterPassing.myValues)
{
    // Validate values
}
The ParameterPassing.cs file must be run in the parent test container before Smart Folder 2. In your example, it must be run in the Test Suite setup phase.

Hope that helps.

Re: Transfer of parameters

Posted: Wed Apr 11, 2018 12:28 pm
by kathrin
Hi,
I do not want to hide my parameters somewhere in the background.
In the end, no one can see what value is filled by where.

I will cache my read data from Smartfolder 2 as a test case parameter and
read it again at the beginning of Smartfolder 3.
But I still find that the behavior of the Smartfolder is "wrong" at the point.
Maybe I should suggest this with Ranorex UserVoice.

K