Versions Compared

Key

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

...

For our purposes:

Test Method

A TestMethod is the smallest unit of the testing framework. A test method executes code and checks an outcome. At the end of the test method we generally make an assertion, stating our beliefs about the state of this particular test method if all worked as planned. We might expect a value to be true or false, null or not null, perhaps even equal to another variable, or simply not in a list of acceptable values. If the assertion is valid, the test passes. If the assertion does not represent reality (we specify it should be false but it is really true), the test fails.

...

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

Test Case

Wiki MarkupA TestCase is a collection of [TestMethod|TestMethods] 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.unmigrated-wiki-markup

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

...

\*The [\[Before\]| FlexUnit Metadata#Before] method is run before every \[TestMethod\] and the [\[After\]| FlexUnit Metadata#After] method is run after every [TestMethod].

'''Note:''' In a TestCase tests may be executed in ANY order. If you would like to specify an order to the tests, you may do so, see order for instructions on how to do so.

...

Finally, a TestSuite is a collection of TestCase TestCases and possibly other TestSuite TestSuites. A test suite is a simple class marked with a [Suite], and [RunWith("org.flexunit.runners.Suite")] Metadata tags. The tests and other suites that you want to have run inside this suite must be declared as public (and only public) variables. For example:

...