Contributions
Testing approach Business logic - Scenarios as TCs in Excel Use Groovy to run these TCs
I think Ihave read some very inspiring threads and that gave a motivation to reflect on how I ave changed the testing approach where I work So before I came: We had throusands of tests cases and guess what, only thing or things would a very params in the requets So I said this is bloody in efficient and not cool! I have strong dev background in java and already used apache POI in my previous life to create excel spreadsheets. So here is what I did: I have all my test data which is referenced by test case ID I am basically using groovy to read from this spreadsheet and run the templated test step. Properties in excel are mapped on to test suite properties and these properities are expanded onto the requests. So before it would take days to do TCs. Now it takes minutes Rest of of time is spent hitting the gym or having a coffeee lol Not really Now they got me doing other stuff. for eg now I ma interested in service virtualization. But the point is spent time up front and do things right! Here is example of groovy code I use (added here from the reply below by a moderator) // Declare content to be tested import com.google.common.html.HtmlEscapers import com.soapuitests.* def tempExelParser = new ExcelParser() String path = "U:\\git\\ens-automated-tests\\odm-content.xls" String excelSheet = "test-24hr" tempExelParser.readXLSFile(path,false,excelSheet) String key = "test-PNR" String value = "test-yyc-cashlessjun" def tempMap = tempExelParser.getData(key,value) log.info("starting tests: ${value} ----------------") log.info("data map : ${tempMap}") //def contentMap = tempMap // initialize props with blanlk values // now set with new values form excel // set test case content def prop = testRunner.testCase.testSuite.propertyList log.info("value : ${prop}") def propArr = testRunner.testCase.testSuite.getProperties() for ( item in propArr ) { testRunner.testCase.testSuite.setPropertyValue(item.key, "") log.info("value : ${item.key} ${item.value}") } for ( item in tempMap) { testRunner.testCase.testSuite.setPropertyValue(item.key, item.value) log.info("value : ${item.key} ${item.value}") } // run test case def project = testRunner.testCase.testSuite.project def testsuite= testRunner.testCase.testSuite tc = testsuite.getTestCaseByName("Templates") def testStep = tc.testSteps['24hr Test Template'] //def testStep = testRunner.testCase.testSteps['24HRRequestTest'] def status = testRunner.status log.info("status : ${status}") def result= testStep.run(testRunner,context).getStatus().toString() log.info("test case result : ${result}") // get response def currentTestStep = context.testCase.getTestStepAt(context.currentStepIndex) String propertySpec = '${' + testStep.name + '#Response}' assert result == "OK" : testStep.name + " ${value} Failed" log.info("ending tests: ${value} ----------------")2KViews1like4CommentsRe: Automate Environment creation for REST and SOAP services
Thats why I refer to as a legend! Thanks man6 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.1KViews0likes0CommentsRe: Get REST request query parameter in Groovy script
Accessing using data source def x = context.expand('${DataSource#columnName::0}') #make sure you mention the specific column name and run the whole loop(test case) to see specific values during an iteration. Hope this helps.6 years agoPlace ReadyAPI QuestionsReadyAPI Questions5KViews0likes0CommentsGroovy script running a test which is DDT
I dont think groovy is able to run through all the iterations when doing a data driven test Here is the issue: It shows as 0 tests run although the steps show its been at least with some date set from the datasource I was expecting this to go through the steps at least a few times untill all data has been tested Running this test manually is fine6 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.1KViews0likes1CommentRe: How do you design a lightweight framework to better run your API test case
I agree with reuse as much as you can rather than duplicating Resuse will mean parametrizing I am even thinking of having all the test data in data base and then being being passed on as parameters. Also you never want to have dependencies on test steps as Radfordmentioned that is just a brittle test6 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.8KViews0likes1Comment