aaronpliu
7 years agoFrequent Contributor
Operating with TestCase properties - Groovy
- Operating with TestCase properties
Create a script which updates values of the selected options in all TestCases within the current TestSuite. All the options from the Basic tab should be available for modification (https://www.screencast.com/t/CtKSe0H8) - it's up to the script user which ones to comment/uncomment before running the script.
Below scripts to update properties of test case in basic option. I post all of them as screenshot attached(https://www.screencast.com/t/CtKSe0H8). Maybe can better construct following scripts rather than writting similar method. FYI
def searchProperties = {testcase, boolean flag -> testcase.setSearchProperties(flag)} def httpSession = {testcase, boolean flag -> testcase.setKeepSession(flag)} def abortFailOnError = {testcase, boolean flag -> testcase.setFailOnError(flag)} def failTestCaseOnErrors = {testcase, boolean flag -> testcase.setFailTestCaseOnErrors(flag)} def testCaseTimeout = {testcase, long num -> testcase.setTimeout(num)} def discardResult = {testcase, boolean flag -> testcase.setDiscardOkResults(flag)} def maxResults = {testcase, int num -> testcase.setMaxResults(num)} testSuite.getTestCaseList().each{testcase -> searchProperties.call(testcase, true) httpSession.call(testcase, true) abortFailOnError.call(testcase, false) // note its status failTestCaseOnErrors.call(testcase, true) // note its status testCaseTimeout.call(testcase, 10000) discardResult.call(testcase, true) maxResults.call(testcase, 10) }