Forum Discussion
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?
- nmrao8 years agoCommunity HeroIt is already answered in the last 2 replies. Possible only if all the suites are run in the same context.
When the object is created, set it to context ie.,
context.logger = logger
In the later script, get it by:
def logger = context.logger
Disclaimer: You get null for the other instances if you run the scripts separately.