CallTestCase vs SendaRequest

Hi,

I have a request called “GetUserInfo”. I have a test case called “GetUserInfo” which calls this request “GetUserInfo”. (Everything works)
Now I have another testcase called “TestTest”, in this test case I want to call the test case “GetUserInfo”.

Question 1 - what’s the difference between the following two methods, what’s the best approach?

  1. From the “TestTest” calling a test case using callTestCase method which calls the testcase “GetUserInfo”, which in turn sends the request using sendRequestAndVerify?
  2. From the “TestTest” calling the request directly by sending the sendRequestAndVerify.

WS.callTestCase(findTestCase(“GetUseInfo”), [“UserId”: data.get(‘UserId’), “Name”:data.get(“Name”)], FailureHandling.OPTIONAL)
WS.sendRequestAndVerify(findTestObject(‘SoapBinding/GetUserInfo’, [(‘UserId’) : data.get(‘UserId’), (‘Name’) : data.get(‘Name’)]))

Question 2:
Can we call a testcase using WS.callTestCase without sending the parameters, why doesn’t this call use the parameters that are
defined in the testcaseID?

Thanks in advance

Answer 1: If your test case “getUserInfo” has no other processing, then of course use sendRequestAndVerify directly.

If you want to use it for other processing, use callTestCase, for example

SendRequest returns a JSON format, and if you want to change it to a Map, but you don’t want to convert it every time, you can change it to a Map in your TestCase and Return it, so you don’t have to do this every time you call TestCase

Answer 2: yes, of course, if you have an argument and you define a default value, not passing the argument means using the default value

1 Like

Thank you for your response. So you are right I was able to run callTestCase without the parameters. I have few more questions.

  1. Is it true, that the sendRequestAndVerify will return a response back but the callTestCase will not return the response back? If yes, is there a way we can have callTestCase return the response?

  2. Can we call for a testcase with all the default values except maybe one new value? Is that allowed? For example in default value UserId = 120 and now I want to run the test with same data except UserId=122.

WS.callTestCase(findTestCase(“GetUseInfo”), [“UserId”: “122”], FailureHandling.OPTIONAL)

Thanks

Answer,

  1. If you Return anything you need in the TestCase, you can get it when you callTestCase

  2. Yes, you can. TestCase has default values when setting Variables