문제

Is there any way to call same function before every testcase in python unittest framework?

도움이 되었습니까?

해결책

Sounds like you should investigate setUp()

setUp()

Method called to prepare the test fixture. This is called immediately before calling the test method; any exception raised by this method will be considered an error rather than a test failure. The default implementation does nothing.

다른 팁

This is what the setUp method of your unittest.TestCase subclass is for.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top