You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by bu...@apache.org on 2014/04/04 03:17:30 UTC

svn commit: r904814 [5/7] - in /websites/staging/flex/trunk: cgi-bin/ content/ content/css/ content/flexunit/tutorial/css/ content/flexunit/tutorial/flexunit/ content/flexunit/tutorial/scripts/

Added: websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-5.html
==============================================================================
--- websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-5.html (added)
+++ websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-5.html Fri Apr  4 01:17:29 2014
@@ -0,0 +1,973 @@
+<!DOCTYPE html>
+<!--[if IE 7 ]><html class="ie ie7" lang="en"><![endif]-->
+<!--[if IE 8 ]><html class="ie ie8" lang="en"><![endif]-->
+<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
+
+<head>
+
+    <meta charset="utf-8">
+    <title>Apache Flex® - Unit 5 - Developing Static Tests
</title>
+
+    <!-- For Mobiles  -->
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link href='https://fonts.googleapis.com/css?family=Carrois+Gothic' rel='stylesheet' type='text/css'>
+    <!-- CSS -->
+    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css">
+    <link rel="stylesheet" type="text/css" href="/css/fixed-width.css" id="layout">
+    <link rel="stylesheet" type="text/css" href="/css/style.css">
+
+    <!-- Java Script  -->
+    <script src="/js/jquery.js"></script>
+    <script src="/js/custom.js"></script>
+    <script src="/js/selectnav.js"></script>
+    <script src="/js/flexslider.js"></script>
+    <script src="/js/twitter.js"></script>
+    <script src="/js/fancybox.js"></script>
+    <script src="/js/isotope.js"></script>
+    <script src="/js/bootstrap.js"></script>
+    <script src="/js/showcase.js"></script>
+
+    <!-- Google Analytics -->
+    <script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-37926454-1']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();
+
+    </script>
+
+
+</head>
+<body>
+
+<!-- Wrapper Start -->
+<div id="wrapper" class="container-fluid">
+
+
+    <!-- Header -->
+
+
+    <div class="ie-dropdown-fix" >
+
+        <!-- Header -->
+        <div class="row-fluid" id="header">
+
+            <!-- Logo -->
+            <div class="span5">
+
+                <a href="#"><img src="/images/logo_01_fullcolor-sm.png" alt="Apache Flex®" title="Apache Flex®" /></a>
+
+            </div>
+
+            <!-- Social / Contact -->
+            <div class="span3 pull-right">
+
+                <!-- Social Icons -->
+                <ul class="social-icons">
+                    <li class="facebook"><a href="https://www.facebook.com/pages/Apache-Flex/174249699342648">Facebook</a></li>
+                    <li class="twitter"><a href="http://twitter.com/ApacheFlex">Twitter</a></li>
+                    <li class="linkedin"><a href="http://www.linkedin.com/groups/Apache-Flex-Developers-4296888">LinkedIn</a></li>
+                </ul>
+
+                <!-- Apache Logo -->
+                <a href="http://www.apache.org" id="contact-top"><img src="http://www.apache.org/images/feather-small.gif" title="An Apache Project" alt="An Apache Project" /> </a>
+            </div>
+
+        </div>
+        <!-- Header / End -->
+
+        <!-- Navigation -->
+        <div id="navigation" class="margintop">
+            <ul id="nav">
+
+                <li><a href="index.html">Home</a></li>
+
+                <li><a href="#">About Flex</a>
+                    <ul>
+
+                        <li><a href="/about-whatis.html">What is Flex?</a></li>
+                        <li><a href="/about-features.html">Features</a></li>
+                        <li><a href="/about-licensing.html">License &amp; Trademarks</a></li>
+                        <li><a href="/about-people.html">The Team</a></li>
+                        <li><a href="/about-history.html">Project History</a></li>
+                        <li><a href="/about-assets.html">Logo and Assets</a></li>
+                    </ul>
+                </li>
+                <li><a href="#">Community</a>
+                    <ul>
+
+                        <li><a href="/community-getinvolved.html">How to get involved</a></li>
+                        <li><a href="/community-mailinglists.html">Mailing Lists</a></li>
+                        <li><a href="/community-showcase.html">Flex Showcase</a></li>
+						<li><a href="/community-3rdparty.html">Third-Party</a></li>
+                        <li><a href="https://cwiki.apache.org/confluence/display/FLEX/Apache+Flex+Wiki">Wiki <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://blogs.apache.org/flex/">Blog <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#">Development</a>
+                    <ul>
+                        <li><a href="/dev-faq.html">Developer FAQ</a></li>
+                        <li><a href="/dev-sourcecode.html">Source Code</a></li>
+                        <li><a href="https://issues.apache.org/jira/browse/FLEX">Bug-Tracker <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#">Documentation</a>
+                    <ul>
+
+                        <li><a href="/doc-getstarted.html">Getting Started</a></li>
+                        <li><a href="/doc-videos.html">Videos</a></li>
+                        <li><a href="/asdoc/">ASDocs</a></li>
+                        <li><a href="http://help.adobe.com/en_US/flex/using/index.html">Documentation Reference (Old) <i class="icon-share icon-white"></i></a></li>
+
+                    </ul>
+                </li>
+
+                <li><a href="#">About Apache</a>
+                    <ul>
+
+                        <li><a href="http://www.apache.org">The Apache Software Foundation Website <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/contributing.html">Donations <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/thanks.html">Thanks <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#" class="download">Download</a>
+                    <ul>
+
+                        <li><a href="/installer.html">Download the SDK Installer (For Application Developers)</a></li>
+                        <li><a href="/download-binaries.html">Download the SDK Binaries (For SDK Developers)</a></li>
+                        <li><a href="/download-source.html">Download the SDK Source Code (For SDK Developers)</a></li>
+                        <li><a href="/download-utilities.html">Download Utilities</a></li>
+                        <li><a href="/download-archive.html">Previous Versions</a></li>
+                    </ul>
+                </li>
+            </ul>
+
+        </div>
+        <div class="nav-shadow"></div>
+        <div class="clear"></div>
+
+    </div>
+    <!-- Navigation / End -->
+
+
+    <!-- Content -->
+
+    
+    <div class="row-fluid">
+
+
+        <!-- Page Title -->
+        <div id="page-title">
+            <h2>Unit 5 - Developing Static Tests
</h2>
+        </div>
+        <!-- Page Title / End -->
+
+
+    </div>
+    
+
+    <div class="row-fluid">
+
+
+
+<!-- Home Page Exception -->
+
+
+<p><a href="../code/unit5.zip"><img src="../images/DownloadIcon.png" alt="Download" /> Download Unit Project Files</a></p>
+<p>FlexUnit 4.x has available features for developers to plan ahead and prepare tests for classes still under development. Ignoring a test is a capability that will allow you to prototype or create tests that may not yet be relevant or operational.</p>
+
+<p>While the basic assertions you have used so far will accomplish much, the more advanced assertions available by using Hamcrest inside of FlexUnit 4 will reduce complexity in your test cases and increase test legibility.</p>
+
+<h3>Objectives:</h3>
+
+<p>After completing this lesson, you should be able to:</p>
+
+<ul>
+    <li>Set test methods to be ignored</li>
+    <li>Refactor test methods for greater specificity</li>
+    <li>Use <code>assertThat()</code> and extensible assertions in your test methods</li>
+    <li>Write a custom matcher to be used in an <code>assertThat()</code> statement</li>
+    <li>Write tests that expect an exception</li>
+</ul>
+
+<h3>Topics</h3>
+
+<p>In this unit, you will learn about the following topics:</p>
+
+<ul>
+    <li>Adding additional tests</li>
+    <li>Dealing with incomplete tests</li>
+    <li>Ignoring a test and its benefits</li>
+    <li>Understanding multiple assertions</li>
+    <li>Extensible assertions</li>
+    <li>Hamcrest</li>
+    <li>Writing matchers</li>
+</ul>
+
+<h2>Adding additional tests</h2>
+
+<p>If you are a practitioner of test-first development, then you create each test in your system just before you create the code to make that test pass. In essence, you are defining the interface progressively.</p>
+
+<p><p>However, if you are writing tests for legacy code, or writing your tests immediately after a class is written, you can inspect the code and note the expected outcome of each method. You can then write tests that will cover these conditions.</p>
+<p>In the latter situation, it is common to write test stubs, empty functions for each required test, and implement them sequentially. The practice of creating these empty tests serves as documentation for the needed tests as they are discovered.</p>
+<p>Consider the needed tests for the following objects:</p>
+<ul>
+    <li>A box of crayons contains 12 crayons each of which is a unique color.</li><br />
+    <li>Each crayon is made of wax, has a color, and a wrapper.</li><br />
+    <li>Each wrapper has the color name on it.</li>
+</ul>
+<p>You probably notice several things that need to be tested right away.  Minimally, you need to test that the box has 12 crayons. You would need to test that each crayon is of type wax, has a color and a wrapper.  You would need to test that the wrapper has a color name and that the color name is the same as the color of the crayon it wraps. Finally, you would need to test that each crayon color is unique.</p></p>
+<p><code><pre>public class BoxOfCrayonsCase {
+    [Test]
+    public function shouldHaveTwelveCrayons():void {}
+    [Test]
+    public function shouldHaveUniqueColors():void {}
+}</p>
+<p>public class CrayonCase {
+    [Test]
+    public function shouldBeWax():void {}
+    [Test]
+    public function shouldHaveColor():void {}
+    [Test]
+    public function shouldBeWrapped():void {}
+}</p>
+<p>public class WrapperCase {
+    [Test]
+    public function shouldHaveColorName():void {}
+    [Test]
+    public function shouldMatchWrappedCrayon():void {}
+}</pre></code></p>
+<p>You now have a road map for testing.  Currently none of these tests actually verify functionality. As noted previously, the lack of a failing assertion is a success so all of these tests would pass.  Excellent, testing complete!</p>
+
+<p><p>If only the world were so easy.  In reality, these tests are far from complete, the fact that all these <i>incomplete</i> tests will pass is a problem that needs to be addressed.</p></p>
+<h2>Dealing with incomplete tests</h2>
+
+<p>There are several possible ways to deal with incomplete tests</p>
+
+<ul>
+    <li>
+        <p>Leave them as stubs - Stubbed tests still show in the test complete dialogue.  They will always be marked as passing.  It is very easy to forget to implement these tests and it artificially appears as though you have many valid tests.</p>
+    </li>
+    <li>
+        <p>Comment the tests out - These tests will not show in the complete dialogue.  Like stub tests, it is very easy to forget to complete these tests as there is no visible reminder.</p>
+    </li>
+    <li>
+        <p>Add a special type of assertion named <code>fail()</code> inside each method - This type of assertion always marks a test as a failure.  This is effective, and certainly serves as a reminder that the test needs to be completed, but not the best solution as it artificially appears as though you have many failing tests.</p>
+    </li>
+    <li>
+        <p>Ignoring - This will mark the tests in the complete dialogue without marking them as failures. When ignoring, you will receive a reminder that these tests need to be implemented but without the side effect of artificial statistics. This is the best way to deal with incomplete tests.</p>
+    </li>
+</ul>
+
+<h2>Ignoring a test</h2>
+
+<p>The [Ignore] metadata is a special type of metadata recognized by FlexUnit 4.x. It can be used on a test, test case or test suite. It is often used when a test has been written but is not ready to run with any reasonable outcome or when refactoring of a class renders specific tests temporarily irrelevant or broken</p>
+
+<p>The [Ignore] metadata can also be applied to tests that have been written for a particular case, but the actual components or methods that they need to test are non-existent. For example, in the crayon example above, you may want to write the wrapper test before the wrapper class.</p>
+
+<p>Finally, they can also be useful to hold on to deprecated tests that may be relevant again at a later point.</p>
+
+<p>Ignored tests:</p>
+
+<ul>
+    <li>Are neither passing nor failing tests</li>
+    <li>Are counted and reported as Ignored by FlexUnit as a reminder</li>
+    <li>Are easily identified and ignored through the <code>[Ignore]</code> decoration</li>
+</ul>
+
+<p><code><pre>[Ignore]
+[Test]
+public function ignoreTest() :void</pre></code></p>
+<h2>Walkthrough 1: Commenting out and Ignoring Tests</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Comment out several test methods.</li>
+    <li>Ignore several test methods.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the BasicCircleTest.as file from the previous exercise.</p>
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt1.fxp project from the Unit 5/Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+        <h3><br />Commenting out tests</h3>
+    </li>
+    <li>
+        <p>Highlight the text that comprises the <code>shouldGetBottomPointOnCircle()</code> function. Press Shift+Control+c (Shift+Command+C on MacOS) and the comment markers (/* and */) should be added as shown.</p>
+
+        <img alt='CommentingCode' id='shift' src='../images/unit5/image1.png' />
+        <p class='caption' id='shift'>Figure 1: Commenting code</p>
+    </li>
+    <li>
+        <p>Save BasicCircleTest.as</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file again.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window. Note that there is one less test than previously results:</p>
+
+        <img alt='TwoTestFailures' id='shift' src='../images/unit5/image2.png' />
+        <p class='caption' id='shift'>Figure 2: Two test failures</p>   
+
+        <h3><br />Using Ignore metadata</h3>
+    </li>
+    <li>
+        <p>Re-Open the BasicCircleTest.as file. Remove the comments by highlighting the commented <code>shouldGetBottomPointOnCircle()</code> function and pressing Shift+Control+c. This command will remove the comment markers. The function should look as it did at the start of this walkthrough.</p>
+    </li>
+    <li>
+        <p>Add a line with <code>[Ignore]</code> metadata above the <code>[Test]</code> metadata of the <code>shouldGetBottomPointOnCircle()</code> function.</p>
+
+        <code><pre>[Ignore]
+[Test]
+public function shouldGetBottomPointOnCircle():void {
+...
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Save BasicCircleTest.as.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file again.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='TwoTestsOneIgnore' id='shift' src='../images/unit5/image3.png' />
+        <p class='caption' id='shift'>Figure 3: Two test failures and one has been ignored</p>
+    </li>
+    <li>
+        <p>Similarly, mark the <code>shouldGetRightPointOnCircle</code>, <code>shouldGetLeftPointOnCircle()</code> and <code>shouldThrowRangeError()</code> test method with ignore metadata.</p>
+
+        <code><pre>[Ignore]
+[Test]
+public function shouldThrowRangeError():void {
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Save BasicCircleTest.as</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file again.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='FourIgnores' id='shift' src='../images/unit5/image4.png' /> 
+        <p class='caption' id='shift'>Figure 4: Four tests have been ignored</p>
+    </li>
+</ol>
+
+<h2>Benefits of Ignore over Comments</h2>
+
+<p>As you have just demonstrated, [Ignore] provides a useful way of indicating that a test exists but is, for whatever reason, not ready to run at this time. Ignoring a test ensures that the test is not lost in comments and forgotten.</p>
+
+<p>The [Ignore] metadata provides a few additional benefits over commenting. First, the [Ignore] metadata can accept additional system and user defined arguments.</p>
+
+<p><p>For example:</p></p>
+<p><code><pre>[Ignore(description="Phase II Requirement",category="Required"]
+[Test]
+public function shouldGetPointsOnCircle():void 
+{
+...
+}</pre></code></p>
+<p>This additional information can be used for filtering, sorting and reporting on some test systems. Unfortunately, at this time, Flash Builder does not display this extra information to its users. However, it does provide one useful function when using [Ignore]: Flash Builder Premium will display the ignored tests in the case hierarchy. This means you can easily find and click on an ignored method to quickly find it in a large project.</p>
+
+<h2>Extensible Assertions</h2>
+
+<p>So far we have discussed three types of assertions</p>
+
+<ol>
+    <li><code>assertTrue( condition:Boolean )</code></li>
+    <ul>
+        <li>Valid if the condition is true</li>
+    </ul>
+    <li><code>assertFalse( condition:Boolean )</code></li>
+    <ul>
+        <li>Valid if the condition is false</li>
+    </ul>
+    <li><code>assertEquals( value1:Object, value2:Object )</code></li>
+    <ul>
+        <li>Valid if value1 == value2</li>
+    </ul>
+</ol>
+
+<p>Standard assertions work well for many cases. However, as the complexity of your tests increases, you may find yourself with long, complicated compound assertions. For example: what if you needed to ensure that the result of a method call was an array that contained at least two specific values?</p>
+
+<p><p>Ideally, tests not only verify functionality but are also a portion of the documentation for the system. This is only possible if the tests are clear, concise and legible.  Further, in cases like the array examples above, you would end up with significant logic in your tests. Any place where logic exists needs to be considered suspect unless there are tests to verify that functionality, and we simply can't recommend writing tests for your tests.</p>
+<p>Additionally, the simplistic nature of the assertions you have learned so far, also means they provide simplistic error messages. Take the case of this slightly more complicated assertion that determines if a number is between two other numbers:</p>
+<code><pre>assertTrue( num1 &#62; num2 &#38;&#38; num1 &#60; num3 );</pre></code>
+<p>If this test fails, it would yield the basic and uninformative failure message:</p>
+<code><pre>"Expected &#60;true&#62; but was &#60;false&#62;."</pre></code>
+<p>This information, while true, is not all that useful for instant problem identification. This lack of information forces the developer back to the original test to understand what was being tested and helps defeat one of the key advantages of having tests.</p></p>
+<h2>Hamcrest</h2>
+
+<p>Hamcrest is an open source library of matchers, which are simple classes that perform comparisons. These matchers, along with encompassing logic, allow Hamcrest to perform complicated matching with a simple and extensible syntax.</p>
+
+<p>Hamcrest itself is neither a unit testing library, nor specifically made to work with unit tests, but the matchers it exposes are used by FlexUnit to provide a powerful and flexible way to move beyond basic assertions.</p>
+
+<p>When using Hamcrest assertions in FlexUnit, you use a special function named <code>assertThat()</code>.</p>
+
+<p><code><pre>public function assertThat( value, matcher );</pre></code>
+<p>Unlike the assertions used so far, the <code>assertThat()</code> method does not inherently prescribe any specific type of comparison or evaluation. Instead, you provide a value and a matcher. It is the matcher that dictates the type of comparison.</p>
+<p>Referring back to the example from above, if you wished to know if num1 was between num2 and num3 using standard assert syntax, you would write:</p>
+<code><pre>assertTrue( num2 &#60; num1 &#38;&#38; num1 &#60; num3);</pre></code>
+<p>Using Hamcrest, this same assertion would read:</p>
+<code><pre>assertThat( num1, is( between( num2, num3 ) ) );</pre></code>
+<p>There are several advantages to the Hamcrest assertion. First, this statement could be read by someone with little testing or development experience and would still be understandable.</p>
+<p>Second, if the <code>assertThat()</code> statement above fails it would yield the following result:</p>
+<code><pre>"Expected a number between &#60;num2&#62; and &#60;num3&#62; but was &#60;num1&#62;."</pre></code>
+<p>which is many, many times more useful than the <code>assertTrue()</code> statement's failure message in this same situation:</p>
+<code><pre>"Expected &#60;true&#62; but was &#60;false&#62;."</pre></code>
+<p>This particular assertion uses the <code>is()</code> and <code>between()</code> matchers to create a more readable assertion. These are just two of the many types of matchers offered by Hamcrest. Further, as each matcher is simply a class that implements a specific interface, you are encouraged to create your own matchers to make even the most difficult matching clear inside of your test cases.</p>
+<p>For more information on Hamcrest and extensible matchers, check out the Hamcrest-as3 page on github available at <a class='contentlink' href='http://github.com/drewbourne/hamcrest-as3' target='_blank'>http://github.com/drewbourne/hamcrest-as3</a>.</p></p>
+<h2>Understanding the Floating Point Issue</h2>
+
+<p>There were three test failures in Unit 4: Walkthrough 3 because the <code>assertEquals()</code> statement is used to judge equality, which seems logical on the surface. However, there are many times when a computer's concept of equal and our concept of 'equal enough' are not the same.</p>
+
+<p><p>The <code>shouldGetTopPointOnCircle()</code> method was the only one of the four point tests that passed:</p></p>
+<p><code><pre>[Test]
+public function shouldGetTopPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point = circle.getPointOnCircle( 0 );</p>
+<div class="codehilite"><pre><span class="n">assertEquals</span><span class="p">(</span> 5<span class="p">,</span> <span class="n">point</span><span class="p">.</span><span class="n">x</span> <span class="p">);</span>
+<span class="n">assertEquals</span><span class="p">(</span> 0<span class="p">,</span> <span class="n">point</span><span class="p">.</span><span class="n">y</span> <span class="p">);</span>
+</pre></div>
+
+
+<p>}</pre></code></p>
+<p>This was the only of the four new point tests that called <code>circle.getPointOnCircle()</code> with an argument of 0. The other three point tests called <code>circle.getPointOnCircle()</code> with <code>Math.PI/2</code>, <code>Math.PI</code>, and <code>(3*Math.PI)/2</code>.</p>
+
+<p><p>Pi is an irrational number that cannot be expressed exactly. Further, Flash Player itself can only store large numbers to a certain precision. This means that calculations involving any floating point value, and especially an irrational one like Pi, will always have a margin of error.</p></p>
+<p><code><pre>[Test]
+public function shouldGetBottomPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point = circle.getPointOnCircle( Math.PI );</p>
+<div class="codehilite"><pre><span class="n">assertEquals</span><span class="p">(</span> <span class="o">-</span>5<span class="p">,</span> <span class="n">point</span><span class="p">.</span><span class="n">x</span> <span class="p">);</span>
+<span class="n">assertEquals</span><span class="p">(</span> 0<span class="p">,</span> <span class="n">point</span><span class="p">.</span><span class="n">y</span> <span class="p">);</span>
+</pre></div>
+
+
+<p>}</pre></code></p>
+<p><img alt='FailureStackTrace' src='../images/unit5/image5.png' />
+<p class='caption'>Figure 1: Failure Stack Trace</p></p>
+<p>If you examine the failure in Flash Builder (Figure 1), you will quickly understand the issue. The result our <code>shouldGetBottomPointOnCircle()</code> method returned the following values for x and y:</p>
+
+<ul>
+    <li>point.x = -5</li>   
+    <li>point.y = 6.123031769111886E-16 (which is actually 0.0000000000000006123031769111886, expressed in scientific notation)</li>
+</ul>
+
+<p>Both of these calculations are correct within a very acceptable margin of error. However, we told FlexUnit, and hence Flash Player, that they needed to be exactly equal. The problem comes with the specificity of our request, not the test. To that end, we need a way to explain to FlexUnit that we are okay with a margin of error. While the standard assertions can't provide that for us, Hamcrest can.</p>
+
+<h2>Walkthrough 2: Using Hamcrest to deal with Floating Point Issues</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Use the <code>assertThat()</code> statement with extensible assertions.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the FlexUnit4Training.mxml file from the previous exercise.</p>
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt2.fxp project from the Unit 5/Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />Using the assertThat() method with extensible assertions</h3>
+
+    </li>
+    <li>
+        <p>At the top of the <code>BasicCircleTest</code> class declare a private, static constant with the name of <code>TOLERANCE</code> and a data type of <code>Number</code>. Set the constant equal to <code>.0001</code>.</p> 
+
+        <code><pre>public class BasicCircleTest {
+    private static const TOLERANCE:Number = .0001;
+    ...
+}       </pre></code>
+
+        <p>We will use this value to determine "close enough."  If the result is between our expected value plus or minus the tolerance, we are willing to consider the value to be close enough.</p>
+    </li>
+    <li>
+        <p>Replace the first <code>assertEquals()</code> assertion of the <code>shouldgetTopPointOnCircle()</code> function with the <code>assertThat()</code> statement as shown.</p>
+        <p>Replace this statement:</p>
+        <code><pre>assertEquals( 5, point.x );</pre></code>
+        <p>With this statement:</p>
+        <code><pre>assertThat( point.x, closeTo( 5, TOLERANCE ) );</pre></code>
+        <p>Be sure to either use the code complete with assertThat and closeTo, or manually add their imports.</p>
+        <code><pre>import org.flexunit.assertThat;<br />import org.hamcrest.number.closeTo;</pre></code>    
+    </li>
+    <li>
+        <p>Remove [Ignore] metadata from the <code>shouldGetBottomPointOnCircle()</code>, <code>shouldGetLeftPointOnCircle()</code> and <code>shouldGetRightPointOnCircle()</code> methods.</p>
+        <p>Unlike <code>assertEquals()</code>, the <code>closeTo()</code> Hamcrest matcher specifies that we need to look for numerical equivalence within a specific margin of error.</p>
+    </li>
+    <li>
+        <p>Change all the point tests so that each uses the <code>assertThat()</code> statement in place of <code>assertEquals()</code>.</p> 
+
+        <code><pre>[Test]
+public function shouldGetTopPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point;
+
+    point = circle.getPointOnCircle( 0 );
+    assertThat( point.x, closeTo( 5, TOLERANCE ) );
+    assertThat( point.y, closeTo( 0, TOLERANCE ) );
+}
+
+[Test]
+public function shouldGetBottomPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point;
+
+    point = circle.getPointOnCircle( Math.PI );
+    assertThat( point.x, closeTo( -5, TOLERANCE ) );
+    assertThat( point.y, closeTo( 0, TOLERANCE ) );
+}
+
+[Test]
+public function shouldGetRightPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point;
+
+    point = circle.getPointOnCircle( Math.PI/2 );
+    assertThat( point.x, closeTo( 0, TOLERANCE ) );
+    assertThat( point.y, closeTo( 5, TOLERANCE ) );
+}
+
+[Test]
+public function shouldGetLeftPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point;
+
+    point = circle.getPointOnCircle( (3*Math.PI)/2 );
+    assertThat( point.x, closeTo( 0, TOLERANCE ) );
+    assertThat( point.y, closeTo( -5, TOLERANCE ) );
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Save the BasicCircleTest.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file. If the tests ran successfully, you should see the following output.</p>
+
+        <img alt='PassedOneIgnore' id='shift' src='../images/unit5/image6.png' /> 
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed, one ignored</p>
+    </li>
+</ol>
+
+<h2>Writing Matchers</h2>
+
+<p>The Hamcrest library includes base matchers to cover a wide variety of potential situations. You are encouraged to create your own custom matchers when encountering a situation that can be handled more easily, or more clearly, with a new matcher.</p>
+
+<p><p>One of the goals behind Hamcrest is to create highly readable matching. If you examine your unit tests, they are still legible but becoming less so as the complexity of testing increases. For example:</p></p>
+<p><code><pre> assertThat( point.x, closeTo( -5, TOLERANCE ) );
+    assertThat( point.y, closeTo( 0, TOLERANCE ) );</pre></code></p>
+<p>Neither you, nor another individual that may read this code later, really cares that the point's x and y properties are within a tolerance. What you really care about is that one Point is close to another Point within a given tolerance.</p>
+
+<p><code><pre> assertThat( point, closeToPoint( otherPoint, TOLERANCE ) );</pre></code></p>
+<p>While this is a simple example, custom matchers continue to become more effective as the complexity of your tests grows.</p>
+
+<p>Custom matcher classes extend the <code>TypeSafeMatcher</code> class. Basic custom matchers are written with three methods.</p>
+
+<ul>
+    <li>Constructor</li>
+    <ul> 
+        <li>Used to provide the values being matched.</li>
+    </ul>
+    <li>Override of <code>matchesSafely()</code></li>
+    <ul>
+        <li>Accepts an item of data type <code>Object</code> that will be compared to the provided values.  You perform any logic to determine if the values match or not in this method and return a Boolean indicating the result.</li>
+    </ul>
+    <li>Override of <code>describeTo()</code></li>
+    <ul>
+        <li>Used to create the informative error descriptions characteristic of Hamcrest.  This should return the descriptive string.</li>
+    </ul>
+</ul>
+
+<h2>Walkthrough 3: Writing your own matcher</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Create a new ActionScript package.</li>
+    <li>Write a custom matcher.</li>
+    <li>Use the custom matcher in the <code>getPointOnCircle()</code> tests.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the BasicCircleTest.as file from the previous exercise.</p> 
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt3.fxp project from the Unit 5/Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />Create the matcher package</h3>
+    </li>
+    <li>
+        <p>Within the tests directory, create another package named matcher.  Right click on the tests directory and choose New > Package.</p> 
+
+        <img alt='CreateNewPackage' id='shift' src='../images/unit5/image7.png' /> 
+        <p class='caption' id='shift'>Figure 1: Create a new package</p>
+    </li>
+    <li>
+        <p>The Name should be matcher.</p>
+
+        <img alt='NewPackageWindow' id='shift' src='../images/unit5/image8.png' />
+        <p class='caption' id='shift'>Figure 2: New package window</p>
+
+        <h3><br />Create the matcher class</h3>
+    </li>
+    <li>
+        <p>You will now need to create a new class within the helper package. Right click on the package and choose New &#62; ActionScript Class.</p>
+
+        <img alt='NewHelperClass' id='shift' src='../images/unit5/image9.png' />
+        <p class='caption' id='shift'>Figure 3: Create a new class in the helper package</p>
+    </li>
+    <li>
+        <p>The class should be named CloseToPointMatcher and its Superclass should be org.hamcrest.TypeSafeMatcher. Modifiers should be set to public and the Generate constructor from superclass option should be checked. Click Finish.</p>
+
+        <img alt='NewCloseToPointMatcher' id='shift' src='../images/unit5/image10.png' /> 
+        <p class='caption' id='shift'>Figure 4: New ActionScript Class CloseToPointMatcher</p>
+    </li>
+    <li>
+        <p>Open the CloseToPointMatcher.as file from the matcher package.</p>
+
+        <img alt='PackageDirectoryStructure' id='shift' src='../images/unit5/image11.png' /> 
+        <p class='caption' id='shift'>Figure 5: Package directory structure</p>
+    </li>
+    <li>
+        <p>Add a private variable named <code>point</code> of type <code>Point</code> and another named <code>tolerance</code> of data type <code>Number</code> to the class.</p> 
+
+        <code><pre> private var point:Point;
+    private var tolerance:Number;</pre></code>
+
+        <p>If you did not use code-completion, add the import for flash.geom.Point at this time.</p>
+    </li>
+    <li>
+        <p>Modify the automatically created <code>CloseToPointMatcher()</code> constructor. To accept point and tolerance parameters, instead of an <code>expectedType</code>.  Pass a reference of the Point class to the superclass's constructor, and populate the local circle and offset properties with the appropriate argument from the constructor.</p>
+
+        <code><pre>public function CloseToPointMatcher( point:Point, tolerance:Number ) {
+    super(Point);
+    this.point = point;
+    this.tolerance = tolerance;
+}       </pre></code>
+
+        <p>The <code>super(Point)</code> declaration is informing the classes the data types that the class will be dealing with is a Point class.</p>
+    </li>
+    <li>
+        <p>Override the <code>matchesSafely()</code> method of the class. It will take an argument named <code>item</code> of data type <code>Object</code>, and will return a Boolean.</p>
+
+        <code><pre>override public function matchesSafely(item:Object):Boolean {
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>In the <code>matchesSafely()</code> method, declare a variable named <code>distance</code> of data type <code>Number</code>. Set it equal to <code>Point.distance( item as Point, point )</code>;</p>
+
+        <code><pre>override public function matchesSafely(item:Object):Boolean {
+    var distance:Number = Point.distance( item as Point, point );
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Add a return statement that checks if the <code>tolerance</code> subtracted from the absolute value of the <code>distance</code> is less than 0.</p>
+
+        <code><pre>override public function matchesSafely(item:Object):Boolean {
+    var distance:Number = Point.distance( item as Point, point );
+
+    return( Math.abs( distance ) - tolerance &#60; 0 );
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Add an override for the public function <code>describeTo()</code>. It will take an argument named <code>description</code> of type <code>Description</code>. Because there are two available <code>Description</code> classes, make sure to choose the <code>org.hamcrest.Description</code> class when you use code completion.</p>
+
+        <code><pre>override public function describeTo(description:Description):void {
+    description.appendText( "point " ).appendText( point.toString() );
+}       </pre></code>
+
+        <p>If you did not use code-completion, add the import for <code>org.hamcrest.Description</code>.</p>
+    </li>
+    <li>
+        <p>Save CloseToPointMatcher.as.</p>
+    </li>
+    <li>
+        <p>Open the BasicCircleTest.as file.</p>
+    </li>
+    <li>
+        <p>Modify the <code>shouldGetTopPointOnCircle()</code> method so that it reads as follows.</p>
+
+        <code><pre>[Test]
+public function shouldGetTopPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point = circle.getPointOnCircle( 0 );
+
+    assertThat( point, new CloseToPointMatcher( new Point( 5, 0 ), TOLERANCE ) );
+}       </pre></code>
+
+        <p>Be sure to either choose CloseToPointMatcher from the code-completion, or manually add the import:</p>
+        <code><pre>import matcher.CloseToPointMatcher;</pre></code>
+    </li>
+    <li>
+        <p>Each of the point testing functions should follow this format. Instantiate the circle, instantiate the expected point, and finish with the assertion.</p>
+
+        <code><pre>[Test]
+public function shouldGetTopPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point = circle.getPointOnCircle( 0 );
+
+    assertThat( point, new CloseToPointMatcher( new Point( 5, 0 ), TOLERANCE ) );
+}
+
+[Test]
+public function shouldGetBottomPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point = circle.getPointOnCircle( Math.PI );
+
+    assertThat( point, new CloseToPointMatcher( new Point( -5, 0 ), TOLERANCE ) );
+}
+
+[Test]
+public function shouldGetRightPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point = circle.getPointOnCircle( Math.PI/2 );
+
+    assertThat( point, new CloseToPointMatcher( new Point( 0, 5 ), TOLERANCE ) );
+}
+
+[Test]
+public function shouldGetLeftPointOnCircle():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    var point:Point = circle.getPointOnCircle( (3*Math.PI)/2 );
+
+    assertThat( point, new CloseToPointMatcher( new Point( 0, -5 ), TOLERANCE ) );
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Save BasicCircleTest.as</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='PassedOneIgnored' id='shift' src='../images/unit5/image6.png' /> 
+        <p class='caption' id='shift'>Figure 6: FlexUnit tests passed, one test ignored</p>
+    </li>
+</ol>
+
+<h2>Exceptions</h2>
+
+<p>There are times when your code should throw an error in response to a given situation, such as when an illegal value or null is provided to a required property. In these cases the actual outcome of a test is not to assert a condition but to verify that the error was thrown as expected.</p>
+
+<p><p>If an error is NOT thrown in this situation, it should be considered a failure while throwing the error would be a success. This logical inversion is often handled by wrapping all testing functionality in try-catch blocks. However, this leads to ugly, illegible and difficult to maintain code.</p>
+<p>FlexUnit 4 simplifies this process by allowing an <i>expects</i> argument in the Test annotation for this purpose.</p>
+<ul>
+    <li>To use the <i>expects</i> annotation, simply provide the type of error expected.</li></p>
+<div class="codehilite"><pre><span class="o">&lt;</span><span class="n">code</span><span class="o">&gt;&lt;</span><span class="n">pre</span><span class="o">&gt;</span>
+</pre></div>
+
+
+<p>[Test (expects="full.package.ThrownError")]
+public function testError():void {}                   <br />
+    </pre></code></p>
+<div class="codehilite"><pre><span class="nt">&lt;li&gt;</span>If the tested method throws the <span class="nt">&lt;code&gt;</span>ThrownError<span class="nt">&lt;/code&gt;</span>, FlexUnit 4.x will recognize this method as a success and mark the test as passed.<span class="nt">&lt;/li&gt;</span>
+<span class="nt">&lt;li&gt;</span>If the error is not thrown, then the test is marked as a failure.<span class="nt">&lt;/li&gt;</span> 
+<span class="nt">&lt;li&gt;</span>If the method throws an error that is not of type <span class="nt">&lt;code&gt;</span>ThrownError<span class="nt">&lt;/code&gt;</span> then FlexUnit 4 marks that test as a failure, since the expected error type did not match the error that was thrown, and something else is causing your method to fail.<span class="nt">&lt;/li&gt;</span>
+</pre></div>
+
+
+<p></ul> <br />
+<p>The <code>expects=""</code> attribute only verifies the type of the error, it does not evaluate the properties of the error instance. If you need to verify data internal to the error you must catch the error yourself and perform assertions.</p>
+<p>In most cases, the <code>expects=""</code> attribute works well as the existence of the error is often most important.</p></p>
+<h2>Walkthrough 4: Handling an exception in a Test</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Add a statement that will throw an error when the tests are run.</li>
+    <li>Handle a desired exception using <code>expects=""</code> attribute.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the BasicCircleTest.as file from the previous exercise.</p> 
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt4.fxp project from the Unit5/Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />Run a new test</h3>
+
+    </li>
+    <li>
+        <p>At the end of the <code>BasicCircleTest</code> class there is an ignored test method named <code>shouldThrowRangeError()</code>. Remove the <code>[Ignore]</code> metadata from this function and declare a variable named <code>someCircle</code> of type <code>Circle</code>. Instantiate the <code>Circle</code> with an origin of <code>(10, 10)</code> and a radius of <code>-5</code>.</p>
+
+        <code><pre>[Test]
+public function shouldThrowRangeError():void {
+    var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Save BasicCircleTest.as</p>
+    </li>
+    <li>
+        <p>Run FlexUnit4Training.mxml.</p>
+
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='SingleErrorThrown' id='shift' src='../images/unit5/image12.png' />
+        <p class='caption' id='shift'>Figure 1: A single test has thrown an error</p>
+
+        <p>The <code>shouldThrowRangeError()</code> test is throwing an error. The error comes from the test's attempt to instantiate a Circle object with a radius of -5. Even without looking at the code, one could conclude that a Circle with a negative radius has conceptual issues.</p> 
+        <p>Notice that FlexUnit is registering the error without any assertion statement present in the function. If a test method throws an error at any point, FlexUnit will register that method as an error.</p> 
+        <p>When a test fails due to a failed assertion, it is considered a failure. When it fails due to a run time exception, it is considered an error. While the result is the same, a test that does not pass, errors are generally considered more heinous as they indicate an unhandled exception.</p>
+
+        <h3><br />Using "expects" metadata to deal with anticipated errors</h3>
+    </li>
+    <li>
+        <p>Return to the BasicCircleTest class. Modify the <code>[Test]</code> metadata tag on the line above the <code>shouldThrowRangeError()</code> function to indicate that it expects a <code>RangeError</code>.</p>
+
+        <code><pre>[Test(expects="RangeError")]
+public function shouldThrowRangeError():void {
+    var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
+}       </pre></code>
+
+        <p>RangeError exists in the default package, and hence appears to just be the class name. For your own custom errors or errors defined in the Flex framework, it is important you provide the full path.</p>
+    </li>
+    <li>
+        <p>Save BasicCircleTest.as</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file again.</p>
+
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit5/image13.png' /> 
+        <p class='caption' id='shift'>Figure 2: FlexUnit tests passed</p>
+
+        <p>The <code>shouldThrowRangeError()</code> method has still thrown an error. Because of the <code>expects="RangeError"</code> metadata, FlexUnit knows that this is the expected condition. If that particular error is not thrown, FlexUnit considers it a failure for the test.</p>
+    </li>
+</ol>
+
+<h2>Summary</h2>
+
+<ul>
+    <li>
+        <p>You can create a roadmap for testing by writing out all the expected tests without functionality.</p>
+    </li>
+    <li>
+        <p>Marking tests with [Ignore] metadata is the best way to ensure that you are aware of incomplete test methods.</p>
+    </li>
+    <li>
+        <p>Test methods should be written with as few assertions per test as possible.</p>
+    </li>
+    <li>
+        <p>Hamcrest can:</p>
+    </li>
+    <ul>
+        <li>Increase code readability</li>
+        <li>Increase test report specificity</li>
+        <li>Customize tests to assert better conditions</li>
+    </ul>
+    <li>
+        <p>You can write custom matchers for use with the <code>assertThat()</code> method.</p>
+    </li>
+    <li> 
+        <p>The <code>expects=""</code> attribute of [Test] annotation can be used to handle expected exceptions in your tests.</p>
+    </li>
+</ul>
+
+<h2>Navigation</h2>
+
+<ul>
+    <li><a href="Unit-4.html">Unit 4 - FlexUnit Basics</a></li>
+    <li><a href="Unit-6.html">Unit 6 - Working with the Test Fixture</a></li>
+    <li><a href="../index.html">Table of Contents / Introduction</a></li>
+</ul>
+
+<!-- Home Page Exception -->
+
+
+
+
+</div></div>
+<!-- Wrapper / End -->
+
+
+<!-- Footer -->
+
+<!-- Footer Top -->
+<div id="footer" class="container-fluid paddingbottom" >
+
+
+    <div class="row-fluid">
+
+        <!-- About -->
+        <div class="span3">
+            <div class="footer-headline"><h4>About Us</h4></div>
+            <p>Apache Flex® is a highly productive, open source application framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops and devices (including smartphones, tablets and tv). It provides a modern, standards-based language and programming model that supports common design patterns suitable for developers from many backgrounds. Flex applications can be deployed to the ubiquitous Adobe® Flash® Player in the browser, Adobe® AIR™ on desktop and mobile or to native Android™, IOS™, QNX®, Windows® or Mac® applications.</p>
+        </div>
+
+        <!-- Subscribe  -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Subscribe</h4></div>
+            <p>We have two mailing lists, one for SDK developers, and one for SDK users.</p>
+            <p>Developers, send an email to <br>
+                <a href="mailto:dev-subscribe@flex.apache.org">dev-subscribe@flex.apache.org</a>
+            </p>
+            <p>Users, send an email to <br>
+                <a href="mailto:users-subscribe@flex.apache.org">users-subscribe@flex.apache.org</a>
+            </p>
+        </div>
+
+        <!-- Latest Releases -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Latest Releases</h4></div>
+            <p>Apache Flex SDK : <a href="/download-binaries.html">4.12.0 (Mar 2014)</a><br />
+                SDK Installer : <a href="/installer.html">2.7.0 (Oct 2013)</a><br />
+                BlazeDS : <a href="http://sourceforge.net/adobe/blazeds/wiki/Home/">4.6.0 (Nov 2011)</a><br />
+                Flex Mavenizer : <a href="http://svn.apache.org/viewvc/flex/utilities/trunk/mavenizer/"> 4.8.0 (Jan 2013)</a></p>
+        </div>
+
+        <!-- Latest Tweets -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Latest Tweets</h4></div>
+            <a class="twitter-timeline" href="https://twitter.com/ApacheFlex" data-chrome="noheader nofooter noborders noscrollbar" data-widget-id="364567612920852480">Tweets by Apache Flex</a>
+            <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+            <div class="clear"></div>
+        </div>
+
+    </div>
+
+</div>
+<!-- Footer / Bottom -->
+<div id="footer" class="container-fluid" style="background: #111;">
+    <div class="row-fluid">
+        <div class="span12">
+            <div id="footer-bottom">
+                Copyright © 2014 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 <br>
+                Apache Flex, Apache and the Apache feather logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+                Read more about our privacy policy on our <a href="about-privacy.html">Privacy Policy</a> page.
+                <div id="scroll-top-top"><a href="#" title="Go to Top"></a></div>
+            </div>
+        </div>
+    </div>
+
+</div>
+
+<!-- Footer / End -->
+
+</body>
+
+</html>
\ No newline at end of file

Added: websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-6.html
==============================================================================
--- websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-6.html (added)
+++ websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-6.html Fri Apr  4 01:17:29 2014
@@ -0,0 +1,690 @@
+<!DOCTYPE html>
+<!--[if IE 7 ]><html class="ie ie7" lang="en"><![endif]-->
+<!--[if IE 8 ]><html class="ie ie8" lang="en"><![endif]-->
+<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
+
+<head>
+
+    <meta charset="utf-8">
+    <title>Apache Flex® - Unit 6 - Working with the Test Fixture
</title>
+
+    <!-- For Mobiles  -->
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link href='https://fonts.googleapis.com/css?family=Carrois+Gothic' rel='stylesheet' type='text/css'>
+    <!-- CSS -->
+    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css">
+    <link rel="stylesheet" type="text/css" href="/css/fixed-width.css" id="layout">
+    <link rel="stylesheet" type="text/css" href="/css/style.css">
+
+    <!-- Java Script  -->
+    <script src="/js/jquery.js"></script>
+    <script src="/js/custom.js"></script>
+    <script src="/js/selectnav.js"></script>
+    <script src="/js/flexslider.js"></script>
+    <script src="/js/twitter.js"></script>
+    <script src="/js/fancybox.js"></script>
+    <script src="/js/isotope.js"></script>
+    <script src="/js/bootstrap.js"></script>
+    <script src="/js/showcase.js"></script>
+
+    <!-- Google Analytics -->
+    <script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-37926454-1']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();
+
+    </script>
+
+
+</head>
+<body>
+
+<!-- Wrapper Start -->
+<div id="wrapper" class="container-fluid">
+
+
+    <!-- Header -->
+
+
+    <div class="ie-dropdown-fix" >
+
+        <!-- Header -->
+        <div class="row-fluid" id="header">
+
+            <!-- Logo -->
+            <div class="span5">
+
+                <a href="#"><img src="/images/logo_01_fullcolor-sm.png" alt="Apache Flex®" title="Apache Flex®" /></a>
+
+            </div>
+
+            <!-- Social / Contact -->
+            <div class="span3 pull-right">
+
+                <!-- Social Icons -->
+                <ul class="social-icons">
+                    <li class="facebook"><a href="https://www.facebook.com/pages/Apache-Flex/174249699342648">Facebook</a></li>
+                    <li class="twitter"><a href="http://twitter.com/ApacheFlex">Twitter</a></li>
+                    <li class="linkedin"><a href="http://www.linkedin.com/groups/Apache-Flex-Developers-4296888">LinkedIn</a></li>
+                </ul>
+
+                <!-- Apache Logo -->
+                <a href="http://www.apache.org" id="contact-top"><img src="http://www.apache.org/images/feather-small.gif" title="An Apache Project" alt="An Apache Project" /> </a>
+            </div>
+
+        </div>
+        <!-- Header / End -->
+
+        <!-- Navigation -->
+        <div id="navigation" class="margintop">
+            <ul id="nav">
+
+                <li><a href="index.html">Home</a></li>
+
+                <li><a href="#">About Flex</a>
+                    <ul>
+
+                        <li><a href="/about-whatis.html">What is Flex?</a></li>
+                        <li><a href="/about-features.html">Features</a></li>
+                        <li><a href="/about-licensing.html">License &amp; Trademarks</a></li>
+                        <li><a href="/about-people.html">The Team</a></li>
+                        <li><a href="/about-history.html">Project History</a></li>
+                        <li><a href="/about-assets.html">Logo and Assets</a></li>
+                    </ul>
+                </li>
+                <li><a href="#">Community</a>
+                    <ul>
+
+                        <li><a href="/community-getinvolved.html">How to get involved</a></li>
+                        <li><a href="/community-mailinglists.html">Mailing Lists</a></li>
+                        <li><a href="/community-showcase.html">Flex Showcase</a></li>
+						<li><a href="/community-3rdparty.html">Third-Party</a></li>
+                        <li><a href="https://cwiki.apache.org/confluence/display/FLEX/Apache+Flex+Wiki">Wiki <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://blogs.apache.org/flex/">Blog <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#">Development</a>
+                    <ul>
+                        <li><a href="/dev-faq.html">Developer FAQ</a></li>
+                        <li><a href="/dev-sourcecode.html">Source Code</a></li>
+                        <li><a href="https://issues.apache.org/jira/browse/FLEX">Bug-Tracker <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#">Documentation</a>
+                    <ul>
+
+                        <li><a href="/doc-getstarted.html">Getting Started</a></li>
+                        <li><a href="/doc-videos.html">Videos</a></li>
+                        <li><a href="/asdoc/">ASDocs</a></li>
+                        <li><a href="http://help.adobe.com/en_US/flex/using/index.html">Documentation Reference (Old) <i class="icon-share icon-white"></i></a></li>
+
+                    </ul>
+                </li>
+
+                <li><a href="#">About Apache</a>
+                    <ul>
+
+                        <li><a href="http://www.apache.org">The Apache Software Foundation Website <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/contributing.html">Donations <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/thanks.html">Thanks <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#" class="download">Download</a>
+                    <ul>
+
+                        <li><a href="/installer.html">Download the SDK Installer (For Application Developers)</a></li>
+                        <li><a href="/download-binaries.html">Download the SDK Binaries (For SDK Developers)</a></li>
+                        <li><a href="/download-source.html">Download the SDK Source Code (For SDK Developers)</a></li>
+                        <li><a href="/download-utilities.html">Download Utilities</a></li>
+                        <li><a href="/download-archive.html">Previous Versions</a></li>
+                    </ul>
+                </li>
+            </ul>
+
+        </div>
+        <div class="nav-shadow"></div>
+        <div class="clear"></div>
+
+    </div>
+    <!-- Navigation / End -->
+
+
+    <!-- Content -->
+
+    
+    <div class="row-fluid">
+
+
+        <!-- Page Title -->
+        <div id="page-title">
+            <h2>Unit 6 - Working with the Test Fixture
</h2>
+        </div>
+        <!-- Page Title / End -->
+
+
+    </div>
+    
+
+    <div class="row-fluid">
+
+
+
+<!-- Home Page Exception -->
+
+
+<p><a href="../code/unit6.zip"><img src="../images/DownloadIcon.png" alt="Download" /> Download Unit Project Files</a></p>
+<p>Much like any significant amount of code that you develop, your tests will eventually begin to show signs of duplicate code. Fortunately, repeat operations can be factored into discrete methods allowing you to create an understandable test fixture. Instantiating objects, running methods, destroying objects, and loading data are all operations that can be factored into methods and classes with the help of FlexUnit 4.x features.</p>
+
+<h3>Objectives:</h3>
+
+<p>After completing this lesson, you should be able to:</p>
+
+<ul>
+    <li>Use [Before] and [After] metadata to set up and tear down your test fixture</li>
+    <li>Use [BeforeClass] and [AfterClass] metadata to set up and tear down portions of the fixture that persist across tests and cases</li>
+</ul>
+
+<h3>Topics</h3>
+
+<p>In this unit, you will learn about the following topics:</p>
+
+<ul>
+    <li>Setting up a fixture</li>
+    <li>Refactoring tests to remove duplication</li>
+    <li>Understand Before as an indication of cohesion</li>
+    <li>The importance of cleaning up the fixture</li>
+</ul>
+
+<h2>Setting up the test fixture</h2>
+
+<p>In the last few lessons you have briefly learned about the concept of a test fixture, which is the collection of all of the state required to run a test repeatedly. So far you have created that state in each test by creating objects and setting properties. Unfortunately, this leads to a fair amount of duplication when many tests share the same setup requirements.</p>
+
+<p><p>FlexUnit offers several ways to factor this repeated setup out into new methods that can be run to create your fixture.</p></p>
+<h3>Before methods</h3>
+
+<p>FlexUnit allows developers to mark any method inside of a test case with a special metadata tag named <code>[Before]</code>. Methods marked with <code>[Before]</code> metadata run before each test method in the test case class.</p>
+
+<ul>
+    <li>A class may contain any number of <code>[Before]</code> methods.</li>
+    <li>Unless an order is specified, the order of multiple methods marked with <code>[Before]</code> is indeterminate.</li>
+    <li>Methods must be public, accept no arguments and return void.</li>
+    <li>To use, simply decorate the method with <code>[Before]</code> metadata.</li>
+</ul>
+
+<p><code><pre>[Before]
+public function runMeBeforeEveryTest():void {
+}</pre></code></p>
+<h3>After methods</h3>
+
+<p>The logical opposite of the <code>[Before]</code> metadata is the <code>[After]</code> metadata. Methods marked with <code>[After]</code> run after each test method in the test case class.</p>
+
+<ul>
+    <li>A class may contain any number of <code>[After]</code> methods.</li>
+    <li>Unless an order is specified, the order of multiple methods marked with <code>[After]</code> is indeterminate.</li>
+    <li>Methods must be public, accept no arguments and return void.</li>
+    <li>To use, simply decorate the method with <code>[After]</code> metadata.</li>
+</ul>
+
+<p><code><pre>[After]
+public function runMeAfterEveryTest():void {
+}</pre></code></p>
+<h3>Order of Execution</h3>
+
+<p>As indicated above Before and After methods run before and after every test. Therefore, the execution of a method with three tests is indicated below:</p>
+
+<p><code><pre> [Before]
+        [Test1]
+    [After] 
+    [Before]
+        [Test2]
+    [After] 
+    [Before]
+        [Test3]
+    [After]</pre></code></p>
+<p>The setup of your test fixture occurs before each test to ensure the test runs in isolation from others in the test case.</p>
+
+<h2>Refactoring to remove duplication</h2>
+
+<p>The methods decorated with <code>[Before]</code> and <code>[After]</code> can be used to remove duplicate code from tests. Once extracted to an independent method, this duplicated code no longer needs to be maintained in each test but rather it can be maintained once for all tests in the test case.</p>
+
+<p>Ideally, the majority of your test fixture is established through the use of the Before methods, and destroyed through the use of the After methods. This is particularly important. For a test to truly be a unit test it must be isolated. The use of the Before and After methods ensure that a new test fixture is built, tested against and destroyed for each test.</p>
+
+<h2>Walkthrough 1: Creating a Fixture for the Circle Tests</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Create <code>setMeUp()</code> and <code>tearMeDown()</code> functions for the test case.</li>
+    <li>Remove circle instantiation from individual tests.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the BasicCircleTest.as file from the previous exercise.</p>
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt1.fxp project from the Unit 6/Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />[Before] &#38; [After] metadata</h3>
+
+    </li>
+    <li>
+        <p>Add a private variable with the name of <code>circle</code> and a data type of <code>Circle</code> to the class.</p>
+
+        <code><pre>public class BasicCircleTest {       
+    private static const TOLERANCE:Number = .0001;
+    private var circle:Circle;
+    ...
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Add a public function named <code>setMeUp()</code> to the class. Mark the function with a <code>[Before]</code> metadata tag. This function will set the <code>circle</code> property to a new <code>Circle</code> instance with arguments <code>new Point( 0, 0 )</code> and <code>5</code>.</p>
+
+        <code><pre>[Before]
+public function setMeUp():void {
+    circle = new Circle( new Point( 0, 0 ), 5 );
+}       </pre></code>
+
+        <p>Note, the name of the function is unimportant. It is only the Before metadata that makes this a Before method.</p>
+    </li>
+    <li>
+        <p>Similarly, add another public function named <code>tearMeDown()</code>. In this case you are going to mark the function with an <code>[After]</code> metadata tag. This function will set the class <code>circle</code> variable to null.</p> 
+
+        <code><pre>[After]
+public function tearMeDown():void {
+    circle = null;
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Remove the <code>circle</code> variable instantiations from each of the test methods. Using the first test as a model:</p>
+
+        <code><pre>[Test]
+public function shouldReturnProvidedRadius():void {
+    var circle:Circle = new Circle( new Point( 0, 0 ), 5 );
+    assertEquals( 5, circle.radius );
+}       </pre></code>
+
+        <p>Becomes:</p>
+
+        <code><pre>[Test]
+public function shouldReturnProvidedRadius():void {
+    assertEquals( 5, circle.radius );
+}       </pre></code>
+
+        <h3><br />Running the test case</h3>
+
+    </li>
+    <li>
+        <p>After the instantiations have been removed, the test class should read as follows:</p>
+
+        <code><pre>public class BasicCircleTest {   
+    private static const TOLERANCE:Number = .0001;
+    private var circle:Circle;
+
+    [Before]
+    public function setMeUp():void {
+        circle = new Circle( new Point( 0, 0 ), 5 );
+    }
+
+    [After]
+    public function tearMeDown():void {
+        circle = null;
+    }
+
+    [Test]
+    public function shouldReturnProvidedRadius():void {
+        assertEquals( 5, circle.radius );
+    }
+
+    [Test]
+    public function shouldComputeCorrectDiameter():void {
+        assertEquals( 10, circle.diameter );
+    }
+
+    [Test]
+    public function shouldReturnProvidedOrigin():void {
+        assertEquals( 0, circle.origin.x );
+        assertEquals( 0, circle.origin.y );
+    }
+
+    [Test]
+    public function shouldReturnTrueForEqualCircle():void {
+        var circle2:Circle = new Circle( new Point( 0, 0 ), 5 );
+
+        assertTrue( circle.equals( circle2 ) );
+    }
+
+    [Test]
+    public function shouldReturnFalseForUnequalOrigin():void {
+        var circle2:Circle = new Circle( new Point( 0, 5 ), 5);
+
+        assertFalse( circle.equals( circle2 ) );
+    }
+
+    [Test]
+    public function shouldReturnFalseForUnequalRadius():void {
+        var circle2:Circle = new Circle( new Point( 0, 0 ), 7);
+
+        assertFalse( circle.equals( circle2 ) );
+    }
+
+    [Test]
+    public function shouldGetTopPointOnCircle():void {
+        var point:Point = circle.getPointOnCircle( 0 );
+
+        assertThat( point, new CloseToPointMatcher ( new Point( 5, 0 ), TOLERANCE ) );
+    }
+
+    [Test]
+    public function shouldGetBottomPointOnCircle():void {
+        var point:Point = circle.getPointOnCircle( Math.PI );
+
+        assertThat( point, new CloseToPointMatcher ( new Point( -5, 0 ), TOLERANCE ) );
+    }
+
+    [Test]
+    public function shouldGetRightPointOnCircle():void {
+        var point:Point = circle.getPointOnCircle( Math.PI/2 );
+
+        assertThat( point, new CloseToPointMatcher ( new Point( 0, 5 ), TOLERANCE ) );
+    }
+
+    [Test]
+    public function shouldGetLeftPointOnCircle():void {
+        var point:Point = circle.getPointOnCircle( (3*Math.PI)/2 );
+
+        assertThat( point, new CloseToPointMatcher ( new Point( 0, -5 ), TOLERANCE ) );
+    }
+
+    [Test(expects="RangeError")]
+    public function shouldThrowRangeError():void {
+        var someCircle:Circle = new Circle( new Point( 10, 10 ), -5 );
+    }
+}       </pre></code>
+
+        <p>Other circles, such as <code>circle2</code> are still instantiated in its respective methods, because it is unique in each case.</p>
+    </li>
+    <li>
+        <p>Save BasicCircleTest.as.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit6/image1.png' />
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed</p>
+    </li>
+</ol>
+
+<h2>Understanding Before as an indication of cohesion</h2>
+
+<p>In general, it is a good practice to group similar tests together. One advantage gained by using Before and After methods is that it quickly becomes apparent when tests do not share the same test fixture.</p>
+
+<p><p>If you find yourself with methods that need significantly different setup, or are not using much of the setup created in the Before methods, then it is likely that your tests are grouped in a way that is not particularly cohesive.</p> 
+<p>If your methods successfully share the test fixture, then each new method added to a case requires less duplicate code and hence less effort. Ideally, your tests become a line or two of code and an assertion.</p></p>
+<h2>The importance of cleaning up the fixture</h2>
+
+<p>Methods marked with <code>[After]</code> are generally intended to mirror the instantiations or creations of the <code>[Before]</code> method. They are responsible for destroying the test fixture to ensure open connections are closed, references and listeners are removed, and objects are made available for garbage collection.</p>
+
+<p>Destroying the fixture correctly lowers the overhead of the test run by ensuring memory leaks are resolved and objects are appropriately collected. Left uncollected during large test runs, this additional overhead can become significant quickly.</p>
+
+<h2>BeforeClass and AfterClass Metadata</h2>
+
+<p>In rare cases, you may wish to create a portion of the test fixture that remains constant or maintains desired state across all tests. For example, perhaps each of your tests needs to read data from the same large XML file. Rather than reload and reparse this file in each of your [Begin] methods, you might decide to do this once for all tests in a given test case or suite.</p>
+
+<p>FlexUnit allows you to specify static methods to run before the test case (or suite) is instantiated and after the execution is complete. These methods allow you to perform operations that should only occur once per case or suite execution, as opposed to the test by test manipulation that [Before] and [After] offer.</p>
+
+<p>These methods, marked with [BeforeClass] and [AfterClass] metadata, are often used to facilitate tests that connect to a live system, such as a database. However, it is important to note a few pitfalls of this approach.</p>
+
+<p><p>First, as soon as you use BeforeClass or AfterClass, your tests are no longer completely independent of each other. A side effect of one test has the potential to manipulate the test fixture, creating a situation where the order of tests now influences their success or failure. Therefore, it is best to try to limit items created in BeforeClass to items that will be consumed or read and avoid items which will be manipulated in any way.</p>
+<p>Second, if you do find yourself heavily relying upon items created in this way, you may have moved into the territory of integration tests and away from unit tests. Remember, a unit is the smallest piece of testable code. The combination of your code, the network stack, an application server, a database connection, and a database server rarely qualifies.</p>
+<p>As items created in BeforeClass are created before the test case constructor is called, they must be static. Unlike items created in Before which have the possibility of being garbage collected, these static items will not. Therefore, the cleanup performed by the AfterClass methods is extremely important.</p>
+<p>Static functions marked with [BeforeClass] and [AfterClass] can exist on a test case or a test suite and are run once per execution. The method execution of a three-test hierarchy is illustrated below:</p></p>
+<p><code><pre>[BeforeClass]
+    [Before]
+        [Test]
+    [After] 
+    [Before]
+        [Test]
+    [After] 
+    [Before]
+        [Test]
+    [After] 
+[AfterClass]</pre></code></p>
+<h2>Walkthrough 2: Using BeforeClass and AfterClass</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Use <code>[BeforeClass]</code> and <code>[AfterClass]</code> to demonstrate test hierarchy.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the BasicCircleTest.as file from the previous exercise.</p> 
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt2.fxp project from the Unit 6/start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />Using [BeforeClass] &#38; [AfterClass] metadata</h3>
+
+    </li>
+    <li>
+        <p>Declare a public static function named <code>setUpClass()</code>, mark it with <code>[BeforeClass]</code> metadata. In the function body, add a trace statement that merely states "Before Class."</p>
+
+        <code><pre>[BeforeClass]
+public static function setUpClass():void {
+    trace( "Before Class" );
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Similarly, declare another public static function named <code>tearDownClass()</code>, mark it with <code>[AfterClass]</code> metadata.</p> 
+
+        <code><pre>[AfterClass]
+public static function tearDownClass():void {
+    trace( "After Class" );
+}       </pre></code>
+
+        <h3><br />Visualizing test order</h3>
+
+    </li>
+    <li>
+        <p>A similar trace statement should be added to the existing <code>setMeUp()</code> and <code>tearMeDown()</code> methods.</p>
+
+        <code><pre>[Before]
+public function setMeUp():void {
+    circle = new Circle( new Point( 0, 0 ), 5 );
+    trace( "Before Test" );
+}
+
+[After]
+public function tearMeDown():void {
+    circle = null;
+    trace( "After Test" );
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Finally, add a trace statement to every test method on the first line.</p>
+
+        <code><pre>[Test]
+public function shouldReturnProvidedRadius():void {
+    trace( "Test" );
+    assertEquals( 5, circle.radius );
+}       </pre></code>
+
+    </li>
+    <li>
+        <p>Save BasicCircleTest.as</p>
+    </li>
+    <li>
+        <p>Run FlexUnit4Training.mxml file in Debug Mode.</p> 
+
+        <img alt='DebugMode' id='shift' src='../images/unit6/image2.png' />
+        <p class='caption' id='shift'>Figure 1: Running in Debug Mode</p>
+    </li>
+    <li>
+        <p>Nothing is going to change about how the tests display in the browser, in this walkthrough we are interested in Flash Builder's Console View, which is usually located at the bottom of the screen.</p>
+
+        <img alt='ConsoleTab' id='shift' src='../images/unit6/image3.png' />
+        <p class='caption' id='shift'>Figure 2: Console in the tab navigator</p>
+    </li>
+    <li>
+        <p>Take a look at the console view; if all the functions ran to completion, you should see the following show up in order.</p>
+
+        <code><pre>
+Before Class
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+Before Test
+Test
+After Test
+After Class
+        </pre></code>
+
+    </li>
+    <li>
+        <p>Based on the exhibited call hierarchy, you should be able to tell that the <code>setUpClass()</code> and <code>tearDownClass()</code> functions are being called before the first test method and after the last. Meanwhile, the <code>setMeUp()</code> and <code>tearMeDown()</code> methods are being called respectively before and after every test.</p>
+    </li>
+</ol>
+
+<h2>Summary</h2>
+
+<ul>
+    <li><p>Test fixture metadata:</p></li>
+    <ul>
+        <li><p>[Before], marks a method that runs before each test.</p></li>
+        <li><p>[After], marks a method that runs after each test.</p></li>
+        <li><p>[BeforeClass], marks a method that is run before the test case or suite is created and run.</p></li>
+        <li><p>[AfterClass], marks a method that is run after the test case or suite has run completely.</p></li>
+    </ul>
+    <li><p>[Before] and [BeforeClass] methods can indicate test case cohesion, because tests should be grouped together based on their similarity.</p></li>
+    <li><p>[After] and [AfterClass] methods are useful for cleaning up the fixture and minimizing overhead.</p></li>
+    <li><p>These methods, when used correctly, allow you to factor duplicated code out of the test methods.</p></li>
+</ul>
+
+<h2>Navigation</h2>
+
+<ul>
+    <li><a href="Unit-5.html">Unit 5 - Developing Static Tests</a></li>
+    <li><a href="Unit-7.html">Unit 7 - Using Suites</a></li>
+    <li><a href="../index.html">Table of Contents / Introduction</a></li>
+</ul>
+
+<!-- Home Page Exception -->
+
+
+
+
+</div></div>
+<!-- Wrapper / End -->
+
+
+<!-- Footer -->
+
+<!-- Footer Top -->
+<div id="footer" class="container-fluid paddingbottom" >
+
+
+    <div class="row-fluid">
+
+        <!-- About -->
+        <div class="span3">
+            <div class="footer-headline"><h4>About Us</h4></div>
+            <p>Apache Flex® is a highly productive, open source application framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops and devices (including smartphones, tablets and tv). It provides a modern, standards-based language and programming model that supports common design patterns suitable for developers from many backgrounds. Flex applications can be deployed to the ubiquitous Adobe® Flash® Player in the browser, Adobe® AIR™ on desktop and mobile or to native Android™, IOS™, QNX®, Windows® or Mac® applications.</p>
+        </div>
+
+        <!-- Subscribe  -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Subscribe</h4></div>
+            <p>We have two mailing lists, one for SDK developers, and one for SDK users.</p>
+            <p>Developers, send an email to <br>
+                <a href="mailto:dev-subscribe@flex.apache.org">dev-subscribe@flex.apache.org</a>
+            </p>
+            <p>Users, send an email to <br>
+                <a href="mailto:users-subscribe@flex.apache.org">users-subscribe@flex.apache.org</a>
+            </p>
+        </div>
+
+        <!-- Latest Releases -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Latest Releases</h4></div>
+            <p>Apache Flex SDK : <a href="/download-binaries.html">4.12.0 (Mar 2014)</a><br />
+                SDK Installer : <a href="/installer.html">2.7.0 (Oct 2013)</a><br />
+                BlazeDS : <a href="http://sourceforge.net/adobe/blazeds/wiki/Home/">4.6.0 (Nov 2011)</a><br />
+                Flex Mavenizer : <a href="http://svn.apache.org/viewvc/flex/utilities/trunk/mavenizer/"> 4.8.0 (Jan 2013)</a></p>
+        </div>
+
+        <!-- Latest Tweets -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Latest Tweets</h4></div>
+            <a class="twitter-timeline" href="https://twitter.com/ApacheFlex" data-chrome="noheader nofooter noborders noscrollbar" data-widget-id="364567612920852480">Tweets by Apache Flex</a>
+            <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+            <div class="clear"></div>
+        </div>
+
+    </div>
+
+</div>
+<!-- Footer / Bottom -->
+<div id="footer" class="container-fluid" style="background: #111;">
+    <div class="row-fluid">
+        <div class="span12">
+            <div id="footer-bottom">
+                Copyright © 2014 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 <br>
+                Apache Flex, Apache and the Apache feather logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+                Read more about our privacy policy on our <a href="about-privacy.html">Privacy Policy</a> page.
+                <div id="scroll-top-top"><a href="#" title="Go to Top"></a></div>
+            </div>
+        </div>
+    </div>
+
+</div>
+
+<!-- Footer / End -->
+
+</body>
+
+</html>
\ No newline at end of file