Deleting rows in a dataset

You can delete specific rows or all rows in a dataset by using a custom code.

You can use the following custom code parameters to delete specific rows in a dataset:

public String exec(ITestExecutionServices tes, String[] args) {
IDataSetController dsc = tes.getDataSetController("/testproj/ds1.csv");
try
{// This deletes rows 1 and 2 
dsc.deleteRows(1, 2);}
catch (DataSetException e)
{// TODO Auto-generated catch block e.printStackTrace();}
return null;
}

You can use the following custom code parameters to delete all rows in a dataset:

public String exec(ITestExecutionServices tes, String[] args) {
IDataSetController dsc = tes.getDataSetController("/testproj/ds1.csv");
try
{// this causes all the rows to be deleted from the dataset 
dsc.deleteAllRows();}
catch (DataSetException e)
{// TODO Auto-generated catch block e.printStackTrace();}
return null;
}