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] 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.

...

The [Before],[After], [BeforeClass] and [AfterClass] metadata tags are pieces of metadata which control the flow of the test execution when used. FlexUnit4 then organizes these pieces and runs them in Sequences]. Sequences] are the way that FlexUnit4 controls the flow of the running of tests.

...