How can I improve my junit tests

后端 未结 9 843
南笙
南笙 2020-12-05 08:59

Right my junit tests look like a long story:

  • I create 4 users
  • I delete 1 user
  • I try to login with the deleted user and make sure it fails
9条回答
  •  南笙
    南笙 (楼主)
    2020-12-05 09:00

    Since everyone else is talking about structure I'll pick different points. This sounds like a good opportunity to profile the code to find bottleknecks and to run it through code coverage to see if you are missing anything (given the time it takes to run it the results could be interesting).

    I personally use the Netbeans profiler, but there are ones in other IDEs and stand alone ones as well.

    For code coverage I use Cobertura, but EMMA works too (EMMA had an annoyance that Cobertura didn't have... I forget what it was and it may not be an issue anymore). Those two are free, there are paid ones as well that are nice.

提交回复
热议问题