Test AutomationGeneral discussion about automated software testing tools and techniques |
||
Posts by Odin employees marked:
|
I am automating a date check for an application using Axe with TestPartner, the problem is first I get a date from the screen and this is stored in variable value, then I execute a TestPartner function that return todays date formatted in value2, I then need to compare value and value2.
I cannot specify this in my sub test sheet without value 2 being seen as a string in speech marks e.g. rc = AxeMainAPI.StepValidateEqual("value2", value) Regards, MArlon Griffith Microsoft
Hi Marlon,
There are many ways to skin this particular cat, using a custom GET or a custom VAL (both have some examples documented) or without using any date transformations at all in TP code but relying on Excel to do the hard work. I suggest you send an email to support@odin.co.uk with a copy of your TP function and the entry in the action map that you have created. Many Thanks, Duncan
As suggested by support:
Before we look into the Custom function route, one thing to consider might be using a formula in Excel to do the same thing, then you won't need a custom validation or an entry in an action map. If you use the following: =TEXT(NOW(),"mmmm yyyy") in your Cell with a standard VAL it will use the date as the expected value. NB - The only drawback to this is that you will need to open the Workbook in Excel and re-save it to enable Excel to re-calculate dates. As for custom functions: Perhaps a custom validation would be appropriate here, ( an example of which is in pg.19-20 of the Axe Integration Guide for TestPartner). In this case, we can use your utility funtion in combination with the custom val: Function MyValidateToday(ByVal actual As String) As Integer Dim res As Integer Dim TodaysDate As String TodaysDate = Utilities_DateTime_DateCheck() If TodaysDate = actual Then res = 0 Else res = 1 End If MyValidateToday = AxeMainAPI.StepValidate(expected, actual_length, res) End Function An entry in the action map could then be as follows: val.Today MyValidateToday (value) Hope all this helps! |