This is a reposting of an article Alice Newsam originally wrote on my Developing for Dynamics GP blog.
Have you ever had a piece of functionality that is date driven that you wanted to automate a test for but couldn’t figure out the best way to control the dates in the system? Then this post will be very helpful for you! A common area I receive questions on when talking with partners and customers is around automating features such as MRP which is extremely date driven. This post is going to cover settings in the Dex.ini and Keys.ini files that will help you set the system to specific dates and times.
Several settings in the Dex.ini file control the application and enable more consistency to be driven into tests. The below settings will allow you to specify whether you want to use the Control Panel settings for date, time and currency values as well as allowing you to set the preferred format.
|StdInternationalInfo||This setting allows the operating system settings for date, time, and currency formatting to be overridden.|
|TRUE||Use Dexterity standard formats for date, time, and currency values|
|FALSE||Use control panel settings for date, time, and currency values|
|StdInternationalInfoDateCentury||This setting allows control over the year portion of the date values used by StdInternationalInfo|
|TRUE||Four digits will be used for the year portion of date values|
|FALSE||Two digits will be used for the year portion of date values|
|StdInternationalInfoDateZeroPrefix||This setting allows control over the date format for SdtInternationalInfo|
|TRUE||Single-digit day and month values will be prefixed with a 0 (zero)|
|FALSE||Single-digit day and month values will not be prefixed|
The Keys.ini file contains commands that are run at startup to configure various system behaviors. The commands in the Keys.ini are run only if the file is included in the command to launch Microsoft Dynamics GP. You create this file using a text editor such as Notepad. The Keys.ini file is typically stored in the Data folder of the Microsoft Dynamics GP installation. To work properly, the Keys.ini file must also have a blank line as the last item in the file. The following commands allow the user to set a static system date and time.
|SetEbDateTo||This command specifies the system date value to use|
|‘o/s’||Use the operating system date|
|date MM/DD/YY/DOW||Use the date specified, where MM is the month, DD is the date, YY is the year, and DOW is the day of the weekExample: SetEbDateTo date 01/01/1965/3|
|SetEbTimeTo||This command specifies the system time value to use|
|‘o/s’||Use the operating system time|
|time HH:MM:SS||Use the time specified, where HH is the hour (from 0 to 23), MM is the minute, and SS is the secondExample: SetEbTimeTo time 4:15:00|
Here is an example of a Keys.ini file:
SetEbDateTo date 01/01/2001/3 SetEbTimeTo 'o/s'
Once the above settings have been specified you will then be able to setup your starting data including specific dates for orders, items, etc to create in-depth testing for date driven features.
Have a great day!
GP Test Team
This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.