TestAssure Knowledge Base
< All Topics
Print

Anchoring Tests

Overview
Anchoring tests means to fix the test to run on a particular date or period. Take the following test for
example, which puts schedules and punches on a Sunday and Monday in the current week:

Assuming the week is from Sunday to Saturday, if the test is run on November 15th (a Tuesday), then Sunday and Monday will represent November 13th and November 14th, respectively. If the test is run on December 8th (a Thursday), then Sunday and Monday will represent December 4th and December 5th, respectively. Hence, the dates represented by the test change over time. This is all well and good until we get to a holiday week, such as Christmas Day, which falls on a Sunday in 2022. Most customers pay Holiday Worked for hours worked on a holiday, and the above test will likely fail when Sunday represents December 25th. To avoid this issue, anchor the test to prevent it from representing different dates over time. This can be done by using the action: Today is day number in the month of .

Now, whenever this test is run, it will set Today to November 13th and use Sunday and Monday that fall in the week of November 13th. Hence, the test will always represent the dates of November 13th and November 14th.

TIP!

When deciding which anchor date to use, consider your THEN section. Tests should validate the same date or period on every run, which will guide you in determining the anchor date.

The following actions can be used to anchor a test i.e., they resolve to a specific day in the year:
– Today is day number in the month of
– Today is holiday – Today is the first day in the current year
– Today is the last day in the current year
– Today is the last day in the month of

Note: You cannot use multiple “Today” actions in the GIVEN. If you do, TestAssure will use the last “Today” action for the test.

Anchoring Timekeeping Tests

There are two types of timekeeping tests: holiday test and non-holiday tests. Holiday tests are anchored using the action, Today is holiday. This action anchors the test to a specific holiday; on each run, the test executes on the holiday specified. TIP! If holiday starts and ends before midnight, or spans multiple days, it may be easier to anchor using the action, Today is day number in the month of . Most non-holiday tests can be anchored using the action, Today is day number in the month of . Anchoring Accrual Tests Accrual tests may fail because the date range used to calculate balances changes over time. For example, consider the following test that is not anchored:

The test validates PTO after the 1-year anniversary. Assume that PTO is granted at the end of every pay
period and is reset on January 1st. Thus, the 35 hours of PTO represent the grants between Jan 1st and
“Today”.
Let’s say “Today” is August 15th. Then the period for calculating PTO can be depicted as the yellowhighlighted part below:

Note: Accrual tests that validate earned grants may not need to be anchored, since those tests validate grants based on hours worked, not time elapsed. It is important to understand how grants are given for each policy in a profile to determine if tests should be anchored. Most accrual tests can be anchored using the action, Today is day number in the month of . Anchoring Schedule or Minor Rule Tests Schedule Rule Tests do not need to be anchored since we updated the THEN action to use My schedule contains the following rule violations with severity for . This action only returns the Rule Description and Severity, not the Violation Text. (The Violation Text column used to return dynamic data such as employee id or dates which caused the test to fail on subsequent runs.) If a different THEN action is used for Schedule Rule tests, then the tests may need to be anchored. Minor Rule sets should always be anchored because they are based on a school calendar. The school calendar may be different throughout the year, so it is best to pick a week to have consistent test runs.

Considerations
Anchor dates may need to be updated in the new year because the day may fall into a different pay
period. If that’s the case, use the Find and Replace option to quickly update the anchor dates to a new
value that gives the same results.

Scroll to Top