My colleague and I are currently creating a smoke test suite where on multiple occasions we are having to pass variables between two different user code modules contained within one test case.
We are managing to pass single variables between the user code modules but whenever we have multiple variables defined and attempt to pass them the information does not get passed through to the next module. The information gets stored inside of the variables in the first step in the first test in the test suite, it just does not pass through.
Is there a standard way to pass variables (single and multiple)?
Passing variables from user code module to user code module
-
- Posts: 8
- Joined: Thu Sep 29, 2022 4:33 pm
Re: Passing variables from user code module to user code module
Hi Charley,
see attached demo project for some simple paramater propagation. hope this fits your needs,
regards ,
Don
see attached demo project for some simple paramater propagation. hope this fits your needs,
regards ,
Don
You do not have the required permissions to view the files attached to this post.
-
- Posts: 8
- Joined: Thu Sep 29, 2022 4:33 pm
Re: Passing variables from user code module to user code module
Hey Don,
This isn't what I was quite looking for but thank you for the reply. My issue is being able to pass it through user code modules.
Thanks, Charley
This isn't what I was quite looking for but thank you for the reply. My issue is being able to pass it through user code modules.
Thanks, Charley
Re: Passing variables from user code module to user code module
Hi,
In that case, did you use the ADD-button which is above the usercodemodule code to create module variables ?
regards,
Don
In that case, did you use the ADD-button which is above the usercodemodule code to create module variables ?
/// <summary> /// Description of UserCodeModule1. /// </summary> [TestModule("614685C1-AF3B-4A52-9FDC-7C61A49C0911", ModuleType.UserCode, 1)] public class UserCodeModule1 : ITestModule { string _var1 = ""; [TestVariable("08d53ec0-41ca-4e33-b8af-83c08b0f5d74")] public string var1 { get { return _var1; } set { _var1 = value; } } /// <summary> /// Constructs a new instance. /// </summary> public UserCodeModule1() {if you use a usercodecollection you could add private/public variables there:
UserCodeCollection] public class MyUserCodeCollection { string _mystring = ""; public string mytestvar { get { return _mystring; } set { _mystring = value; } }
regards,
Don
-
- Posts: 8
- Joined: Thu Sep 29, 2022 4:33 pm
Re: Passing variables from user code module to user code module
Hi Don,
Yes, I have added both variables that I want to pass through to the next user code module, I have managed to figure out how to pass a singular variable between code modules. However, when you have two variables like this:
Thanks,
Charley
Yes, I have added both variables that I want to pass through to the next user code module, I have managed to figure out how to pass a singular variable between code modules. However, when you have two variables like this:
string _previousID = ""; [TestVariable("928f0119-31c4-4e6b-b706-e8ab9c4f9b9e")] public string previousID { get { return _previousID ; } set { _previousID = value; } } string _currentID = ""; [TestVariable("89f3b1d3-b937-4dd9-9d64-b6bf94bef606")] public string currentID { get { return _currentID ; } set { _currentID = value; } }Then try to access them in the following code module, no values seem to be passed over. The variables definitely have values stored in the first user code module as I have them being logged to the console and it prints the correct values.
Thanks,
Charley
Re: Passing variables from user code module to user code module
Hi,
make sure to bind the variables in the rxtst-file !
I updated the example solution. Don
make sure to bind the variables in the rxtst-file !
I updated the example solution. Don
You do not have the required permissions to view the files attached to this post.
-
- Posts: 8
- Joined: Thu Sep 29, 2022 4:33 pm
Re: Passing variables from user code module to user code module
Hi,
Thank you! This has worked.
Regards,
Charley
Thank you! This has worked.
Regards,
Charley