678
6 years agoRegular Contributor
Mass TestStep rename
i have a over 500 testcases with almost 1000+ test steps
when i run complete test suite bunch of test steps failed and i cant figure out which teststep failed as beause some teststeps are same names
I wanted to rename teststep names some thing like
Testcase_001
Teststep_a_001
TestStep_b_001
Testcase_002
Teststep_a_002
Teststep_b_002
You can use this code to rename the mass testCases and testSteps:-
def testCases = testRunner.testCase.testSuite.getTestCaseList() testCases.each { def len = 0 def len1 = 0 def count = 0 def k = 1 for(testC in testCases) { len1 = len1+1 } for(int j=0; j<len1; j++){ def s = "Testcase_00"+k+"" testCases[j].setName(s) k++ } for(testSteps in it.testStepList) { len = len+1 } for (int i = 97; i < 97+len; i++) { def v = "Teststep_"+((char)i)+"_001" it.testStepList[count].setName(v) count++ } }
Similarly, you can do workaround to increment testSteps count based on testCase count.