Forum Discussion

naz's avatar
naz
New Member
7 years ago

Need help to modularizing tests using soapui pro

I have couple of test follows a similar pattern as below and I am trying to modularize these tests:

  1. Send RQ to create table
  2. Get table number and pass it is JDBC Datasoure to get the data fields for that table
  3. Validation script in groovy to validate RQ/RS data with the data fields in the db tables

The way I am trying to accomplish as below

TestCase1:

  1. Send RQ to create table, capture table number and store it as custom property of the test as S_table_no
  2. Run TestCase CommunVal

CommonVal

  1. Groovy script to the get the table number from source testcase (in this example TestCase1) using below

                def tbl_no = testRunner.testCase.getPropertyValue("S_table_no")

                testRunner.testCase.SetPropertyValue("Table_No", tbl_no)

  1. DataSource step to get the for the table using tbl_no
  2. Validation script to validate source test RQ/RS and data fields for the table created in the source test case1

This is my current flow. I am not able to pass table number to the CommonVal using Run TestCase step. Appreciate any help or suggestion on this…..

  • Radford's avatar
    Radford
    Super Contributor

    I make extensive use of independent test cases and the "Run TestCase" test step to modularise tests. I'm not sure if I understand your use case exactly but I hope this helps...

     

    If I have two "sub" test cases and I want to pass a value from the first case to the second, I will create a test case level property in both the sub cases, then in the first one I will set this property, effectively making it an output property.

     

    Important, when you call test cases that returns properties you must configure this in the calling "Run TestCase" step:

     

     

     

    Remember to tick the properties that are return properties.

     

    Then I have the second test case where the test case level property is effectively an input property.

     

    In my "calling" test case, the one orchestrating the sub common test cases, I then use a Property Transfer Test Step to copy the property in question. The transfer test step will look something like:

     

     

     

    Overall the project will look something like:

     

     

    Notice how I've moved my common test cases to a separate test suite for convenience.