Forum Discussion

krogold's avatar
krogold
Regular Contributor
4 years ago
Solved

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 are not unlinked.

I'd like to parse all my steps and check which ones are faulty but I can't do it by hands. Is there any step property that indicates if a teststep is linked or not ?

 

thanks

 

Alex

  • 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"
    						}
    					}
    				}
    			}		
    		}
    	}
    }

2 Replies

  • krogold's avatar
    krogold
    Regular Contributor

    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"
    						}
    					}
    				}
    			}		
    		}
    	}
    }
    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      krogold You are not disturbing at all - I am sure this thread can be helpful for somebody in the future. Such content is useful for the ReadyAPI Community, so do not hesitate to post here!

       

      Also, I am glad to know you have found the solution so quickly๐Ÿ™‚