dimanche 8 mai 2016

Is it wrong to have api endpoints just for testing?

For example, a system is responsible for managing customers (CRUD). But there's not hard deletion of a customer. In other words, when removing a customer, it's not "physically" removed from the database, but instead it's just set as "inactive".

The thing is, when running our acceptance tests in the Test environment, we would like to test the creation of a customer. But since automated tests are supposed to run many times a day, in the short term the Test database would be full of "Foo" customers. So, we thought about adding an endpoint to our api to do a hard deletion of a customer. We already heard some things bad about doing that and we are aware of the serious problem that is having an 'unwanted' api endpoint in production, but we thought we could handle that somehow (restricting the access to that endpoint by environment, for example, but that would introduce others complexities to the code).

Based in your experience, is it ALWAYS wrong to have api endpoints just for testing?

Aucun commentaire:

Enregistrer un commentaire