Report generated 11-04-2023 10:42

Feature: DATEDIF Function

Calculates the number of years, months, days, hours, minutes, seconds or microseconds between two date(time)s.

Notice:

This function never cross the month boundary when it handles months delta with different numbers of days.

Examples:

1. (2021-08-31 - 2021-09-30) and (2021-08-30 - 2021-09-30) will give the same result, months=+1;  
2. (2021-01-28 - 2021-02-28), (2021-01-29 - 2021-02-28), (2021-01-30 - 2021-02-28) and (2021-01-31 - 2021-02-28) will give the same result, months=+1

Scenarios

Given the first date {start date} and the second date {end date}

When the datedif function is used to compute the difference between them

Then the returned relative delta should be {relative delta}

Examples:

start dateend daterelative delta
2021-09-202021-10-20months=1
2021-09-202021-10-21months=1, days=1
2021-09-202021-08-20months=-1
2021-09-202021-11-20months=2
2021-09-202021-10-27months=1, days=7
2021-09-202022-08-20months=11
2021-09-202022-10-20years=1, months=1
2021-09-202021-09-30days=10
2021-09-202021-10-02days=12

That never cross the month boundary of the end date when handling months delta with different numbers of days.

Given the first date {start date} and the second date {end date}

When the datedif function is used to compute the difference between them

Then the returned relative delta should be {relative delta}

Examples:

start dateend daterelative delta
2021-01-312021-02-28months=1
2021-01-302021-02-28months=1
2021-01-292021-02-28months=1
2021-01-282021-02-28months=1
2021-01-272021-02-28months=1, days=1
2021-01-262021-02-28months=1, days=2
2021-01-312020-12-31months=-1
2021-01-312021-03-31months=2
2021-01-312021-04-30months=3
2021-01-312021-03-07months=1, days=7
2021-01-312021-12-31months=11
2021-01-312022-02-28years=1, months=1
2021-01-312024-02-29years=3, months=1
2021-01-312021-02-10days=10

Given the first date {start date} and the second date {end date}

When the datedif function is used to compute the difference between them

Then the returned relative delta should be {relative delta}

Examples:

start dateend daterelative delta
2021-02-282021-03-28months=1
2021-02-282021-03-29months=1, days=1
2021-02-282021-03-30months=1, days=2
2021-02-282021-03-31months=1, days=3
2021-02-282021-01-28months=-1
2021-02-282021-04-28months=2
2021-02-282021-05-28months=3
2021-02-282022-02-28years=1
2021-02-282024-02-28years=3

Given the first date {start date} and the second date {end date}

When the datedif function is used to compute the difference between them

Then the returned relative delta should be {relative delta}

Examples:

start dateend daterelative delta
2021-01-272021-02-27months=1
2021-01-282021-02-28months=1
2021-01-292021-02-28months=1
2021-01-302021-02-28months=1
2021-01-312021-02-28months=1
2021-01-312021-03-31months=2
2021-01-312021-04-30months=3
2021-01-302021-04-30months=3

Given the first date {start date} and the second date {end date}

When the datedif function is used to compute the difference between them

Then the returned relative delta should be {relative delta}

Examples:

start dateend daterelative delta
2021-10-20T16:10:592021-10-20T17:10:59hours=1
2021-10-20T16:10:592021-10-20T15:10:59hours=-1
2021-10-20T16:10:592021-10-21T02:10:59hours=10
2021-10-20T16:10:592021-10-21T16:10:59days=1
2021-10-20T16:10:592021-10-20T17:20:59hours=1, minutes=10
2021-10-20T16:10:592021-10-20T17:10:59hours=1
2021-10-20T16:10:592021-10-20T16:11:00seconds=1
2021-10-20T16:10:592021-10-21T17:10:59days=1, hours=1
2021-10-20T16:10:592021-11-21T17:10:59months=1, days=1, hours=1
2021-01-31T16:10:592021-03-01T17:10:59months=1, days=1, hours=1

Feature Coverage By Scenario

Test Outcomes

Test Performance

Key Statistics

Number of Scenarios 5 Total Duration 1s
Total Number of Test Cases 50 Fastest Test 15ms
Number of Manual Test Cases 0 Slowest Test 55ms
Tests Started Apr 11, 2023 10:42:05 Average Execution Time 26ms
Tests Finished Apr 11, 2023 10:42:07 Total Execution Time 1s

Automated Tests

