I am writing gem that parses a specific format. It is intended to be semi-private gem, not widespread-use gem.
There are three main classes in the gem - Parser, Node and Stack. They are heavily depending on each other. And I wonder, which testing strategy works best in this case:
- Write a test for each class, mocking/stubbing the other two, and write an integration test, covering real parsing examples?
- Write a test for each class, using real objects instead of mocks, and write an integration test, covering real parsing examples?
- Write a test for each class, mocking/stubbing the other two, and write another test for each class, using real objects this time?
My classes are not very big, but I want to learn best practices of code testing, so argument "write as you want, this is not important" is, IMHO, invalid ;-)
Aucun commentaire:
Enregistrer un commentaire