Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There are instances where setup is necessary before executing any test method. For example it may be required that each test connects to a database before its assertions are tested. Instead of writing the same code in each test method to connect to a database, it would be a better idea to connect once and maintain a reference to the connection before any of the tests are run. This is done by defining a method that is decorated with the [BeforeClass]| FlexUnit Metadata#BeforeClass] metadata. Once all of the tests have been executed, it may be necessary to close the open connection. In this case a method decorated with the [AfterClass] [metadata tag would be used. This method, like the [BeforeClass] method is called once after all of the tests have been executed.

...