Hi,
I have a global parameter and I am not setting a value for it.
In my code I am doing this:
TestSuite.Current.Parameters["StatementFromFile"]=statement;
Report.Info(TestSuite.Current.Parameters["StatementFromFile"]);
This works! So when i log it then I see the correct statement which I load from a file.
my problem is that the value is not saved.
when I am in another module and bind my variable to this parameter the value is empty.
So do I need something different to achieve this.
I read that the parameter shold be updated in the next testcase
I also tried it out but still blank.
hope that someone can helps me
I also tried many different things I found in the forums but still doesn't work.
Updating global parameters
Re: Updating global parameters
Hi,
Could you please share a screenshot of your test suite and point to the module, where you set the global parameter and the other one, where you try to read the global parameter?
Please see the attached sample project, which does exactly what you want and it works for me?
https://drive.google.com/file/d/1CfoJcV ... sp=sharing
Forum attachment system seems to be currently broken, so I uploaded it to my google drive.
Could you please share a screenshot of your test suite and point to the module, where you set the global parameter and the other one, where you try to read the global parameter?
Please see the attached sample project, which does exactly what you want and it works for me?
https://drive.google.com/file/d/1CfoJcV ... sp=sharing
Forum attachment system seems to be currently broken, so I uploaded it to my google drive.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Updating global parameters
Hi!
Must it be in a user code module in the ITestModule.Run() function?
I have it in my recording.UserCode and calling this function from the recording:
this is in recording 1 user code where i will call this function from my recording:
public void setParam()
{
TestSuite.Current.Parameters["pqlStatementFromFile"]=statement; //statement is a string from a file-> one line code as string
Report.Info(TestSuite.Current.Parameters["pqlStatementFromFile"]);
}
this is the function i call in recording2 from recording2.UsercCode
public void getParam()
{
Report.Info(TestSuite.Current.Parameters["pqlStatementFromFile"]); // The output is empty
}
Also when I have a variable in recording module and assign it to my parameter it is empty
Must it be in a user code module in the ITestModule.Run() function?
I have it in my recording.UserCode and calling this function from the recording:
this is in recording 1 user code where i will call this function from my recording:
public void setParam()
{
TestSuite.Current.Parameters["pqlStatementFromFile"]=statement; //statement is a string from a file-> one line code as string
Report.Info(TestSuite.Current.Parameters["pqlStatementFromFile"]);
}
this is the function i call in recording2 from recording2.UsercCode
public void getParam()
{
Report.Info(TestSuite.Current.Parameters["pqlStatementFromFile"]); // The output is empty
}
Also when I have a variable in recording module and assign it to my parameter it is empty
Re: Updating global parameters
No, it does not have to be in ITestModule.Run(). It should work (and works for me) also with custom method. However, the method must be a part of the recording/code module, which is a part of the test suite! In other words, it will most probably not work, if the called method is in external module, which is not a part of the test suite.
This is what I just tried:
Code: Select all
void ITestModule.Run()
{
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
setParam();
}
public void setParam()
{
TestSuite.Current.Parameters["globalParam"]="test123";
Report.Info(TestSuite.Current.Parameters["globalParam"]);
}
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Updating global parameters
Hi,
OK, but is the LoadSource.rxrec a part of test suite? This is a must! Please show me a screenshot of your test suite, where I can see the location of LoadSource module. And show me also the content of LoadSource.UserCode.cs.
OK, but is the LoadSource.rxrec a part of test suite? This is a must! Please show me a screenshot of your test suite, where I can see the location of LoadSource module. And show me also the content of LoadSource.UserCode.cs.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Updating global parameters
Thats my test suite: https://ibb.co/sFrJ6t1
This is my code:
This is my code:
Code: Select all
public void loadPqlSource()
{
string path= @"pqlStatement.txt";
string statement = File.ReadAllText(path);
Report.Info(statement);
TestSuite.Current.Parameters["pqlStatementFromFile"]=statement;
Report.Info(TestSuite.Current.Parameters["pqlStatementFromFile"]);
}
Re: Updating global parameters
Hi,
There seems to be a bound variable in LoadSource module. Where the variable is binded to and what's the content of the variable? Also I assume you are trying to read the updated Global parameter in testModule?
There seems to be a bound variable in LoadSource module. Where the variable is binded to and what's the content of the variable? Also I assume you are trying to read the updated Global parameter in testModule?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Updating global parameters
Hi!
The variable is bound to my global parameter pqlStatementFromFile.
In the global parameters section of my testsuite the value of this variable is empty.
Yeah I am updating my global parameter in loadSource module and want to read/print the updated global parameter.
The variable is bound to my global parameter pqlStatementFromFile.
In the global parameters section of my testsuite the value of this variable is empty.
Yeah I am updating my global parameter in loadSource module and want to read/print the updated global parameter.
Re: Updating global parameters
Hi,
So my example still does not work work you? If not, please share the solution you are working with. Eventually, try to create new one and implement the code I suggested. It definitely works. So it's either something wrong with your solution (check spelling) or something is overwriting the global parameter?
So my example still does not work work you? If not, please share the solution you are working with. Eventually, try to create new one and implement the code I suggested. It definitely works. So it's either something wrong with your solution (check spelling) or something is overwriting the global parameter?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Updating global parameters
your example works fine for me!
I also checked the spelling and all around and it doesn't work for me.
I will to try implement it like you did and will reply if it works then!
I also checked the spelling and all around and it doesn't work for me.
I will to try implement it like you did and will reply if it works then!
Re: Updating global parameters
Hi,
I made now an extra code Module and imported it into my testcase.
Now it works well!
Thank you very much!
I made now an extra code Module and imported it into my testcase.
Now it works well!
Thank you very much!
Re: Updating global parameters
You are welcome. Nice to hear it now works for you 

Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration