vendredi 15 janvier 2016

How to structure tests for processes that occur over time?

What is the approach for constructing tests of code that don't have an outcome in the immediate sense?

Let's say we have a very simple (yet quite rude) process:

  • User signs up to site
  • Two days pass
    • Send reminder email
    • Update some database fields
  • Ten days pass
    • Send "c'ya" email
    • Delete account

I can write tests for each set of sub tasks (email is sent, database is updated, etc). However how do I write well structured tests, that read something like:

"Two days after registration, reminder email should be sent" "Ten days after registration, account is deleted"

Although I am using PHP and PHPUnit, I feel the question may/may not be language agnostic.

Aucun commentaire:

Enregistrer un commentaire