Forum Discussion

SriniMarva27's avatar
SriniMarva27
Occasional Contributor
6 years ago

How to clear all existing properties of a data source using groovy code?

Hi,

 

Is there a way to clear all existing properties of a data source using Groovy code?

 

Thanks,

Srini

1 Reply

  • groovyguy's avatar
    groovyguy
    Champion Level 1

    What sort of data source do you have? The answer will be dependent on that. If you mean the "Data Log" at the bottom of the Data Source window, though, that isn't data that's held but just a log. Closing the Data Source window will clear that log. 

     

    Here's a snippet of clearing a Grid data source of data though.

     

     

    def grid = testRunner.testCase.testSteps["Count DataSource"].dataSource.gridModel
    
    
    int rows = grid.getRowCount();
    
    log.info(rows);
    
    for (int i = 0; i < rows; i++)
    {
    	grid.deleteRows(0);
    }