Domanda

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

È stato utile?

Soluzione

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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top