Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
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:
Purchase requires verification of academic eligibility
Subtotal
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

2 May 2011

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Flash Builder Flex RIA

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: Build an application in an hour
  • Flex Test Drive: Build an application in an hour
  • Flex Test Drive: Modify the database
  • 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
  • Flex Test Drive: Change the appearance of your application
  • Flex Test Drive: Change the appearance of your application
  • Flex Test Drive: Add charts and graphs
  • Flex Test Drive: Modify the database

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
07/25/2011 Flash Player Debug Issues - Safari 5.1 & Chrome 13
04/22/2012 Loader png - wrong color values in BitmapData
04/22/2012 HTTPService and crossdomain.xml doesn't work as expected
04/23/2012 Memory related crashes in Flex application

Flex Cookbook

More
04/06/2012 How to detect screen resize with a SkinnableComponent
02/29/2012 Embed Stage3D content inside Flex application components
02/15/2012 Custom WorkFlow Component
02/09/2012 Using Camera with a MediaContainer instead of VideoDisplay

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • 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

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement