Forum Discussion

avidCoder's avatar
avidCoder
Super Contributor
7 years ago

How to create dynamic DataSink "Name" and "Value" using groovy and store the data dynamically

I am getting dynamic data from output file. I want to crate dynamic name and value inside DataSink. So that, the values are stored into it accordingly. Lets say. I am getting book names as AJANTA, DI...
  • avidCoder's avatar
    7 years ago

    Here is the solution to create dynamic property value inside DataSink or Properties testSteps.:-

     

    for(int i=0; i<countOfBooks; i++)
    String b = "Book"
    String temp = b.concat(i)
    testRunner.testCase.testSteps["DataSink"].setPropertyValue(temp,
    storeToDataSink.toString())
    }


    where storeToExcel is the value of the books such as AJANTA, DIKSONm PIRATE, SONIC