Versions Compared

Key

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

...

There are a lot of Metadata tags used in FlexUnit, and if you're still new to the framework it can be a bit overwhelming to know what to use and what can be included inside them. Here's a comprehensive list of the commonly used tags with a brief explanation of where they can be used. You should be able to find reference to most of these in the code examples listed in this wiki.

...

BeforeClass

...

– Used to specify a static method within a TestCase should run one time, before the constructor and all test cases, this only happens once per TestCase, per case execution, regardless of how many tests are in the test case. It's most commonly a BeforeClass marked method would be used to create tables, or connect to a database that would be used in a group of tests. For more information about BeforeClass see [Sequences]

  • ''Attributes:'' order, description, timeout, async, ui, user defined

...

– Used to specify a static method within a TestCase should run once, after all of the tests in a given test case are complete. In other words, when all of the tests in a test case are complete, before proceeding to the next testcase, this method executes. Conversely to a BeforeClass method AfterClass should preform cleanup on created tables, disconnect from databases, etc. For more information about AfterClass see [Sequences]

  • ''Attributes:'' order, description, timeout, async, ui, user defined

...

– Used to specify a method with a TestCase should be run before every [Test] in that class. For more information about Before see [Sequences]

  • ''Attributes:'' order, description, timeout, async, ui, user defined

...

– Used to specify a method with a TestCase should be run after every [Test] in that class. For more information about After see [Sequences]

  • ''Attributes:'' order, description, timeout, async, ui, user defined

...

Rule

...

– Used to define an advanced [Before]/[After] setup using an entire class allowing for increased reusability. For more information see [CreatingRules ] Creating Rules

  • ''Attributes:'' order

Suite

– specifies that the class tagged is a Test Suite and will contain a list of public variables typed as the Test Cases or additional Test Suites you wish to run. This tag is commonly paired with the [RunWith] tag to know what runner to use on the tests within this class. (Note: The Suite tag by it self actually does nothing, and RunWith specified with the Suite runner is all you need to set to get a class to run as a suite.) For more information about test suites see [Terminology#Test_Test Suite]

  • ''Attributes:'' order, description, user defined

RunWith("fullyQualifiedName")

...

– Used to identify a specific runner that should be used for this class. Common uses include specifying a class to use the Suite runner or Theory runner. The class specified must be linked into the project and must implement the IRunner interface. For more information about runners see Runners and Builders

...

– Can be used to ignore a specific [Test] or [Theory], the test will still be built, but will be skipped over when running all tests in the TestCase. The test marked with this tag is still counted in the total tests count. For more information about Ignore see [Ignore]

...

– Is used to specify that a method in a TestCase is a method you want FlexUnit to test. There are additional attributes that can be added to this tag such as (async) which is needed if the test is using asyncronous events or (expects="flash.errors.IOError") which indicates that you expect the Test to throw an exception of the specified type and it should catch it. For more information see user defined metadata.

  • ''Attributes:'' expects, order, description, timeout, async, ui, user defined, dataProvider

...

DataPoint(s)

...

– Used on a public static variable or public static function to return testing data. These are then used in conjunction with a Theory by running the Theory once for each item in that particular [DataPoint]'s range. If DataPoints is used, then the tag [ArrayElementType] must also be used to define the type of data the array contains. For more information see Theories, Datapoints, and Assumptions

...

– Used to test a full range of expected results with the help of DataPoint objects or functions. The Theory should specify accepted arguments of types matching to your declared DataPoints. FlexUnit will run all the theories for all possible combinations of arguments with the Datapoint DataPoint objects that match argument types.
More info on Theories see Theories, Datapoints, and Assumptions

...