Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
actionscript
actionscript
[Ignore("Not Ready to Run")]
[Test]
public function multiplication():void {}

Test Case

Wiki MarkupA TestCase is a collection of [TestMethods|FlexUnit TestMethod] that share a common test environment. When using FlexUnit4, each \ [TestCase\] can have a [\[Before\] | FlexUnit Metadata#Before ] and [\[After\] | FlexUnit Metadata#After] metadata tags that can be used to decorate methods you want to run before and/or after each test method. These metadatas simulate the {{ setUp()}} and {{ tearDown()}} methods of [Fluint | http://fluint.googlecode.com/] and FlexUnit .9 | [http://code.google.com/p/as3flexunitlib/]. So, for example, if you wanted to write a series of [TestMethods| FlexUnit TestMethod] to test the Flex Timer class, they could all exist in a single TestCase. In the method decorated with [\[Before\] | FlexUnit Metadata#Before] you would create a Timer instance to test use in your tests. In the method decorated with [\[After\] | FlexUnit Metadata#After] , you would stop that timer and remove references so it can be garbage collected.
Additionally, you may decorate any number of static methods per class with the medatadata [\[BeforeClass\] | FlexUnit Metadata#BeforeClass ] and [\[AfterClass\] | FlexUnit Metadata#AfterClass] . These methods will be run once per test class.

Wiki MarkupFor example, if your TestCase has two [TestMethods| FlexUnit TestMethod], the FlexUnit4 framework would execute the \ [TestCase\] in the following way:

  1. [BeforeClass]
  2. [Before]
  3. [Test]
  4. [After]
  5. [Before]
  6. [Test]
  7. [After]
  8. [AfterClass]

...