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 na...
  • avidCoder's avatar
    6 years ago

    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.