Forum Discussion

rmoser's avatar
rmoser
New Contributor
3 years ago

Random Inclusion of Test Steps?

Hi All,

 

I'm using SoapUI to emulate a process that moves an event through a series of states: AK->ER->AR->AV.  So I have a set of test steps that put it in each of those states, with delays between each.  But now I'd like to add a test case that emulates it being interrupted in the middle of that process - essentially, I'd like to progress through between 1-4 of those states, stop, and do something else.  I could clone 4 different test cases and just disable steps, but I wondered if there was some less messy way to do it.  Like conditionally running test steps based on the value of a variable or something?

 

Alternately, since I've tested the progression elsewhere, and what I'm interested in testing here is interruption from a specific state, I could just set the state once, to a random value from the list (AK, ER, AR, AV), and then do the interruption.  But I don't know how to set a variable to a random value from a list either...

  • stoltenberg's avatar
    stoltenberg
    Occasional Visitor

    using loadUI to test the load of a web application. Following a load test, LoadUI delivers a report that aids in determining whether apps can withstand high loads. basketbros

     

    • rmoser's avatar
      rmoser
      New Contributor

      That doesn't really solve my problem.  What I want is for the test to behave slightly differently - including or excluding different steps each run - so that a load test will eventually cover all the possibilities.  I've worked something out using groovy scripts, but its a bit crude and clumsy, because I don't appear to be able to set custom variables at the test step level?

       

      What I tried to make:

      A generic REST test step, disabled, that sets a user on an event to a state. all of which are specified in custom test _case_ variables.  This step is disabled.

      Individual test steps with identical groovy scripts, that randomly set the test _case_ variable for state, copy variables for the user and event from the _step_ to the _case_, and then runs the REST step above.  These test steps would have identical scripts, to make maintenance easy, but different test step variables to specify which user and event I wanted to modify.

       

      What I apparently had to make do with, because I couldn't find any way to set custom variables at the test step level:

      As above, but each groovy script is hard-coded with the user and event name.  Seems like there should have been a better way to parameterize this into a function, but I couldn't figure it out.