cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Frequent Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Contributor

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

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

View solution in original post

2 REPLIES 2
Highlighted
Frequent Contributor

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

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

View solution in original post

Highlighted
Community Manager

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

@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🙂


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
The new challenge is here!

Create a script to сhange an XPath Match assertion to a JSONPath Match assertion for the TechCorner tag!


Scripts created in July:
- A script to generate an email when an assertion fails
- A script to change the request body before sending it to the server
Top Kudoed Authors