Forum Discussion
baxatobYes, but this doesn't not auto update from value (where to start up) over test executions, right?
Once again, I need tooling that automatically starts from next record in the sheet, where next is defined as {last used test data line + 1). I need this to be traced persistant so even when TC / computer shuts down, this setup remains working.
Consider this scenario:
I have one 1 big test data file, containing 100000 entries (lets say customer entry data). Each nightly test execution, I use 5 of these 100000 for test execution. Test execution is done nightly every night for as long as needed. I do not want to interrupt test execution by setting new "from " value every day prior to test execution.
And, I do not want to define x amount of similar data loops (I think that's what you suggested?) as well. Too cumbersome!
You can do it programmatically, like:
def ddt_loop: dd_var = Project.Variables.your_DBTable_variable
row_to_start = 1 # Assuming the first row is a header with index == 0 row_to_end = 10
dd_var.Reset()
for i in range(row_to_start-1):
dd_var.Next()
for i in range(row_to_start, row_to_end+1): do_something() dd_var.Next()
You can assign row_to_start and row_to_end variables as you wish.
- tristaanogre8 years agoEsteemed Contributor
Another way to look at it is to consider the data in those 100000 rows in your spreadsheet. How much of it is required to be unique per test run? I'm assuming that, for the most part, a good part of that data is duplicated in each record and only a few fields are unique.
What you can do is, if you only need 5 records per test run (or however many), in your keyword test use some concatenated strings to make the data unique by appending a date/time stamp. I'm currently doing this in something similar where, each time I run a set of data from a spreadsheet, I need unique data. The only data that needs to be unique based upon the functionality of my AUT is the name field. So, I have 20 rows with unique names... but then I do something like Variables.CustomerData("Name") + DateTimeStamp() where DateTimeStamp returns the current date and time in the format of yymmddhhmm. This gives me unique data each test run without having to maintain a spreadsheet of hundreds of thousands of records. It also means that my data loop can simply be over the whole table rather than having to specify a range of rows.This is achievable both in script code as well as in keyword tests... you would just specify that the data being entered is a code expression and write it out as indicated above.
- chalvorson7 years agoMember
I'm currently running into this issue and I found this old post and thought I'd see if anyone has found a solution to this problem. I would like to try the "Variables.CustomerData("Name") + DateTimeStamp()" option, but I can't figure out how to add this to my keyword script. Can you please give details on how to do this: "you would just specify that the data being entered is a code expression and write it out as indicated above." Thank you!
- tristaanogre7 years agoEsteemed Contributor
Basically, where you are calling the necessary data in your keyword test, set the parameter to "Code expression" and enter the expression as indicated.
Related Content
- 4 years ago
Recent Discussions
- 3 days ago
- 4 days ago