For the complete experience, please enable JavaScript in your browser. Thank you!

  • Creative Cloud
  • Photoshop
  • Illustrator
  • InDesign
  • Premiere Pro
  • After Effects
  • Lightroom
  • See all
  • See plans for: businesses photographers students
  • Experience Cloud
  • Advertising Cloud
  • Analytics Cloud
  • Marketing Cloud
  • See all solutions for enterprise
  • Experience Manager Campaign Analytics Audience Manager
  • Document Cloud
  • Acrobat DC
  • Sign
  • Stock
  • Elements
  • Acrobat Reader DC
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player
  • All products
  • Creative Cloud
  • Individuals
  • Photographers
  • Students and Teachers
  • Business
  • Schools and Universities
  • Creative Cloud
  • Experience Cloud
  • Document Cloud
  • Stock
  • Elements
  • All products
  • Get Support
    Find answers quickly. Contact us if you need to.
    Start now >
  • Learn the apps
    Get started or learn new ways to work.
    Learn now >
  • Ask the community
    Post questions and get answers from experts.
    Start now >
Adobe is changing the world through digital experiences. Our creative, marketing and document solutions empower everyone — from emerging artists to global brands — to bring digital creations to life and deliver them to the right person at the right moment for the best results.
    • About Us
    • Newsroom
    • Careers At Adobe
    • Privacy
    • Security
    • Corporate Responsibility
    • Customer Showcase
    • Investor Relations
    • Events
    • Contact Us
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
vat included
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / Flex Developer Center / Flex Test Drive /

Flex Test Drive: Test and debug your code

by Adobe

Adobe logo

Modified

3 May 2011

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Flash BuilderFlexRIA
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Video | Code | Tutorial | Links

Test server-side code

 

This content requires Flash To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player. To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the Test Drive solution files (ZIP, 14 MB)

Code

No code is written in this tutorial.

Tutorial

In the previous two modules, you built Flex applications that retrieve, display, and modify data from a database. In this module you test and debug your code.

In this tutorial, you use the Flash Builder Test Operation to test your server-side code—even before writing any Flex code. This is useful to make sure your server-side operations are all working before you call them in your application.

Step 1: Test a service operation that returns data.

Right-click the getEmployees()operation in the Data/Services view and select Test Operation. Click the Test button in the Test Operation view.

You will see all the return data displayed in the TestOperation view (see Figure 1).

Test the getEmployees() service operation.
Figure 1. Test the getEmployees() service operation.

Java developers: You will get an employee object that is an array of Employee objects.

Step 2: Test a service operation that requires an input parameter.

Select the getEmployeesById() operation from the drop-down in the Test Operation view. Enter a value for the argument and click Test (see Figure 2).

The getEmployeesById() operation is invoked with the value you specified and the return data is displayed in the Test Operation view.

Test the getEmployeesById() service operation.
Figure 2. Test the getEmployeesById() service operation.

Step 3: Test a service operation that requires a complex input parameter.

Select the createEmployee() operation in the Test Operation view. Click in the Enter Value field and click the Ellipses button. You should get a pop-up window to enter input data (see Figure 3). Close this window.

You will be asked for an input object when testing the createEmployee() operation.
Figure 3. You will be asked for an input object when testing the createEmployee() operation.

Java developers: Your Input Argument window will look different because your method already knows it needs an Employee object. You can skip Steps 4 and 5 below and just enter test values here as shown in Figure 5 and then test the operation. Be sure to enter integers for id and departmentid and only two characters for state. It doesn't matter what id you specify, it will not be used; a value will be generated automatically for it by the database when the data is inserted.

Step 4: Configure the createEmployee() operation return type.

Return to the Data/Services view, right-click createEmployee() and select Configure Return Type. In the dialog box, auto-detect from sample data, change the type from Object to Employee, and then click in the Enter Value field (see Figure 4). Click the Ellipses button that appears and enter values for each Employee field (see Figure 5). Be sure to enter integers for departmentid and id and only two characters for state.

It does not matter what id you specify, it will not be used; a value will be automatically generated for it by the database when the data is inserted.

Specify data type when configuring the createEmployee() return type.
Figure 4. Specify data type when configuring the createEmployee() return type.
Specify input arguments when configuring the createEmployee() return type.
Figure 5. Specify input arguments when configuring the createEmployee() return type.

You should now see parameter and return types (Employee and int, respectively) specified for the createEmployee()operation in the Data/Services panel.

Step 5: Test the createEmployee() operation again.

Right-click createEmployees() in the Data/Services view and select Test Operation. Click the Test button in the Test Operation view.

This time you will see the test values you specified while configuring the return type already entered in the Enter Value field.

After you test the operation, you should see an integer displayed as the response value (see Figure 6). A new employee was successfully added to the database. If you run your application again, you will see this new employee in the DataGrid.

Test the createEmployee() service operation.
Figure 6. Test the createEmployee() service operation.

In this tutorial, you tested your server-side operations even before writing any code. In the next tutorial, you will monitor the traffic between your application and the server after you use service calls in your code.

Learn more

Refer to the following resources to learn more about this topic:

Documentation: Accessing data with Flex

  • Testing service operations
  • Authenticating access to services
  • Debugging remote services

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License+Adobe Commercial Rights

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

More Like This

  • Flex Test Drive: Modify the database
  • Flex Test Drive: Build an application in an hour
  • Flex Test Drive: Change the appearance of your application
  • Flex Test Drive: Build an application in an hour
  • Flex Test Drive: Deploy your application to a web server
  • Flex Test Drive: Add charts and graphs
  • Test Drive: Deploy your application to a web server
  • Flex Test Drive: Add charts and graphs
  • Flex Test Drive: Build an application in an hour
  • Flex Test Drive: Build an application in an hour

Tutorials and samples

Tutorials

  • Flex mobile performance checklist
  • Flex and Maven with Flexmojos – Part 3: Journeyman
  • Migrating Flex 3 applications to Flex 4.5 – Part 4

Samples

  • Twitter Trends
  • Flex 4.5 reference applications
  • Mobile Trader Flex app on Android Market

Flex user forum

More
06/09/2017 URGENT!!Horizontal Scrolling Text Like Marquee Without Blank spacing in Flex
06/07/2017 URGENT !! Horizontal Scrolling Text Like Marquee Without Blank spacing
06/02/2017 change skin on all instances of mx.Button with static var
06/01/2017 AS3 - Flex - StageWebView on ios shows html5 video as fullscreen by default?
Choose your region United States (Change)   Products   Downloads   Learn & Support   Company
Choose your region Close

Americas

Europe, Middle East and Africa

Asia Pacific

  • Brasil
  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Cyprus - English
  • Česká republika
  • Danmark
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Greece - English
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • Malta - English
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • Southeast Asia (Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam) - English
  • 台灣

Commonwealth of Independent States

  • Includes Armenia, Azerbaijan, Belarus, Georgia, Moldova, Kazakhstan, Kyrgyzstan, Tajikistan, Turkmenistan, Ukraine, Uzbekistan

Copyright © 2017 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

AdChoices