I am generating report for each and every test case. The code for the report is placed in the tear down script. I make frequent changes to the report and its very difficult to change the code every time. So I thought of placing the code in the property and accesssing in the tear down scipt. I am able to get the value from the property but not sure how to run it. Sopa UI is considering it as plain text. Any help to fetch code from property in tear down script and make it run would solve my issue.
Solved! Go to Solution.
Thanks @JoostDG for your help. But what I was looking is to place a report script in the teardown script using groovy code.I have found it and its working
Here is the code :
testRunner.testCase.testSuite.project.getTestSuiteByName('Library').getTestCaseByName('Test2').setSetupScript('log.info "34324234"') def script = context.expand( '${#[Library#Test1#te]#script}' ) log.info script testRunner.testCase.testSuite.project.getTestSuiteByName('Library').getTestCaseByName('Test2').setTearDownScript(script)
Hi Veejay.
It looks to me that the functionality you're looking for is actually this: https://support.smartbear.com/readyapi/docs/testing/scripts/library.html
You want a script library so you can maintain your piece of code on 1 place instead of "at every single place where you use it".
Thanks @JoostDG for your help. But what I was looking is to place a report script in the teardown script using groovy code.I have found it and its working
Here is the code :
testRunner.testCase.testSuite.project.getTestSuiteByName('Library').getTestCaseByName('Test2').setSetupScript('log.info "34324234"') def script = context.expand( '${#[Library#Test1#te]#script}' ) log.info script testRunner.testCase.testSuite.project.getTestSuiteByName('Library').getTestCaseByName('Test2').setTearDownScript(script)
Thanks for sharing your solution with us, @VeJaay! I'm sure it will help other users in the future.
Subject | Author | Latest Post |
---|---|---|