-
Java™ ME TCK Framework Developers Guide Version 1.2 Sun Microsystems, Inc. www.sun.
-
Copyright 2007 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved. Test suite developer’s guide for the Java ME TCK Framework. THIS PRODUCT CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF SUN MICROSYSTEMS, INC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SUN MICROSYSTEMS, INC. U.S. Government Rights—Commercial software. Government users are subject to the Sun Microsystems, Inc.
-
Contents Preface 1. xv Introduction Getting Started 1 1 Development Environment Use of the Framework 3 3 Target Environment 3 Connectivity Requirements Resource Limitations Framework Bundle 4 5 6 Framework Components 6 Framework Components on the Harness Side Framework Components on the Device Side Test Types 7 8 Automated Tests 9 Distributed Tests 10 Interactive Tests OTA Tests 2.
-
Writing an Automated Test ▼ 15 To Create a Simple Automated Test Building an Updated Simple Test Suite ▼ ▼ 3. 19 To Build an Updated Test Suite Testing an Updated Simple Test Suite To Test an Updated Test Suite Test Suite Construction Test Suite Structure 19 20 20 23 23 testsuite.
-
remote Attribute 44 remoteSource Attribute executeArgs Attribute Distributed Test Execution 45 45 46 Testing User Interfaces With Interactive Tests Client Test Component 48 49 Remote Test Component 49 Test Description for Interactive Tests 49 Required Interactive Test Keywords Interactive Test Execution 50 50 Example of an Interactive Test 52 Testing Application Provisioning With OTA Tests Server Component of an OTA Test 53 Client Test Component of an OTA Test Test Description for OTA Tes
-
Marking Trusted Tests 62 Using an Attribute to Mark Double-Duty Tests Granting or Denying Security Permissions Granting Security Permissions 64 Denying Security Permissions 66 Adding Resource Files in Tests Enabling Test Selection 70 selectIf Test Selection A.
-
CommServers Messaging 85 85 Test Export Support Libraries CDC Agents src Directory 85 85 86 Framework Server Classes and Interfaces Agent Classes 87 Digital Signer 87 Preverification Script 86 87 Java ME Technology Version of Harness Classes 87 Basic Interview Classes Containing General Questions Communication Channel doc Directory C.
-
viii Java ME TCK Framework Developer’s Guide • July 2007
-
Figures FIGURE 1-1 Framework Configuration for Standard Automated Tests FIGURE 1-2 Framework Configuration for Distributed Tests 11 FIGURE 1-3 Framework Configuration for Interactive Tests 13 FIGURE 1-4 Framework Configuration for OTA Tests FIGURE 4-1 Automated Test Execution 42 FIGURE 4-2 Distributed Test Execution 47 FIGURE 4-3 Interactive Test Execution 51 FIGURE 4-4 OTA Test Execution 10 14 58 ix
-
x Java ME TCK Framework Developer’s Guide • July 2007
-
Tables TABLE 1-1 Configurations and Supported Test Types TABLE C-1 Framework Test Description Fields TABLE C-2 Framework Keywords 8 92 94 xi
-
xii Java ME TCK Framework Developer’s Guide • July 2007
-
Code Examples CODE EXAMPLE 3-1 Simple Test Suite testsuite.
-
CODE EXAMPLE 4-19 Test Description That Grants Permissions for a Security Test CODE EXAMPLE 4-20 deny Attribute in the Test Description CODE EXAMPLE 4-21 Test Description That Denies Permissions for a Security Test CODE EXAMPLE 4-22 Test That Requires an Image Resource CODE EXAMPLE 4-23 resources Attribute in the Test Description CODE EXAMPLE 4-24 Test Description That Includes Resources CODE EXAMPLE A-1 run Method CODE EXAMPLE A-2 Definition of main 78 CODE EXAMPLE A-3 Test Case Method xi
-
Preface This guide describes how to use resources from the Java™ Platform, Micro Edition Technology Configuration Kit Framework (Framework) to develop and configure test suites and tests for Java Platform, Micro Edition (Java ME platform) technologies.
-
■ JavaTest Harness User’s Guide: Graphical User Interface This guide provides a description of using the harness Graphical-User Interface (GUI). This guide is available from the Java ME Technology APIs and Docs web site at http://java.sun.com/javame/reference/apis.jsp. ■ JavaTest Harness User’s Guide: Command-Line Interface This guide provides a description of using the harness command-line interface. This guide is available from the Java ME Technology APIs and Docs web site at http://java.sun.
-
Platform Commands This document does not contain information about basic platform commands and procedures such as shutting down the system, booting the system, and configuring devices. Refer to the following for this information: ■ Software documentation that you received with your system ■ Solaris™ Operating System documentation at http://docs.sun.
-
Typographic Conventions This guide uses the following typographic conventions: Typeface* Meaning Examples AaBbCc123 The names of commands, files, and directories; on-screen computer output Edit your .login file. Use ls -a to list all files. % You have mail. AaBbCc123 What you type, when contrasted with on-screen computer output % su Password: AaBbCc123 Book titles, new words or terms, words to be emphasized. Replace command-line variables with real names or values.
-
Accessing Sun Documentation Online The Java Developer Connection™ program web site enables you to access Java platform technical documentation at http://java.sun.com/. Sun Welcomes Your Comments We are interested in improving our documentation and welcome your comments and suggestions. Provide feedback to Sun at http://java.sun.com/docs/forms/sendusmail.
-
xx Java ME TCK Framework Developer’s Guide • July 2007
-
CHAPTER 1 Introduction This chapter introduces using the Framework resources to develop test suites for the Java ME platform, including descriptions of the kinds of tests that a test suite can include.
-
Note – The TCK Project Planning Guide and the Java Technology Test Suite Development Guide documents were originally developed as part of a product used by the Java Community Process (JCP) Specification Leads. For that reason, these documents refer to JCP procedures that might not apply to a test developer’s Framework project.
-
Development Environment The following tools and resources are the minimum software requirements for the Framework development environment: ■ JDK, version 5.0 or later ■ JavaTest harness, version 3.2.2 or later For TCK development, download the latest Java Compatibility Test Tools (Java CTT) from the Java Community Process (JCP) program web site.
-
Configuration (CDC) and a profile such as Mobile Information Device Profile (MIDP), Foundation Profile (FP), Personal Basis Profile (PBP), or Personal Profile (PP). ■ Configuration - CLDC and CDC are configurations that provides a basic set of libraries and virtual-machine features that must be present in an implementation of a Java ME environment.
-
Resource Limitations Hardware resources on test devices are often limited. Resource constrained devices can quit operation when excess native resources are requested. The Framework can run tests on resource constrained target devices with limited available memory and persistent storage.
-
Framework Bundle The Framework resources are packaged and provided to users as a zip bundle. When the bundle is unzipped the following directories and files are placed in the Framework root directory: ■ doc - Contains the Java ME TCK Framework Developer’s Guide (PDF and HTML formats). ■ redistributables - Contains the following directories: ■ ■ javame_tck_framework_12/src - Contains the source files.
-
Framework Components on the Harness Side The following components are used for running CLDC, MIDP, and CDC tests in the Distributed, OTA, and Automated test configurations with the harness: ■ Execution server - Used in CLDC and MIDP Distributed and Automated test configurations. The execution server contains no internal test-related logic. Its only function is to forward data. It is as lightweight as possible.
-
An agent is a separate program that works in conjunction with the harness to run tests on the device. In CDC, the agent is started once, and when started, in a loop, it uses the communication channel to the harness to download the test classes and to execute them on the device, and then reports back the results.
-
Automated Tests Automated tests for CLDC, MIDP, and CDC configurations execute on the test device without requiring user interaction. Automated tests can be queued up and run by the test harness and their results recorded without the user being present. The configuration for standard automated test execution is the most common and the most simple of the tests that are run on the device. Automated tests are also the most convenient and the fastest tests for a user to run, since they are fully automated.
-
FIGURE 1-1 Framework Configuration for Standard Automated Tests PC or Workstation Device JavaTest Harness 1 getNextApp 2 Application Bundle AMS (agent + tests) 3 getNextTest Execution Server 4 Test Name Agent 5 sendTestResult Tests Diagram of a standard automated test configuration. Distributed Tests Distributed tests are a special type of automated tests.
-
Distributed tests are typically slower (due to extra communication between remote components) and more complex than simple automated tests and should be used only when it’s not possible to write simple automated tests. FIGURE 1-2 illustrates the Framework configuration for running CLDC and MIDP distributed tests. Distributed tests are currently not supported in CLDC (without MIDP).
-
Interactive Tests Interactive tests are the tests that require some form of user interaction and cannot be executed without such interaction. From a design point of view, interactive tests are a subtype of distributed test. As a subtype of distribute test, interactive tests generally execute on the test device under the control of a component called an agent. However, unlike distributed tests, interactive tests also require some form of user interaction as a part of the test.
-
FIGURE 1-3 Framework Configuration for Interactive Tests PC or Workstation JavaTest Harness Device 1 getNextApp Application Bundle 2 (agent + tests) Execution Server 3 getNextTest AMS 4 Test Name 11 Send Test Result Passive Agent Agent Server-Side Test Messaging Service 9 7 8 5 Check/Send Message Tests 6 Get Message Request an Action (if interactive) 10 Requested Action Diagram of the interactive test configuration.
-
OTA tests validate API functionality while the device is connected to a remote host (the PC or workstation where the harness runs). In this configuration, one part of the OTA test runs on the remote host (the PC or workstation where the harness runs) using a passive agent and the other part of the test runs on the device. OTA tests require user interaction as a part of each test. FIGURE 1-4 illustrates the Framework configuration for running OTA tests.
-
CHAPTER 2 Writing a Simple Automated Test Automated test execution is the most common and simple of the test configurations that are run on the test device. User interaction is not required to run automated tests. The following instructions describe how to create a simple automated test and add it to an existing Framework supplied test suite.
-
■ Each test case method must take no arguments, and must return a Status object that represents the outcome of the test case. The Status can be either Status.passed(String) or Status.failed(String). ■ Developers must update the runTestCases() method to add the test cases that are executed. This is a CLDC-MIDP specific method (the abstract method is defined in CLDCspecific MultiTest). For CDC-specific Multitest, this method is not required because reflection is available on CDC stacks.
-
*/ public class Test3 extends MultiTest { protected void runTestCases() { if (isSelected("helloWorld")) { addStatus(helloWorld()); } } public Status helloWorld() { String message1 = new String("Hello World !"); String message2 = new String("Hello World !"); ref.println("message1: "+message1); ref.println("message2: "+message2); if (!message2.equals(message1)) { return Status.failed("Failed: see ref for details"); } return Status.passed("OK"); } } 2.
-
executeClass | sample.pkg3.Test3 |
keywords | runtime positive |