loading...

re: How do you name your tests? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: In Python land I typically name my methods test_[method under test]_[expected behavior]?_when_[preconditions], so my tests look like: def test_e...
 

I like parameterized tests as well. It's a nice way to cover multiple cases, that share the same assert statements.

I'm not great at Python. Is the "test_" at the beginning of the method required for the testrunner to identify the tests, or is it "just" convention?

 

Yep, that's often the pattern that a test runner looks for! I think most can be customized to find other patterns too, and I recently saw a pytest plugin that makes it easy not to have to type "test" so many times in code you already know is tests.

code of conduct - report abuse