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

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 27
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 17
497 CHAPTER 23 Debugging and testing
The Profiler is the only tool available for Flex that allows this kind of testing, and it
does a great job. It gives you deep insight into how much memory and resources are
being consumed and where that consumption occurs.
Next we’ll discuss unit testing, which automates the testing of objects in order to
verify that they behave as expected. The Flex community has produced a number of
unit-testing frameworks that can assist you.
23.2.3 FlexUnit (unit testing)
If you’re familiar with Java, you may have encountered a tool called JUnit—FlexUnit is
a Flex spin on that. It’s a unit-testing framework for Flex and ActionScript 3, created
collaboratively by a few Adobe and non-Adobe developers. This tool is free and is
available at http://opensource.adobe.com/wiki/display/flexunit/.
You create an application called a test runner, which executes ActionScript functions
you create to conduct tests on various functions and classes. Although the project has
documentation, we’ll give you a crash course on it, starting with setting it up.
SETTING UP FOR FLEXUNIT
A test runner is a small application that uses FlexUnit’s
TestSuite
class to run
through all your tests. You could add it to your main project
MXML file, but because a
GUI component is involved it’s easier to make it a simple application on its own. This
can be a new project or an auxiliary application to your main one. Follow these steps:
1 Download the latest zip file from the FlexUnit site: http://open-
source.adobe.com/wiki/display/flexunit/.
2 Unzip the file to a location such as c:\flexunit.
3 Open your project in Flex Builder.
4 Right-click the project’s top-level folder, and select Properties.
5 Click the Library Path tab.
6 Click the Add SWC button.
7 Navigate to the FlexUnit directory, and under bin, select the flexunit.swc file.
8 The next step is to create a test-runner application to execute your tests.
CREATING A TEST RUNNER
A test runner can add any number of test-case collections and run through them.
FlexUnit calls these test-case collections a test suite, which adds a level of conve-
Capture
Performance
Profile
Used in conjunction with Reset Performance Data. After clicking Reset Per-
formance Data, click this button to snapshot a number of function calls and
how long they took to run. You can repeat this process as often as you like.
Delete Deletes an item you’ve selected (for example, a memory snapshot).
Table 23.5 Flex Builder’s Profiler functions (continued)
Icon Function Description
Seitenansicht 17
1 2 ... 13 14 15 16 17 18 19 20 21 22 23 ... 26 27

Kommentare zu diesen Handbüchern

Keine Kommentare