Forum Discussion

678's avatar
678
Regular Contributor
6 years ago

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

 

 

 

  • 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.

  • avidCoder's avatar
    avidCoder
    Super Contributor

    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.

  • nmrao's avatar
    nmrao
    Champion Level 3
    Should be quite possible if there is a pattern for all test case names.
    • 678's avatar
      678
      Regular Contributor

      Yes all steps starts with "generateAcc"

      • nmrao's avatar
        nmrao
        Champion Level 3
        I was asking about test case name pattern, not the test step.