Page 1 of 1

Write value (innertext) to csv

Posted: Mon Dec 12, 2016 5:49 pm
by jojomonsta
Hi
Hope you can help me...

I am a tester dabbling in C#, but when I get stuck I do enlist the help of a developer, and I have been scouring the forum for information on this but don't see a clear picture about whether this can be done and if so, how.

Anyway, I know that I can use the 'Get' and 'Set' actions to grab and use a variable, which I can use and set as a Global Parameter, however I would assume that this would be over-written in each iteration.
What I would like to do is use the captured value in subsequent tests, but these may or may not be run alongside the tests in which the value I wish to capture is found, if this makes sense?

I hope you're still with me so far!? :lol:

So, my ideal scenario would be to capture the inner text value from the UI (an application Id, a unique Id generated for each of my iterations) and append to a csv or text file. I can then use this as a data sheet for the subsequent tests.

Is this something which can be done?
Any advice/help appreciated. Thank you.

Re: Write value (innertext) to csv

Posted: Mon Dec 12, 2016 7:31 pm
by Vaughan.Douglas
There are a lot of ways you could go about accomplishing this. Depending on your CSV you may be able to access it using the Microsoft ACE data provider. This is much easier if you're using an Excel file rather than a CSV. Not all CSV are created equally, an example where it doesn't work for some reason.

Microsoft also has a text connector you can try. I don't have any experience with this one though.

One thing to keep in mind, you can't update the bound data because the data source is apparently read at the start of the test set. The changes will write out, but they won't be read into the subsequent tests. This will also give you a headache when you start running tests remotely because the file you'll be trying to update is in a zip (unless you keep in in another location).

A better solution would be to create a database and update your values there.

Re: Write value (innertext) to csv

Posted: Mon Dec 12, 2016 7:40 pm
by odklizec
Hi,

You can use also built-in Ranorex CSV data connector, which supports writing to CSV file. Check for example this post...
http://www.ranorex.com/forum/writing-in ... tml#p34657

Re: Write value (innertext) to csv

Posted: Tue Dec 13, 2016 11:15 am
by jojomonsta
Vaughan.Douglas wrote: One thing to keep in mind, you can't update the bound data because the data source is apparently read at the start of the test set. The changes will write out, but they won't be read into the subsequent tests. This will also give you a headache when you start running tests remotely because the file you'll be trying to update is in a zip (unless you keep in in another location).
I did not think of this and it's a valid point. The DB option may be a better one. I can scrape AppIds from the system DB but I cannot guarantee that they will be in the same state each time I run the tests, hence wanting to use freshly created examples.

odklizec - thankyou for your suggestion. I did look at this but I would need to get the developer to translate for me!

Thanks for your advice though, both of you. This may be a 'back to the drawing board' scenario :D