Hi,
Am using user code module with repositories and in my test suite i have five test cases and each test case has one user code module
Am using a string ts as timestamp for a filename of the txt file(which contains time taken to execute the certain step in my application) and i want to use the same string in the other code module as the same timestamp. How is it possible.
String ts= System.DateTime.Now.ToString("ddMMyyyyhhmmss");
System.IO.File.AppendAllText(@"C:\\save\\"+ts+.txt"+"DateTime: ",dt+Environment.NewLine+"TestCase: "+TestCase.Current.Name+Environment.NewLine+"Duration: "+s+Environment.NewLine);
Thank you.
how to use a string from one module to other module
Re: how to use a string from one module to other module
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: how to use a string from one module to other module
But how to call the below string
String ts= System.DateTime.Now.ToString("ddMMyyyyhhmmss");
In the other code module from the first code module.
String ts= System.DateTime.Now.ToString("ddMMyyyyhhmmss");
In the other code module from the first code module.
Re: how to use a string from one module to other module
Hi,
The article I suggested in previous post describes sharing values between modules. So it should be exactly what you are looking for? If you have a problem with exact C# code, then you can use Recording module and examine the code behind the individual actions (right click on an action and select View Code or use Ctrl + Enter shortcut).
Basically, if you don't want to use variable binding, you can use below code to save string to TC parameter:
And this is how you can retrieve the string from parameter in another module...
The article I suggested in previous post describes sharing values between modules. So it should be exactly what you are looking for? If you have a problem with exact C# code, then you can use Recording module and examine the code behind the individual actions (right click on an action and select View Code or use Ctrl + Enter shortcut).
Basically, if you don't want to use variable binding, you can use below code to save string to TC parameter:
Code: Select all
String ts= System.DateTime.Now.ToString("ddMMyyyyhhmmss");
TestCase.Current.Parameters["timeStamp"]= ts;
Code: Select all
string ts = TestCase.Current.Parameters["timeStamp"];
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