Forum Discussion

krogold's avatar
krogold
Regular Contributor
5 years ago

Is it possible to check if a 'run test case' step is properly linked to a testcase ?

Hello,   after doing a merge, I realized I made som 'savage' cuts in my testcases, removing cases that, I though, were no longer used. In fact some of them were still used and I have to steps that ...
  • krogold's avatar
    5 years ago

    well, in fact I found that I can use the "targetTestCase" property ...

    sorry for disturbing

     

    if someone needs it :

    testRunner.testCase.testSuite.project.testSuiteList.each{
    	TS ->
    	ts_name = TS.name
    
    	if (ts_name != "tools")
    	{
    		// for each test case
    		TS.getTestCaseList().each{
    			TC ->
    			tc_name = TC.name
    			if (tc_name.contains("TODO") == false)
    			{
    
    				// parse test cases
    				TC.getTestStepList().each{
    					tStep->
    					
    					if (tStep.name.contains("- todo"))
    					{
    						log.warn "obsolete step to discard: " + tStep.name
    					}
    					else if (tStep.config.type == "calltestcase")
    					{	
    						if (tStep.targetTestCase == null)
    						{
    							log.info "$tc_name / ${tStep.name} link is broken"
    						}
    					}
    				}
    			}		
    		}
    	}
    }