cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Call Test Step in another test case by using Groovy scripts

SOLVED
Highlighted
Occasional Contributor

Unable to Call Test Step in another test case by using Groovy scripts

project = testRunner.testCase.testSuite.project;
tcase = project.testSuites {"TestSuite"}.testCase{"TestCaseName"}
hello = tcase.getTestStepByName("Hello");
testStep.run(testRunner,context)

context.Hello.sayHello("Anil")

 

 

And getting  error:- groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlProject.testSuites() is applicable for argument types: (Script14$_run_closure1) values: [Script14$_run_closure1@a8cd35] Possible solutions: getTestSuites() error at line: 2

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Hero

Re: Unable to Call Test Step in another test case by using Groovy scripts

Hi,

 

tcase = project.testSuites {"TestSuite"}.testCase{"TestCaseName"}

These curly brackets should be square brackets:

tcase = project.testSuites ["TestSuite"].testCase["TestCaseName"]

 

View solution in original post

Highlighted
Occasional Contributor

Re: Unable to Call Test Step in another test case by using Groovy scripts

Error is :- Missing PropertyException:No such property:testStep for class:Script27 error lat ine:4

View solution in original post

8 REPLIES 8
Highlighted
Community Hero

Re: Unable to Call Test Step in another test case by using Groovy scripts

Hi,

 

tcase = project.testSuites {"TestSuite"}.testCase{"TestCaseName"}

These curly brackets should be square brackets:

tcase = project.testSuites ["TestSuite"].testCase["TestCaseName"]

 

View solution in original post

Highlighted
Regular Contributor

Re: Unable to Call Test Step in another test case by using Groovy scripts

Replace Flower braces({}) with Square braces ([]) while accessing testSuites/ testCases/ testSteps,

 

project = testRunner.testCase.testSuite.project;
tcase = project.testSuites["TestSuite"].testCases["TestCaseName"]
hello = tcase.getTestStepByName("Hello");
testStep.run(testRunner,context)
context.Hello.sayHello("Anil")

This can be replaced by,

hello = testRunner.testCase.testSuite.project.getTestSuiteByName('TestSuite').getTestCaseByName('TestCaseName').getTestStepByName('Hello')
Highlighted
Occasional Contributor

Re: Unable to Call Test Step in another test case by using Groovy scripts

Thanks for your reply

But still i am getting exceptional error .

project = testRunner.testCase.testSuite.project;
tcase = project.testSuites ["TestSuite3"].testCases["TestCase2"];
hello = tcase.getTestStepByName("Hello");
testStep.run(testRunner,context)

context.Hello.sayHello("Anil")

 

Highlighted
Regular Contributor

Re: Unable to Call Test Step in another test case by using Groovy scripts

I guess it should be testCase instead of testCase -> tcase = project.testSuites["TestSuite3"].testCase["TestCase2"];

Highlighted
Community Hero

Re: Unable to Call Test Step in another test case by using Groovy scripts

What is the error?
Highlighted
Occasional Contributor

Re: Unable to Call Test Step in another test case by using Groovy scripts

Error is :- Missing PropertyException:No such property:testStep for class:Script27 error lat ine:4

View solution in original post

Highlighted
Community Hero

Re: Unable to Call Test Step in another test case by using Groovy scripts

Error is here:

hello = tcase.getTestStepByName("Hello");
testStep.run(testRunner,context)

Use:

hello = tcase.getTestStepByName("Hello");
hello.run(testRunner,context)
Highlighted
Occasional Contributor

Re: Unable to Call Test Step in another test case by using Groovy scripts

Thanks a lot its working now 🙂

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors