Hi,
We modify our CSV data files externally, and using UserCode modules to increment certain data. The problem is that this data does not load/refresh unless we hit the refresh button in "Manage Data Scources". Is there a way to refresh/reload the data in a UserCode module?
Thanks.
Refreshing externally modifed CSV in user code?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Refreshing externally modifed CSV in user code?
Hi,
How do you exactly increment the data in UserCode and what do you exactly mean with the file is externally modified?
Could you please describe in detail what you are trying to do?
Thanks,
Markus
How do you exactly increment the data in UserCode and what do you exactly mean with the file is externally modified?
Could you please describe in detail what you are trying to do?
Thanks,
Markus
Re: Refreshing externally modifed CSV in user code?
Hi,
Well, I have attached a screenshot. In the setup, we have created a recording increment.. which basically contains UserCode to manipulate the CSV data. Right now we add a random number after certain data.
Before increment: Username13123
After increment: Username23524
The increment occurs, but the new data is used on the next execution of the test case.
Execution 1 (We increment to Username23524 in this execution): Username13123 is used.
Execution 2: Username23524
Hope I have made my self more clearer.
Thanks.
Well, I have attached a screenshot. In the setup, we have created a recording increment.. which basically contains UserCode to manipulate the CSV data. Right now we add a random number after certain data.
Before increment: Username13123
After increment: Username23524
The increment occurs, but the new data is used on the next execution of the test case.
Execution 1 (We increment to Username23524 in this execution): Username13123 is used.
Execution 2: Username23524
Hope I have made my self more clearer.
Thanks.
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Refreshing externally modifed CSV in user code?
Hello,
Could you please describe why you want to to change values in your data source?
In general, it's not recommended to modify the data source during a test run.
I would recommend you to increment your variable in the Init() method of your incrementBasicSetup.UserCode.cs file. This would be executed before your recorded actions.
Another approach would be to put your your Recordings (LoginIE and CreateCustomer) into a nested Test Case. Then, your current values (after increment) will be used for user name as shown in the screenshot below.
Regards,
Markus (T)
Could you please describe why you want to to change values in your data source?
In general, it's not recommended to modify the data source during a test run.
I would recommend you to increment your variable in the Init() method of your incrementBasicSetup.UserCode.cs file. This would be executed before your recorded actions.
private void Init() { // Your recording specific initialization code goes here. varUsername = varUsername + new Random().Next(); };In that case, you wouldn't need to modify values in your CSV file.
Another approach would be to put your your Recordings (LoginIE and CreateCustomer) into a nested Test Case. Then, your current values (after increment) will be used for user name as shown in the screenshot below.
Regards,
Markus (T)
You do not have the required permissions to view the files attached to this post.
Re: Refreshing externally modifed CSV in user code?
Hi,
Thanks for your response.
The variable part is interesting.
Cant seem to access that variable.
We create the variable in the ranorex studio and then bind it to the CSV.
But how do we access it in custom code?
private void Init()
{
// Your recording specific initialization code goes here.
customer = customer + new Random().Next();
};
Throws an error (doesnt exist)
I have attached a screenashot on how the variable is binded in Ranorex.
Thanks
Thanks for your response.
The variable part is interesting.
Cant seem to access that variable.
We create the variable in the ranorex studio and then bind it to the CSV.
But how do we access it in custom code?
private void Init()
{
// Your recording specific initialization code goes here.
customer = customer + new Random().Next();
};
Throws an error (doesnt exist)
I have attached a screenashot on how the variable is binded in Ranorex.
Thanks
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Refreshing externally modifed CSV in user code?
Hello,
Is it possible to log the value for customer using:
(using 'Variables' button in Recording module or using 'Insert Module Variable' in User Code file)
Does it work with other created variables?
Which Ranorex version do you use?
Regards,
Markus (T)
Is it possible to log the value for customer using:
Report.Info(customer);How did you create your variable 'customer'?
(using 'Variables' button in Recording module or using 'Insert Module Variable' in User Code file)
Does it work with other created variables?
Which Ranorex version do you use?
Regards,
Markus (T)