feature Scenario Context Steps Started Total Duration Result
DATEDIF Function 1: The start date do not involve last day of month
start date=2021-09-20, end date=2021-10-20, relative delta=months=1
windows 3 10:42:05 049ms SUCCESS
DATEDIF Function 2: The start date do not involve last day of month
start date=2021-09-20, end date=2021-10-21, relative delta=months=1, days=1
windows 3 10:42:06 023ms SUCCESS
DATEDIF Function 3: The start date do not involve last day of month
start date=2021-09-20, end date=2021-08-20, relative delta=months=-1
windows 3 10:42:06 020ms SUCCESS
DATEDIF Function 4: The start date do not involve last day of month
start date=2021-09-20, end date=2021-11-20, relative delta=months=2
windows 3 10:42:06 032ms SUCCESS
DATEDIF Function 5: The start date do not involve last day of month
start date=2021-09-20, end date=2021-10-27, relative delta=months=1, days=7
windows 3 10:42:06 024ms SUCCESS
DATEDIF Function 6: The start date do not involve last day of month
start date=2021-09-20, end date=2022-08-20, relative delta=months=11
windows 3 10:42:06 023ms SUCCESS
DATEDIF Function 7: The start date do not involve last day of month
start date=2021-09-20, end date=2022-10-20, relative delta=years=1, months=1
windows 3 10:42:06 020ms SUCCESS
DATEDIF Function 8: The start date do not involve last day of month
start date=2021-09-20, end date=2021-09-30, relative delta=days=10
windows 3 10:42:06 023ms SUCCESS
DATEDIF Function 9: The start date do not involve last day of month
start date=2021-09-20, end date=2021-10-02, relative delta=days=12
windows 3 10:42:06 023ms SUCCESS
DATEDIF Function 1: The start date with 31 as last day
start date=2021-01-31, end date=2021-02-28, relative delta=months=1
windows 3 10:42:06 022ms SUCCESS
DATEDIF Function 2: The start date with 31 as last day
start date=2021-01-30, end date=2021-02-28, relative delta=months=1
windows 3 10:42:06 026ms SUCCESS
DATEDIF Function 3: The start date with 31 as last day
start date=2021-01-29, end date=2021-02-28, relative delta=months=1
windows 3 10:42:06 029ms SUCCESS
DATEDIF Function 4: The start date with 31 as last day
start date=2021-01-28, end date=2021-02-28, relative delta=months=1
windows 3 10:42:06 023ms SUCCESS
DATEDIF Function 5: The start date with 31 as last day
start date=2021-01-27, end date=2021-02-28, relative delta=months=1, days=1
windows 3 10:42:06 027ms SUCCESS
DATEDIF Function 6: The start date with 31 as last day
start date=2021-01-26, end date=2021-02-28, relative delta=months=1, days=2
windows 3 10:42:06 031ms SUCCESS
DATEDIF Function 7: The start date with 31 as last day
start date=2021-01-31, end date=2020-12-31, relative delta=months=-1
windows 3 10:42:06 036ms SUCCESS
DATEDIF Function 8: The start date with 31 as last day
start date=2021-01-31, end date=2021-03-31, relative delta=months=2
windows 3 10:42:06 023ms SUCCESS
DATEDIF Function 9: The start date with 31 as last day
start date=2021-01-31, end date=2021-04-30, relative delta=months=3
windows 3 10:42:06 031ms SUCCESS
DATEDIF Function 10: The start date with 31 as last day
start date=2021-01-31, end date=2021-03-07, relative delta=months=1, days=7
windows 3 10:42:06 028ms SUCCESS
DATEDIF Function 11: The start date with 31 as last day
start date=2021-01-31, end date=2021-12-31, relative delta=months=11
windows 3 10:42:06 027ms SUCCESS
DATEDIF Function 12: The start date with 31 as last day
start date=2021-01-31, end date=2022-02-28, relative delta=years=1, months=1
windows 3 10:42:06 024ms SUCCESS
DATEDIF Function 13: The start date with 31 as last day
start date=2021-01-31, end date=2024-02-29, relative delta=years=3, months=1
windows 3 10:42:06 029ms SUCCESS
DATEDIF Function 14: The start date with 31 as last day
start date=2021-01-31, end date=2021-02-10, relative delta=days=10
windows 3 10:42:06 030ms SUCCESS
DATEDIF Function 1: The start date involve last day of february
start date=2021-02-28, end date=2021-03-28, relative delta=months=1
windows 3 10:42:06 023ms SUCCESS
DATEDIF Function 2: The start date involve last day of february
start date=2021-02-28, end date=2021-03-29, relative delta=months=1, days=1
windows 3 10:42:06 025ms SUCCESS
DATEDIF Function 3: The start date involve last day of february
start date=2021-02-28, end date=2021-03-30, relative delta=months=1, days=2
windows 3 10:42:06 024ms SUCCESS
DATEDIF Function 4: The start date involve last day of february
start date=2021-02-28, end date=2021-03-31, relative delta=months=1, days=3
windows 3 10:42:06 030ms SUCCESS
DATEDIF Function 5: The start date involve last day of february
start date=2021-02-28, end date=2021-01-28, relative delta=months=-1
windows 3 10:42:06 034ms SUCCESS
DATEDIF Function 6: The start date involve last day of february
start date=2021-02-28, end date=2021-04-28, relative delta=months=2
windows 3 10:42:06 035ms SUCCESS
DATEDIF Function 7: The start date involve last day of february
start date=2021-02-28, end date=2021-05-28, relative delta=months=3
windows 3 10:42:06 039ms SUCCESS
DATEDIF Function 8: The start date involve last day of february
start date=2021-02-28, end date=2022-02-28, relative delta=years=1
windows 3 10:42:07 031ms SUCCESS
DATEDIF Function 9: The start date involve last day of february
start date=2021-02-28, end date=2024-02-28, relative delta=years=3
windows 3 10:42:07 029ms SUCCESS
DATEDIF Function 1: The months with different numbers of days
start date=2021-01-27, end date=2021-02-27, relative delta=months=1
windows 3 10:42:07 030ms SUCCESS
DATEDIF Function 2: The months with different numbers of days
start date=2021-01-28, end date=2021-02-28, relative delta=months=1
windows 3 10:42:07 033ms SUCCESS
DATEDIF Function 3: The months with different numbers of days
start date=2021-01-29, end date=2021-02-28, relative delta=months=1
windows 3 10:42:07 035ms SUCCESS
DATEDIF Function 4: The months with different numbers of days
start date=2021-01-30, end date=2021-02-28, relative delta=months=1
windows 3 10:42:07 032ms SUCCESS
DATEDIF Function 5: The months with different numbers of days
start date=2021-01-31, end date=2021-02-28, relative delta=months=1
windows 3 10:42:07 055ms SUCCESS
DATEDIF Function 6: The months with different numbers of days
start date=2021-01-31, end date=2021-03-31, relative delta=months=2
windows 3 10:42:07 030ms SUCCESS
DATEDIF Function 7: The months with different numbers of days
start date=2021-01-31, end date=2021-04-30, relative delta=months=3
windows 3 10:42:07 021ms SUCCESS
DATEDIF Function 8: The months with different numbers of days
start date=2021-01-30, end date=2021-04-30, relative delta=months=3
windows 3 10:42:07 018ms SUCCESS
DATEDIF Function 1: The time substraction
start date=2021-10-20T16:10:59, end date=2021-10-20T17:10:59, relative delta=hours=1
windows 3 10:42:07 018ms SUCCESS
DATEDIF Function 2: The time substraction
start date=2021-10-20T16:10:59, end date=2021-10-20T15:10:59, relative delta=hours=-1
windows 3 10:42:07 018ms SUCCESS
DATEDIF Function 3: The time substraction
start date=2021-10-20T16:10:59, end date=2021-10-21T02:10:59, relative delta=hours=10
windows 3 10:42:07 017ms SUCCESS
DATEDIF Function 4: The time substraction
start date=2021-10-20T16:10:59, end date=2021-10-21T16:10:59, relative delta=days=1
windows 3 10:42:07 023ms SUCCESS
DATEDIF Function 5: The time substraction
start date=2021-10-20T16:10:59, end date=2021-10-20T17:20:59, relative delta=hours=1, minutes=10
windows 3 10:42:07 031ms SUCCESS
DATEDIF Function 6: The time substraction
start date=2021-10-20T16:10:59, end date=2021-10-20T17:10:59, relative delta=hours=1
windows 3 10:42:07 015ms SUCCESS
DATEDIF Function 7: The time substraction
start date=2021-10-20T16:10:59, end date=2021-10-20T16:11:00, relative delta=seconds=1
windows 3 10:42:07 018ms SUCCESS
DATEDIF Function 8: The time substraction
start date=2021-10-20T16:10:59, end date=2021-10-21T17:10:59, relative delta=days=1, hours=1
windows 3 10:42:07 016ms SUCCESS
DATEDIF Function 9: The time substraction
start date=2021-10-20T16:10:59, end date=2021-11-21T17:10:59, relative delta=months=1, days=1, hours=1
windows 3 10:42:07 016ms SUCCESS
DATEDIF Function 10: The time substraction
start date=2021-01-31T16:10:59, end date=2021-03-01T17:10:59, relative delta=months=1, days=1, hours=1
windows 3 10:42:07 020ms SUCCESS

Manual Tests

No manual tests were recorded
Serenity BDD version 3.6.22