Forum Discussion

mgroen2's avatar
mgroen2
Super Contributor
8 years ago

Data driven testing: automatically update from - to records values over testruns

I use Data Driven loops for my tests (reading the values from Excel).

 

Currently, prior to each new test run, I need to update the From value, to the value last + 1. Reason: each entry needs to be unique in our application.

 

I need something to do this automically (don't want to be busy setting from values).

 

Example scenario:

first execution run: records 1 to 10

 

Prior to the next test run, I need to set the From record value to 11.

 

Is there a way to implement this?

 

 

 

7 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    From the first glance you can consequentially use a several number of similar data-driven loops:

     

    • mgroen2's avatar
      mgroen2
      Super Contributor

      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!

       

       

      • baxatob's avatar
        baxatob
        Community Hero

        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.