Axe Test Automation PlatformGeneral discussion relating to the Axe Test Automation Platform from Odin Technology |
||
Posts by Odin employees marked:
|
Axe v3.2, Selenium (Java)
Hi I have a sub-test which verifies that a certain field in the application will contain the current date in the format dd-mm-yyyy. I have attempted to use the Excel formula =TODAY() in the sub-test file with the cell formated as custom type 'dd-mm-yyyy', however this gets compiled into java files which substitute dd-mm-yyyy with "2011-09-13T00:00:00.000" - is there a way around this that you know of without creating a custom function? Many thanks Mark
Hi Mark,
You need to make sure all your dates are formated as text. e.g. in Excel you could achieve this by =TEXT(TODAY(), "dd-mmm-yy") However, I would advise against doing it this way, since the date will only be calculated when the spreadsheet is saved. So best-practice in these cases is to use s custom 'load' action to generate the date dynamically at run time. Sam
Hi Mark,
Yes. In its simplest form: action: load.date command: date = new SimpleDateFormat("dd/MM/yyyy hh:mm a").format(Calendar.getInstance().getTime()) Obviously you could make this more advanced by passing the formating as a parameter to the action etc. The key thing here is to make it a load action. That way all ensuing 'set' and 'val' actions will automatically use the value, just as if the data had been loaded from a file. Sam
Hi Mark,
Sorry, there are a few mistakes in the above. If you are using the Jacob COM bridge, then the full command is: Dispatch.put(axe, "Data", new SimpleDateFormat("dd/MM/yyyy hh:mm a").format(Calendar.getInstance().getTime())) Sam
For completeness, the additional imports required are:
import java.text.SimpleDateFormat; import java.util.Calendar;
Hi Sam
I was looking for a quick bit of advice. This application deals a fair amount with date manipulation (ie some tests will need to add values to the current date. I had created a new function called load.today(field,amount) with the command Dispatch.put(axe, "Data", new SimpleDateFormat("dd-MM-yyyy").format(Calendar.getInstance().add(%PARAM1%, %PARAM2%))) and used this within a test as load.today(DAY_OF_MONTH,1);set however, on build, axe reports java233: cannot find symbol symbol: variable DAY_OF_MONTH Any ideas what's gone wrong here? Many thanks Mark
Assuming this question is now covered in http://fogbugz.odin.co.uk/default.asp?axe.1.56671.0
|