Scenarios
Ready-made dates to test with: the last day of a month, the leap day, the last second of a
trial. The window calls them scenarios and the command line calls them presets.
Using a scenario
A scenario is a date and time worked out for you, with one line on what it tests. Picking one
fills in the date and nothing more: it never starts a session on its own.
- Run an app lists, under Scenarios, the ones that need no
value from you. Picking one fills in Starts at.
- Calculator lists, under Scenarios, the ones it can work
out, with a field for each value a scenario asks for. Use this date takes the
result over to Run an app.
- On the command line,
--preset takes the name to type, and each value is one
--param.
chrono run "C:\apps\test.exe" --preset month-end
chrono calc --preset trial-last-day --param start_date=2027-01-01 --param trial_length=45d
Some scenarios only make sense for an application that is running: a clock 90 seconds ahead
means something to an application, not to a calculator. Others only make sense in the
calculator, such as the day someone turns 18. Each one below says where it works.
Giving a value
A scenario that counts from a date only you know asks for it: a date of birth, the day a trial
started. In the Calculator each value has its own field. On the command line it is
--param, the value's name, an equals sign and the value.
- A date is written year first:
2027-01-01.
- A length is a number and a unit with no space between them:
45d. The units are those of --shift,
and bd counts business days. A number on its own is refused, because it does
not say what it counts.
- A choice is one of the words the scenario lists, such as
on_day.
A value the scenario has a default for, such as a trial of 30 days, can be left out. A value
with nothing to fall back on stops the command with a message that names it. Business days are
counted in a holiday calendar: a scenario made for one
market counts in that market's calendar, and chrono calc --calendar picks another.
The scenarios
14 scenarios come with the program, and chrono presets lists the same
ones, with any you add. Worked out as shows the date the way the options of
chrono calc would write it, with a value you give in angle brackets.
Age-of-majority boundary#
Does the app apply the age-of-majority boundary correctly - admitting someone exactly on their 18th birthday, and refusing them the day before?
- Name to type
age-of-majority
- In the window
- In the Scenarios list of the Calculator.
- On the command line
chrono calc --preset age-of-majority
- Asks for
- Date of birth
birth_date: a date, written YYYY-MM-DD. - Day to test
boundary: one of day_before, on_day, day_after. Left out, it is day_before.
- Worked out as
--base <birth_date> --shift +18y --shift <boundary>
Clock skew, +90 s#
Does the app cope when its clock runs 90 seconds ahead of real time - a 2FA/TOTP code or a signed token rejected as expired or from the future?
- Name to type
clock-skew-plus-90s
- In the window
- In the Scenarios list of Run an app.
- On the command line
chrono run --preset clock-skew-plus-90s
- Worked out as
--base now --shift +90s
Date before installation#
Does the app behave when the clock is set before its own installation date?
- Name to type
date-before-install
- In the window
- In the Scenarios list of the Calculator, with a field for each value. Run an app lists only the scenarios that need no value: work this one out in the Calculator and press Use this date.
- On the command line
chrono run --preset date-before-install
chrono calc --preset date-before-install
- Asks for
- Installation date
install_date: a date, written YYYY-MM-DD. With chrono run you can leave it out, and it is then the day the application's file was created.
- Worked out as
--base <install_date> --shift -1d
Unix epoch zero#
Does the app treat Unix epoch zero as a real date instead of an empty value?
- Name to type
epoch-zero
- In the window
- In the Scenarios list of Run an app, and in the Scenarios list of the Calculator.
- On the command line
chrono run --preset epoch-zero
chrono calc --preset epoch-zero
- Worked out as
--base-utc 1970-01-01T00:00:00
29 February#
Does the app handle 29 February - the leap day that exists only every four years, where 'one year later' has no matching date?
- Name to type
feb-29
- In the window
- In the Scenarios list of Run an app, and in the Scenarios list of the Calculator.
- On the command line
chrono run --preset feb-29
chrono calc --preset feb-29
- Worked out as
--base today --nearest next-leap-day
Last day of fiscal year#
Does the app close the fiscal year on the right day - the day before the fiscal-year start you set, not calendar 31 December?
- Name to type
fiscal-year-end
- In the window
- In the Scenarios list of the Calculator.
- On the command line
chrono calc --preset fiscal-year-end
- Asks for
- Fiscal year start
fiscal_year_start: a date, written YYYY-MM-DD.
- Worked out as
--base <fiscal_year_start> --shift +1y --shift -1d
Licence expired a year ago#
Does the app handle a licence that expired long ago, not just yesterday?
- Name to type
license-expired-year-ago
- In the window
- In the Scenarios list of Run an app.
- On the command line
chrono run --preset license-expired-year-ago
- Worked out as
--base today --shift -1y
Last day of month#
Does month-end closing and period accruals behave on the last day of the month?
- Name to type
month-end
- In the window
- In the Scenarios list of Run an app, and in the Scenarios list of the Calculator.
- On the command line
chrono run --preset month-end
chrono calc --preset month-end
- Worked out as
--base today --snap eom
Payment due, +N business days#
Does a payment due N business days out land on the right day, skipping weekends and holidays?
- Name to type
payment-due-business-days
- In the window
- In the Scenarios list of the Calculator.
- On the command line
chrono calc --preset payment-due-business-days
- Asks for
- Payment term
days: a length such as 30d or 90bd. Left out, it is 90bd.
- Worked out as
--base today --shift +<days>
- Business days
- Counted in the
us-banking calendar.
Last day of quarter#
Does quarter-end closing and reporting behave on the last day of the quarter?
- Name to type
quarter-end
- In the window
- In the Scenarios list of Run an app, and in the Scenarios list of the Calculator.
- On the command line
chrono run --preset quarter-end
chrono calc --preset quarter-end
- Worked out as
--base today --snap eoq
First day after trial expiry#
Does the app refuse access the moment the trial ends, and how - a sensible message or a blank window? Counts the install day as day 1, so a 30-day trial started on 1 January is over on 31 January.
- Name to type
trial-first-day-after
- In the window
- In the Scenarios list of the Calculator, with a field for each value. Run an app lists only the scenarios that need no value: work this one out in the Calculator and press Use this date.
- On the command line
chrono run --preset trial-first-day-after
chrono calc --preset trial-first-day-after
- Asks for
- Trial length
trial_length: a length such as 30d or 90bd. Left out, it is 30d. - Trial start
start_date: a date, written YYYY-MM-DD. With chrono run you can leave it out, and it is then the day the application's file was created.
- Worked out as
--base <start_date> --shift +<trial_length> --set-time 00:00:01
Last day of trial#
Does the app still work in the very last moment of the trial - the boundary from the 'should still work' side? Counts the install day as day 1, so a 30-day trial started on 1 January ends on 30 January at 23:59:59.
- Name to type
trial-last-day
- In the window
- In the Scenarios list of the Calculator, with a field for each value. Run an app lists only the scenarios that need no value: work this one out in the Calculator and press Use this date.
- On the command line
chrono run --preset trial-last-day
chrono calc --preset trial-last-day
- Asks for
- Trial length
trial_length: a length such as 30d or 90bd. Left out, it is 30d. - Trial start
start_date: a date, written YYYY-MM-DD. With chrono run you can leave it out, and it is then the day the application's file was created.
- Worked out as
--base <start_date> --shift +<trial_length> --shift -1d --set-time 23:59:59
2038 boundary#
Does the app survive the 32-bit Unix time boundary (2038-01-19T03:14:07Z)?
- Name to type
year-2038
- In the window
- In the Scenarios list of Run an app, and in the Scenarios list of the Calculator.
- On the command line
chrono run --preset year-2038
chrono calc --preset year-2038
- Worked out as
--base-utc 2038-01-19T03:14:07
Year rollover, live#
Do document numbering, year-in-name, and annual reports handle the rollover live, as the clock crosses midnight?
- Name to type
year-rollover
- In the window
- In the Scenarios list of Run an app.
- On the command line
chrono run --preset year-rollover
- Worked out as
--base today --snap eoy --shift -9s
Writing your own
A scenario is a small text file in JSON. This one checks the first day an invoice is overdue:
{
"schema": "chronomock.preset/1",
"stability": "unstable",
"id": "invoice-overdue",
"name": { "en": "First day an invoice is overdue", "pl": "Pierwszy dzień po terminie faktury" },
"explains": {
"en": "Does the app mark an invoice overdue on the day after its due date, and not on the due date itself?",
"pl": "Czy aplikacja oznacza fakturę jako zaległą dzień po terminie płatności, a nie w sam dzień terminu?"
},
"applies_to": "both",
"market": null,
"parameters": [
{ "id": "issued", "type": "date", "label": { "en": "Invoice date", "pl": "Data wystawienia" } },
{ "id": "term", "type": "duration", "label": { "en": "Payment term", "pl": "Termin płatności" }, "default": { "amount": 14, "unit": "days" } }
],
"moment": {
"base": { "parameter": "issued" },
"steps": [
{ "shift": { "sign": "+", "parameter": "term" } },
{ "shift": { "sign": "+", "amount": 1, "unit": "days" } },
{ "set_time": "08:00:00" }
]
},
"time_mode": { "multiplier": 1, "scale_duration_clock": false }
}
- Save it as
invoice-overdue.json. The file name without .json
must be the same as id.
- Put it in the folder the program reads.
chrono presets names that folder on
its second line. In the window's zip package it is the presets folder beside
ChronoMock.exe. A folder under Program Files takes administrator rights to
change.
- Run
chrono presets again. Your scenario is in the list, or among the files
left out, with the reason.
chrono calc --preset invoice-overdue --param issued=2027-03-01
Chrono Mock - date calculator
preset: invoice-overdue - First day an invoice is overdue
explains: Does the app mark an invoice overdue on the day after its due date, and not on the due date itself?
base: 2027-03-01T00:00:00
step 1: shift +14 days -> 2027-03-15T00:00:00
step 2: shift +1 days -> 2027-03-16T00:00:00
step 3: set time 08:00:00 -> 2027-03-16T08:00:00
result: 2027-03-16T08:00:00
...
What the file holds
| Key | What it is |
schema | Always chronomock.preset/1. |
id | The name to type, the same as the file name: letters, digits,
- and _. |
name, explains | The name and the one line on what it
tests, for each language. en is required, and it is the one the window and the
command line show. |
applies_to | substitution for an application that runs,
calculator for the Calculator, both for both. |
market | null, or us or pl to
count business days in that market's calendar. |
parameters | The values it asks for. Each has an id, a
type (date, duration for a length, or
variant for the day before, on or after: day_before,
on_day, day_after), a label for each language and, if
you want one, a default. |
moment | Where the date starts, base, and the
steps taken from there, in order. |
time_mode | The speed chrono run starts at.
multiplier 1 is real speed. |
Where the date starts
base | What it is |
"today" | Midnight today, in the session's time zone. |
"now" | This moment, to the second. |
{ "absolute": "2027-03-01T09:00:00" } | That time on the clock of the
session's time zone: 9 in the morning wherever the test runs. |
{ "absolute_utc": "2038-01-19T03:14:07Z" } | That moment in UTC, the
same instant in every zone. For dates whose point is the instant, such as the 2038
limit. |
{ "parameter": "issued" } | A date the person using it gives. |
Steps
Each step is the same as an option of chrono calc and takes the same values, so the
calc options say what each one does.
| Step | Same as |
{ "shift": { "sign": "+", "amount": 1, "unit": "days" } } | --shift +1d.
The unit is a code or its full name. |
{ "shift": { "sign": "+", "parameter": "term" } } | --shift
by a length the person gives. |
{ "shift": { "parameter": "boundary" } } | A day back, none or a day
forward, by the choice the person makes. No sign: the choice has one. |
{ "set_time": "08:00:00" } | --set-time |
{ "snap": "eom" } | --snap |
{ "nearest": "nbd" } | --nearest |
{ "zone": "+05:45" } | --to-zone: the steps after it count
in that zone. |
A scenario says when a date is, never which program to run, so there is no place in the file
for a path. A file from someone else can set the date and the speed your test starts with, and it cannot
start a program.