cancel
Showing results for 
Search instead for 
Did you mean: 

how to increment date for each test run

SOLVED
Highlighted
Super Contributor

Re: how to increment date for each test run

In that case, the code which I have shared should work fine, considering that you can control the limit of the execution.

Highlighted
Community Hero

Re: how to increment date for each test run

@Nancy2 ,

 

In your test case, place below a Groovy Script test step before the Request test step, so that it can generate the next date and also remembers the same for next time not to generate the duplicate date.

 

Selection_029.png

 

And in the request, use <element>${#TestCase#NEW_DATE}</element>

 

Here is the text of the above script

https://github.com/nmrao/soapUIGroovyScripts/blob/master/groovy/date/CreateNewDate.groovy

 

Doesn't require any additional libraries.



Regards,
Rao.

View solution in original post

Highlighted
Occasional Contributor

Re: how to increment date for each test run

Hi,

 

Sorry for the delayed response.

 

I hope this solution will work. As of now I am facing issue while implementing this. I have done below steps -

1. In the test step example "Register TestCase"

2. Click on Insert Step > Groovy script and named as "NDate"

3. Copied the script given

4. Within "Register TestCase", For Date input parameter, added - ${#Register TestCase#NDate}

5. Ran Groovy script

6. Ran Register

At this time, getting error as - "String was not recognized as a valid DateTime."

What can be the reason for above error?

 

Regards,

Preeti

 

 

Highlighted
Occasional Contributor

Re: how to increment date for each test run

Hi,

 

Sorry for the delayed response.

 

I hope this solution will work. As of now I am facing issue while implementing this. I have done below steps -

1. In the test step example "Register TestCase"

2. Click on Insert Step > Groovy script and named as "NDate"

3. Copied the script given

4. Within "Register TestCase", For Date input parameter, added - ${#Register TestCase#NDate}

5. Ran Groovy script

6. Ran Register

At this time, getting error as - "String was not recognized as a valid DateTime."

What can be the reason for above error?

 

Regards,

Preeti

 

Highlighted
Frequent Contributor

Re: how to increment date for each test run

Hi preeti, when referencing a test case property you need not to explicitly mention the testcase name if property is being called in the same testcase.

so your reference should be ${#TestCase#NDate}

 

thanks!

Highlighted
Occasional Contributor

Re: how to increment date for each test run

Can I get help on this query??

Highlighted
Community Hero

Re: how to increment date for each test run

What happened to the reply provided on "13-02-2019 06:03 AM"? Have you tried at least? What is the update?


Regards,
Rao.
Highlighted
Occasional Contributor

Re: how to increment date for each test run

I have done extactly the same steps as mentioned. But getting error - String was not recognized as a valid DateTime.

Highlighted
Community Hero

Re: how to increment date for each test run

Error log please? Screen shot of the script and test case would help.


Regards,
Rao.
Highlighted
Occasional Contributor

Re: how to increment date for each test run

 
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors