Forum Discussion
Hi Richie,
In ProjectA's groovy script, I used this codes
def workspace = testRunner.testCase.testSuite.project.getWorkspace();
def ProjB = workspace.getProjectByName(ProjectNameB)
def SuitesB = ProjB.getTestSuiteByName(TestSuiteNameB)
def CaseB = SuitesB.getTestCaseByName(TestCaseNameB)
def Step1 = CaseB.getTestStepByName(TestStepNameB)
Step1.run(testRunner,context)
where ProjectNameB,TestSuiteNameB,TestCaseNameB and TestStepNameB are all in ProjectB.
To add more information for what steps have used,
ProjectA
- TestSuiteA
- TestCaseA
-TestStepA (is a groovy script that calls TestStepB in ProjectB)
ProjectB
- TestSuiteB
- TestCaseB
-TestStepBProperty is a Property Step
-TestStepB(is HTTP request step which reads a property in TestStepBProperty using "${Property in
TestStepBProperty}")
It is not possible to copy ProjectB to ProjectA because ProjectA is just a Project runner, which can also run other projects.
Thank you for spending time with my question.
Hi,
well I know why it's not working but unsure how to resolve.
there is a checkbox on the testcase properties 'Search preceding steps for Property Values' which if I understand correctly means that any step that calls a property from a properties step will search all the preceding steps in the test to do this.
The reason why your test case works when you run it independantly is the property is 'in session' (for lack of a better phrase). So if you run the TestCaseB once and the property is passed to the HTTP Request that uses the property. Furthermore after running the test once, because the property is still 'in session' (there's got to be a better phrase cos this isn't a genuine session but I'm struggling) - you could just run the HTTP step again and it would still work.
When you try and TestCaseA which calls the HTTP Request in TestCaseB, the property isn't 'in session'.
I don't know if this would work or not - but if TestCaseA is calling the HTTP Request in TestCaseB - could you not alter the groovy to actually call the TestCaseB's Properties step first and then subsequently call TestCaseB's HTTP Request?
As I say - unsure if this would work - but I'd give it a shot to see what happens,
cheers,
richie
Related Content
- 10 years ago
- 4 years ago
Recent Discussions
- 5 days ago