Forum Discussion

battagliajj's avatar
battagliajj
New Contributor
5 years ago
Solved

Run TestCase test step

The test Case “PUT /api/v1/cases/case” has a test step “Run Delete CaseFile” and it passes in a value for caseFileId.

The target test Case “Delete CaseFile” has a custom property called “caseFileId” and the test step “CaseFile_DeleteCase-Request 1”  and accepts  ${#TestCase#caseFileId} from the calling TC (in this instance it’s the PUT TC”.

 

The above process works fine.

 

So my question is can this be structured so that a value for CaseFileId can be passed in (like above) OR if no value is passed the called/target TC “Delete CaseFile” simply use a default value for that field?

We want to be able to optionally pass in a value or have the TC use a default if no value is passed.

 

if this can't be done via the Run TestCase test step is there another way in SOAPUI to accomplish this?

  • This is how it can be achieved: Have the default value set in the setup script of the template test case. For eg: ROLE is the custom property in template test case. And it is disabled as we dont want it to be executed as test case any time, just needs to invoked with different data as shown here with different values.

     

4 Replies

  • richie's avatar
    richie
    Community Hero
    Hey battagliajj

    I cant think of a way of using the native functionality to do what you need (some of the other forum members might have a spiffy idea though).
    Im not a scripter (some of the other lads in here might be able to help) but the scenario doesnt sound like it would be overly difficult to do it with an if/else bit of groovy.....something on the lines of you extract the attribute ${#RESTStepResponse#caseFileId} to ${#Properties#caseFileId}, then write ${#Properties#caseFileId} to ${#TestCase#caseFileId} if ${#Properties#caseFileId} != null, else write your default value ${#Properties#caseFileIdDefault} to ${#TestCase#caseFileId} or something like that.
    As i say, im not a scripter but it looks like what you need is a simple if/else decision so seems like it would be pretty straightforward.

    Ta

    Rich
  • nmrao's avatar
    nmrao
    Champion Level 3

    This is how it can be achieved: Have the default value set in the setup script of the template test case. For eg: ROLE is the custom property in template test case. And it is disabled as we dont want it to be executed as test case any time, just needs to invoked with different data as shown here with different values.

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you Community Heroes:smileyhappy:

       

      battagliajj , please let us know if the suggestions worked for you. Thanks.

  • nmrao's avatar
    nmrao
    Champion Level 3
    Which type of test steps are accessing the custom property ?