cancel
Showing results for 
Search instead for 
Did you mean: 

Operating with TestCase properties - Groovy

Highlighted
Frequent 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)
}
Tags (1)
1 REPLY 1
Highlighted
Community Manager

Re: Operating with TestCase properties - Groovy

Great example, aaronpliu!

Thansk for preparing it for the Community.

---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors