mardi 31 octobre 2017

Automatic test on PRODUCTION environment

We have a web application that is used by end-users to sign documents. In order to send the documents using 2FA we send a PIN code to the mobile phone of the end-user. Also when we validate the PIN for the signature we send an e-mail with an attachment to the end-user who signed the document and also in copy to his manager or to the Head Office (central systems). This procedure is for PRODUCTION.

We have an automated test in order to periodically test that everything is okay in production environment, and my team has something like this:

CODE:

$cc = "central@headoffice.com"

$destination = "test@email.com" // this is a test destination e-mail that we can check in order to see if we receive the email of the transaction

if ($destination == "test@email.com") {
    $cc = "" // if we are running a test over the PRD environment we don't want to send a copy of the transactional e-mail to the customer
}

Now, I don't like the part of having a hard-coded "if", I prefer to run the test using a special flag / ENV variable (for instance ENV="TEST_PRD") that we can use in order to load a special configuration.

We use PHP5.

I think something like the documentation of "Rails testing" or "Angular testing" can help, but maybe you can help us with some insight.

Thanks

Aucun commentaire:

Enregistrer un commentaire