Forum Discussion
What kind of data you want to access between the groovy scripts? If it is string data, then like I mentioned earlier, store the data at appropriate level and access it using property expansion where you needed it later.
If the data is complex ( not just string) such as object, then there is one option to be able to share between the scripts provided if both the groovy scripts are run in the same context.
- PrashantS8 years agoNew Contributor
Thanks for the response Rao !
The data I want to access is object and not string type. In one step(say Step 1) I am initializing the report object and then running another step(say Step 2) from Step 1. I want the report object from step 1 to be somehow accessible in step 2.
One more thing, What if Step 1 and Step 2 are in different test suites?
- nmrao8 years agoChampion Level 3Object is accessible only "the same context" i.e.,If you run the project, then it is possible to access the object in another script. If step1 and step2 are run separately, then you would get null.
- PrashantS8 years agoNew Contributor
Hi Rao ! Let me share the script and rephrase the question based on your last response.
// step1 in suite 1
def extent = new ExtentReports(ResultExtentFileName,true)
def logger=extent.startTest("Test1")
logger.log(LogStatus.INFO,"Test1 Started !")desiredTestStep=testRunner.testCase.testSuite.project.testSuites["MainSuite"].testCases["Test2"].testSteps["Step2"] desiredContext=new WsdlTestRunContext(desiredTestStep)
WsdlTestCaseRunner desiredTestRunner = new WsdlTestCaseRunner(desiredTestCase, null);
//step2- this is in suite 2 but i am running this from step 1 in suite 1
status=desiredTestStep.run(desiredTestRunner,desiredContext)now I need the logger in step 2 being run by the statement above.
Please note that step 1 and step 2 are in separate test suites. I am able to achieve this if both steps are in same test suite.
Is it not possible if both steps are in separate test suites?
Is there any way to achieve this?
Related Content
Recent Discussions
- 15 years ago