dimanche 31 janvier 2016

SUT - Testing Internal Behaviour TDD

I have a question about testing requirements.

Let's take example:

Class Article {

    public void deactive() {//some behaviour, which deactives article}

}

I have in my requirements, that Article can be deactived. I will implement it as part of my Article class.

Test will call deactive method, but what now? I need to check at the end of the test, if requirement was fulfilled so I need to implement method isDeactived.
And here is my question, if I really should do it? This method will be only used by my test case, nowhere else. So I am complicating my class interface, just to see assert, if is really deactived.

What is the right way to implement it?

Aucun commentaire:

Enregistrer un commentaire