I got a question regarding convention of tests in Spock.
Let us say we got A class to test, which is util class with static methods. Classic way to test it, would be A.method() in each test method.
However, in Spock we got @Subject annotation and I began wondering.
- @Subject util = new A()
And later in tests we would call the methods by util.method()
By doing that, we would achieve cleaner test. Instantly we see what's being tested. In most IDEs it would be highlighted and so. @Subject is very verbose annotation.
Do you see any cons of doing tests such a way? Or there is any better way to clealny test util classes in Spock?
Aucun commentaire:
Enregistrer un commentaire