Forum Discussion

aaronpliu's avatar
aaronpliu
Frequent Contributor
3 years ago

Best way to load test suite as per test requirement

Hi Community,

As the number of test suites increasing, too many test suites created in project. ReadyAPI becomes very slow to load all of test suites every time. In order to separate test suite and easily manage test cases, we just want to load required test suites against test requirements. For instance, there are 50 test suites, and just would like to load 20 out of 50 in test cycle 1, and run the rest of test cases in other test cycle.

one solution is to create a command to make hard link for test suite, then command will automatically load chosen test suites (prerequisite: move all test suites out of project and save in other folder, and check out project.content / order file every time)

For different OS, it needs to create at least 2 script (cmd / shell) to run.  Is there any practice to load test suites with ReadAPI's function?

 

Thanks,

/Aaron

5 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    aaronpliu 

    Here is the tiny script which does what I posted earlier.

    NOTE: tested on os version and project is single xml file (not composite)

     

     

    /**
    This groovy script take soapui project as Input
    And removes all the suites except the given list in "suites" variable
    And writes the sub set of the project (as all the suites are removed) into given path.
    Context: If the project size is very big, it takes time to load the project into the tool.
    This script will help just to only create small project out of the big one, so that load the project with given suite in quick time.
    Ref: https://community.smartbear.com/t5/API-Functional-Security-Testing/Best-way-to-load-test-suite-as-per-test-requirement/m-p/220444#M49415
    How to execute this script?
    You may create an empty project and create an arbitary test case and add groovy script test step and paste the below script in there
    and modify values for below
    -- templateProjectPath (absolute path  of the original soapui project)
    -- subProjectPath (provide the absolute path where sub set of the project needs to be written
    -- suties (provide the suite names which needs to be copied into sub project)
    **/
    
    // Modify values for below
    def templateProjectPath = '/home/apps/projects/testProject-soapui-project.xml'
    def subProjectPath = '/tmp/test-soapui-project.xml'
    def suites = ['mySuite', 'contextTestSuite']
    
    // No modification require beyond this
    
    def templateProject = new com.eviware.soapui.impl.wsdl.WsdlProject(templateProjectPath)
    templateProject.testSuiteList?.findAll { !(it.name in suites) }.each {templateProject.removeTestSuite(it) } 	
    templateProject.saveAs(subProjectPath)

     

    • nmrao's avatar
      nmrao
      Champion Level 3
      Similarly we can write back the suite from sub project in case if any updates to the original project in the same fashion.
      • aaronpliu's avatar
        aaronpliu
        Frequent Contributor

        Thanks nmrao , actually I would like to work on composite project since many team members cooperate and just one script library to share.

        Each test suite save as a directory which including element.order and .xml, and each test suite belongs to an owner. When owner update test suites and the change take place in current test suite only, do not impact any other test suite and will not change order / element under project root (git checkout and ignore specified folder in project)

         

         

        Thanks,

        /Aaron

  • nmrao's avatar
    nmrao
    Champion Level 3
    May be write a utility or script that can create (a project which is a subset ) what is needed out of actual project. This can be done for single file project. Not sure about composite project structure.