QA Fundamentals · Senior · Question 26 of 76

How do you test a feature that depends on the current date and time?

Show the answer

Correct answer: Control time through an injectable clock or test hooks

Explanation

Testing expiry, schedules and time zones requires controlling 'now'. A fake clock makes the tests fast and deterministic, including edge cases like DST changes.

Further reading

Problem with a question

QA Fundamentals · Senior · question 26

Test yourself

Take the QA Fundamentals · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz