Contributions
Groovy script to fail test run and skip to next line in datasource
Hi, I have a current issue where I am trying to write a groovy script where if criteria is met, then to proceed with the rest of the test steps and if criteria is not met then to skip to thenext row of the datasource. Test case stucture: Datasource Test step 1 Groovy - if loop to find if a criteria is met. If it is not met then i want it to proceed to the next line in the datasource and no proceed with the rest of the test steps. If the criteria is met then i want it to proceed with th rest of the test steps. Test step 2 Test step 3 Datasource Loop There are two groovy scripts I have tried: 1. if(testRunner.testCase.getTestStepByName("step 1").getPropertyValue("property1")=="0" ){ testRunner.fail("There was no property found") testRunner.runTestStepByName("DataSource Loop") } The problem with this is that 'fail' will fail the whole test case and does not proceed with any further execution. 2. if(testRunner.testCase.getTestStepByName("step 1").getPropertyValue("property1")=="0" ){ throw new Exception("There was no property found") testRunner.runTestStepByName("DataSource Loop") } This proceeds with Step 2 and Step 3 and does not skip to next row of the datasource. Does anyone have a solution to this issue?Solved5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.9KViews0likes2Comments