Forum Discussion

ab2017's avatar
ab2017
New Contributor
7 years ago

Copy assertion

Dear community members,

 

I would like to know how can I copy assertions from 1 test case to another, such that the referred expected values are also updated accordingly. Here is my scenario:

 

Test Case 1: contains DataSet1, RestRequest1, Assertion1

Test Case 2: contains DataSet2, RestRequest2

.... and so on... upto

Test Case 60: contains DataSet60, RestRequest60

 

The Assertion1 (of test case 1) is a Message content assertion and its expected value is referred as ${DataSet1#out_value}. My intention is to copy assertion1 to the other 59 test cases. But when I copy assertion 1 to TestCase n, the copied assertion is still referring to ${DataSet1#out_value}. And then I have to manually modify each copied assertion to DataSet n.

 

Is there a mechanism where when I copy assertion to testCase n, it automatically refers to ${DataSet n#out_value}.

 

Thanks in advance.

  • nmrao's avatar
    nmrao
    Champion Level 3
    Isn't it comes under Data driven test instead of copying the same steps again and again for n times?
    • ab2017's avatar
      ab2017
      New Contributor

      nmrao wrote:
      Isn't it comes under Data driven test instead of copying the same steps again and again for n times?

      Thanks for reply.

      If I understand your point correctly, if the same data set with same values are used for all tests, then it is a Data Driven test.

      But in my case, the data for every test is different and specific for that test only, and thats the reason why I need n number of Data Sets, one for each test. 

  • depstein's avatar
    depstein
    New Contributor

    I don't know how to do what you want in SoapUI, but if all else fails, directly editing the project XML file could be an easier option than correcting assertions in the UI.