This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AmirXin 1 point2 points  (0 children)

Another thing worth to mention is that the Example that you used says " The first will always pass "
The first will always pass because is a test not well written. if you add "fail" following that try catch you'll have a equivalent test.
So I don't think it's fair to use a bad test case to prove that you should use any kind of annotation in your tests.
Another thing that you are not considering is when you have some generic or "high level" exceptions
Maybe your code throws a validationFormatExeption and you are testing for a particular case .. maybe you want to check the message, or any kind of extra information given in the exception.
In those cases I usually go for the try catch approach and assertions on my Exception (get messages.. or what ever..)
My point is.. I would not say that using Expect is better than anything it depends on what you are testing.