Forum Discussion

selvynz's avatar
selvynz
New Contributor
8 years ago
Solved

Is it possible to use a different value/data for every trigger of API in alertsite?

Hi,

 

We are creating a monitor for one of our projects and the requirement is to loop through a given set of ID's and use them for every trigger. We want to do this because we have restrictions on server and cannot use the same ID after a certain number of calls. We have 20 ID's and we need to use one ID for every trigger of the API. We are planning to have them triggered from alertsite every 5 minutes.

 

Can you please let us know how we can go ahead with this?

 

Thanks,

Selvyn

  • Selvyn,

     

    You could create a groovy script to randomly select one of the 20 credentials for each test run.  If you need assistance we would be willing to help you write the groovy script.  Please email me directly and we can set up a time to discuss further.

     

    John Lucania

    John.Lucania@smartbear.com

    Pre-Sales Technical Engineer

2 Replies

  • Selvyn,

     

    You could create a groovy script to randomly select one of the 20 credentials for each test run.  If you need assistance we would be willing to help you write the groovy script.  Please email me directly and we can set up a time to discuss further.

     

    John Lucania

    John.Lucania@smartbear.com

    Pre-Sales Technical Engineer

    • selvynz's avatar
      selvynz
      New Contributor

      Hi John,

       

      thanks for looking into it. I used created a groovy script to randomly select one AppID out of 20 App ID's for every execution. 

      def random = new Random();
       
      
          def i = random.nextInt(list.size())
          log.info "list[${i}] == ${list[i]}"
          testRunner.testCase.testSuite.project.setPropertyValue("AppID","${list[i]}")
          testRunner.testCase.testSuite.project.setPropertyValue("element","$i")
       

      However, I am not sure of this approach as our Server does not accept more than a specific number of calls for each AppID. We do not want Alertsite triggers failing because we used the AppID more than expected number of times.

       

      I have written a script to select the AppID's sequentially and it works like charm in SoapUI. However, when I upload it to alertsite it is always picking the AppID that was set or saved in the SoapUI project properties during the last execution on my machine. 

       

      Is there a way where Alertsite can remember and use the property that was saved during the latest trigger of the SoapUI device/API?

       

      Thanks,

      Selvyn