cancel
Showing results for 
Search instead for 
Did you mean: 

Mass TestStep rename

SOLVED
Regular 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

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

Re: Mass TestStep rename

@678 

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.

4 REPLIES 4
Community Hero

Re: Mass TestStep rename

Should be quite possible if there is a pattern for all test case names.


Regards,
Rao.
Regular Contributor

Re: Mass TestStep rename

Yes all steps starts with "generateAcc"

Community Hero

Re: Mass TestStep rename

I was asking about test case name pattern, not the test step.


Regards,
Rao.
Super Contributor

Re: Mass TestStep rename

@678 

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.

New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors