get Context of parent caller testcase
I am trying to prepare a report with custom report log functions in my current project framework. I have created a an external jar and using it in my soapUI without any issues. I have defined my java class object from the jar in the TestSuite Setup script and using it across the test cases using context.setProperty.
To summarise, what I did?
1. Create my own java class object in the test suite setup script.
2. Setting the object as context.setProperty like : context.setProperty("globalResultObject",globalObject);
3. Using this object in the test cases as:
def globalObject= context.getProperty("globalResultObject");
4. Further using global object in my script to report custom message in my groovy script: globalObject.setStepStatus(globalObject,stepName);
I am also using a generic callable test suite library where I have stored some reusable testcases and I am calling them using the "Run a TestCase" option in my current testcase.
When I try to access my custom java object: def globalObject= context.getProperty("globalResultObject"); I am getting null reference. I am aware that we cannot access context property outside of my testsuite. But I am not sure how can I get context of my caller test cases and get the reference to my custom object as I was using in my parent caller test case.
1. Can I get context of my caller testcase?
2. OR, Can I set my java object as a project property so I can refer it from anywhere?
3. Or If I can declare my java class object as global property?
@mayur_vats : You can't store object in properties as properties only stores : <String,String> values. and for context refer below link:
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,