MACROMEDIA FLEX 2-TESTING FLEX APPLICATIONS WITH MERCURY QUICKTEST PROFESSIONAL Bedienungsanleitung Seite 22

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 27
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 21
501 CHAPTER 23 Debugging and testing
With Fluint installed, let’s look at how to create the test runner.
CREATING A TEST RUNNER
The test runner is a mini Flex application that loads all the test cases and runs
through them. Here are the steps to create Fluint test runner:
1 Download the sample test runner from http://code.google.com/p/Fluint/
downloads/list.
2 Save the SampleTestRunnerFlex.mxml file to your project’s folder.
3 Open it, and modify the line that calls
suiteArray.push()
, as shown in
listing 23.10.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:fluint="http://www.digitalprimates.net/2008/fluint"
layout="absolute"
creationComplete="startTestProcess(event)"
width="100%" height="100%">
<mx:Script>
<![CDATA[
import
net.digitalprimates.fluint.unitTests.frameworkSuite.FrameworkSuite;
protected function startTestProcess( event:Event ) : void
{
var suiteArray:Array = new Array();
suiteArray.push( new testSuite() );
testRunner.startTests( suiteArray );
}
] ] >
</mx:Script>
<fluint:TestResultDisplay width="100%" height="100%" />
<fluint:TestRunner id="testRunner"/>
</mx:Application>
Now the test runner needs the actual tests to execute against.
CREATING TEST CASES
You can create as many test-case files as you want; these are ActionScript classes, each
of which has functions/methods that perform some kind of test. Each function’s
name must start with lowercase
test
.
Fluint automatically searches for all functions that start with the word
test
, so you
don’t need to explicitly call these functions yourself. Listing 23.11 shows an example
test case that tests the
speedConverter
class from the FlexUnit example.
Listing 23.10 Setting up a Fluint test runner
Add test
suites
Seitenansicht 21
1 2 ... 17 18 19 20 21 22 23 24 25 26 27

Kommentare zu diesen Handbüchern

Keine Kommentare