3
Jonarz
7y

Let's talk about one of the two hard things in programming - what's your preferred test naming convention and why? I'll have to create plenty of those now, while the project I'm working on is still small, and I don't know which way to go. It's Spring (Java), but I don't think it matters that much 🤷

Comments
  • 0
    test.tcl
  • 1
    I try keep them in simple English and make them read out lout exactly like the test will be set up in code. Like: given_<aCondition>_when_<action>_expect_<result>
  • 0
    @Voltage825 thanks! I've seen this approach when I was scraping the Internet, but my concern is that such test names get riddiculously long and now that I use JUnit 5 with it's @DisplayName (shows given string instead of the method name), I'm not sure if such method names aren't a bit of an overkill. Wasn't it a problem for you?
  • 1
    I found that this works very well with the junior members and new maintainers
Add Comment