Forum Discussion
djadhav
9 years agoRegular Contributor
What is the language set for your project? VBScript, JScript or other
- heidi_n9 years agoRegular Contributor
We always choose Delphi for Scripting Language because our program is written in Delphi & SQL, but I don't know how to code.
- Soren9 years agoOccasional Contributor
Hi Heidi,
I am much like you, I don't know a lot of a javascript or Delphiscript, but you can get around that. There is the is an operation in the keywordtesting thats called " Run Code Snippet". You can used that to get dates, compare them, do some calculation with dates.
We use Javascript, but as fare as I can read from this article: https://support.smartbear.com/viewarticle/68129/#Basics you can used the same methods as well.
this works for me - there might be a better way around it ;-)
- Add a "Run Code Snippet" to your test.
- click on " Select Object" and choose the aqDateTime runtime Object
- In the small dialog box add .Today() - yo will see that an helpfunction called Intellisense is trying to help you - so the dialog box ends up containing aqDateTime.Today()
- Click OK
- now add a "Set variable Value" - add a local variable to your test - leave it as a string and give it a meaningfull name
- Now to give the variable a value change the "Mode" from Constant to Last Operation Result
- Add another "Run Code Snippet" to your keywordtest and click on " Select Object" and choose the aqDateTime runtime Object
- This time type in .AddDays() - in between the brackets add the following: KeywordTests.[here-should-be-the-name-of-your-testcase].Variables.[The-name-of-your-variable] then a comma and then the number of days you want to add to the date. to give you an example of how it could look like : aqDateTime.AddDays(KeywordTests.Test1.Variables.Tdt, 2)
I hope this helps.
Kind Regards
Soren
Related Content
Recent Discussions
- 16 hours agodhundley