Forum Discussion

JennyH11's avatar
JennyH11
Frequent Contributor
6 years ago
Solved

Do I need to load the excel spreadsheet as part of the test for data validation?

Hi   Many of the legacy tests I have use an excel spreadsheet for data validation and as part of this are opening the spreadsheet required before the point where it's needed in the test. The test s...
  • tristaanogre's avatar
    tristaanogre
    6 years ago

    Today -> aqConvert.DateTimeToFormatStr(aqDateTime.Today(), '%m/%d/%y') -> '06/12/2018'

    Today + 1 -> aqConvert.DateTimetoFormatStr(aqDateTime.AddDays(aqDateTime.Today(), 1), '%m/%d%Y') -> '06/13/2018'

    Today + 2 -> aqConvert.DateTimetoFormatStr(aqDateTime.AddDays(aqDateTime.Today(), 2), '%m/%d%Y') -> '06/14/2018'

     

    Getting "next Monday" or "next April" is going to be a bit trickier... I'm sure I could work it out given the time... I'm guessing that it will take some sort of switch statement to take the current date, determine day of week, and then depending on that result do another "AddDays" to get the following Monday... same thing with Month to get the current month, calculate then how many months to add and use aqDateTime.AddMonths to get to the "next April" date.

     

    But yes... it should be possible to use aqDateTime methods (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqdatetime/methods.html) to do exactly what you want without needing the spreadsheet to do the calculations