Forum Discussion

alejandrovargas's avatar
alejandrovargas
Occasional Contributor
9 years ago

How to use +days option to avoid an specific day.

Hi all,

 

I have some tests that I need to execute almost everyday, tests always make a search 3 days in the future. 

 

The problem is that I always have to change the date manually to 3 days in advance, SOAPUI has the option to use +3days or something similar to avoid change the date everytime I used.

 

In Behat I could coonfigure with +3days, but not in SOUPUI.

 

Thanks for your help.

  • Hi,

     

    Thanks for your answer. Yesterday we could find the solution for my problem, I will explain because it could be useful for other people:

     

    Command: ${=import java.text.SimpleDateFormat; new SimpleDateFormat('yyyy-MM-dd').format(new Date() + 31*5 + (int)(Math.random()*10))}

    This exemple uses current day + 31*5 + random value between 0 and 9

     

    In the file attached you can see where the code were pasted. This window was opened with double-click in the project.

     

     

  • alejandrovargas's avatar
    alejandrovargas
    Occasional Contributor

    Hi,

     

    Thanks for your answer. Yesterday we could find the solution for my problem, I will explain because it could be useful for other people:

     

    Command: ${=import java.text.SimpleDateFormat; new SimpleDateFormat('yyyy-MM-dd').format(new Date() + 31*5 + (int)(Math.random()*10))}

    This exemple uses current day + 31*5 + random value between 0 and 9

     

    In the file attached you can see where the code were pasted. This window was opened with double-click in the project.

     

     

    • nmrao's avatar
      nmrao
      Champion Level 3
      Glad to know that you could proceed with your solution.
    • nmrao's avatar
      nmrao
      Champion Level 3

      It would be more helpful if you add the details like :
      Where the date is required? like soap request/groovy step or something else?
      What is date format needed.

      Just wanted to let you know that, it is very much possible in soapui, and need more details.