Forum Discussion
Cizo89
12 years agoFrequent Contributor
Hi,
I figured out that from the beginning I was trying to do this by the hard way (building the REST TestRequest from scratch).
Recently I came up with some simpler idea, but the result is still the same - either I receive the above mentioned Dialog window for missing REST TestReuqest or the script will ended without any failure, but the REST TestRequest won't be created.
I'm looping over my interfaces and want to create the REST TestRequest based on specific RestResource, but it still isn't working.
Here is my code:
I'm not sure what I'm doing wrong, all 5 attempts should be working correctly.
Thanks for answer
Regards,
Marek
I figured out that from the beginning I was trying to do this by the hard way (building the REST TestRequest from scratch).
Recently I came up with some simpler idea, but the result is still the same - either I receive the above mentioned Dialog window for missing REST TestReuqest or the script will ended without any failure, but the REST TestRequest won't be created.
I'm looping over my interfaces and want to create the REST TestRequest based on specific RestResource, but it still isn't working.
Here is my code:
testRunner.testCase.testSuite.project.getInterfaceList().each{
it.getAllOperations().each{
if (it.getName().contains("RSP120")){
testRunner.testCase.testSuite.addNewTestCase(testCaseName)
def newTestCase = testRunner.testCase.testSuite.project.testSuites["customProjectDefects"].testCases[testCaseName]
RestRequestStepFactory restStep = new RestRequestStepFactory()
//attempt no. 1
RestResource restResource = new RestResource(it.getInterface(), it.getConfig())
RestMethod restMethod = new RestMethod(restResource, RestMethodConfig.Factory.newInstance())
restStep.buildTestStep(newTestCase, restStep.createNewTestStep(restMethod, "RSP120 POST"), false)
/*
//attempt no.2
RestResource restResource = new RestResource(it, it.getConfig())
RestMethod restMethod = new RestMethod(restResource, RestMethodConfig.Factory.newInstance())
restStep.buildTestStep(newTestCase, restStep.createNewTestStep(restMethod, "RSP120 POST"), false)
*/
//attempt no.3
//restStep.buildTestStep(newTestCase, restStep.createNewTestStep(it.getRestMethodByName("POST"), "RSP120 POST"), false)
//attempt no.4
//restStep.buildTestStep(newTestCase, restStep.createNewTestStep(it.getRestMethodAt(0), "RSP120 POST"), false)
//attempt no.5
//restStep.buildTestStep(newTestCase, restStep.createNewTestStep(it.addNewMethod("POST"), "RSP120 POST"), false)
}
}
}
I'm not sure what I'm doing wrong, all 5 attempts should be working correctly.
Thanks for answer
Regards,
Marek
Related Content
- 12 years ago
- 2 years ago
Recent Discussions
- 6 days ago
- 10 days ago