Forum Discussion

aaronpliu's avatar
aaronpliu
Frequent Contributor
7 years ago

is there a better way to count number of referenced endpoints

Hi,

Any ideas to count number of endpoints in test suite / test case?  Maybe use the same endpoints in different test cases.

I'd like to know how many outstanding endpoints left.

 

Thanks in advance

 

 

/Aaron

  • Lucian's avatar
    Lucian
    Community Hero

    Hey,

     

    Do you want count the number of REST endpoints? Do I understand this right?

    • aaronpliu's avatar
      aaronpliu
      Frequent Contributor

      yes. For Rest endpoints only. including the same URL alongwith different method (ie. GET, POST, PUT)

      (Example)

      GET /a/b/c/123

      POST /a/b/c/123

      There should be calculated as 2 endpoints.

       

      Case 1

          ---- GET

          ---- POST

      Case 2

          ----- GET

      Should have 2 endpoints covered in case 1 and case 2.

       

       

      • Lucian's avatar
        Lucian
        Community Hero

        Oh, you can count them like this:

         

        // Get all interfaces in the project
        def interfaces = testRunner.getTestCase().getTestSuite().getProject().getInterfaceList()
        def restInterfacesCount = 0

        interfaces.each {
        if (it instanceof com.eviware.soapui.impl.rest.RestService) {
        restInterfacesCount++
        }
        }