Is there a way to count the number of assertions in TestNG?
Actually the title includes the question.
I wou开发者_开发百科ld like to know how many assertions have been evaluated in the tests.
You could use aspectj for this. If you define a pointcut that matches with assert calls, you can keep a counter in an aspect and report that counter after the tests have run.
If you make the pointcut finegrained enough, you could count assertTrue() different from assertEquals(), etc.. if you would want that.
The short answer is no.
What you can do is use your own asserts and maintain a counter there.
精彩评论