Contributions
get Context of parent caller testcase
Hi Guys, 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?1.2KViews0likes1CommentRe: get property value of a test case's step when this test case is called from another test case
Thank you, Himanshu for your prompt response. This script is executed as teardown script of a test suite so testRunner will not be an option there. It might work with runner object but I just figured it out with minor UI setting from SoapUI itself: I was calling a test case with the run mode option selected in the screenshot. If I select any option other than the selected one, I am able to read the properties of the callable test case when called as a Test Step. But thank you again for your help.1.7KViews0likes1Commentget property value of a test case's step when this test case is called from another test case
Hi Guys. I am new to SoapUI tool and trying to setup a framework from scratch. I am using SoapUI for an end to end testing rather than API response validation. So, as part of framework, I have setup it in such a way: Suite1: > TC1 > TC2 Suite2: > TC3 > TC4 Generic: (This suite contains generic reusable tests which can be called in Suite1&2) > loginToApp > createAccounts > fetchAccountDetails I am creating a new custom report to report the execution detail of each step in extent report. I have used the test suite teardown script option to create a custom file for now. The issue is: when I am trying to fetch response and request properties of my callable methods, they always return as Null. So I am not able to write them in my custom file. This is my script below: runner.results.each{ testCaseRunner -> log.info 'test case name:'+testCaseRunner.testCase.name testcase_logger = testsuite_logger.createNode(testCaseRunner.testCase.name); testCaseRunner.results.each{testStepRunner-> def testStep=testStepRunner.testStep log.info 'Config'+testStep.config log.info 'Type'+testStep.config.type if(testStep.config.type.toString().equals('calltestcase')) { def callableTest=testStep.targetTestCase def callableTestName=callableTest.name log.info 'callable test name--'+callableTestName callableTest.getTestStepList().each{callableTestStep-> log.info 'callable step name---'+callableTestStep.name log.info 'callable step type---'+callableTestStep.config.type for(testProperty in callableTest.getTestStepByName(callableTestStep.name).getPropertyList()){ if(testProperty.isReadOnly()){ log.info( 'Output property: ' + testProperty.getName() + ' = ' + testProperty.getValue()) }else{ log.info( 'Input property: ' + testProperty.getName() + ' = ' + testProperty.getValue()) } } I have printed all the properties but request and response are always null. Can anyone guide me on how to fetch request and response from the callable test step's response when the callable testcase is part of another testsuite?1.7KViews0likes3CommentsProject teardown script executes only when tests are executed from project test runner
Hi I am trying to run certain scripts in project's tear down section to generate a custom result file. To start with I found out that project teardown scripts will execute only when we launch the script execution from project test runner. If we execute scripts from the test suite's test runner option then the project's tear down script will be not be executed. Is this understanding correct? Can anyone confirm how to call projects' tear down script every time we run our scripts either from the test case or test suite level?Solved1.1KViews0likes2Comments