Java™ME TCK FrameworkDevelopers GuideVersion 1.2July 2007Sun Microsystems, Inc.www.sun.com
x Java ME TCK Framework Developer’s Guide • July 2007
80 Java ME TCK Framework Developer’s Guide • July 2007OTATestClass name: com.sun.tck.midp.lib.OTATestThis is the base class for the Java SE technolog
81APPENDIXBFramework BundleThis appendix describes the contents of the redistributables directory provided bythe Framework bundle. The contents of the
82 Java ME TCK Framework Developer’s Guide • July 2007 tckbuild.jar - Utility classes used by TCK build. j2me-tck-framework_12.txt - Framework vers
Appendix B Framework Bundle 83CoreThe following are core Framework files provided in the lib directory: j2mefw_jt.jar - Harness plug-in code.Most of
84 Java ME TCK Framework Developer’s Guide • July 2007 cldc_agent.jar - Standard harness agent for CLDC.Application model: MainCommunication channel
Appendix B Framework Bundle 85 cldc_commClient.jar - Implementation of the Client interface for the CLDCdevice.This client uses HTTP for communicatio
86 Java ME TCK Framework Developer’s Guide • July 2007Application model: XletPluggable communication channel applet_agent.jar - JavaTest agent for P
Appendix B Framework Bundle 87Agent ClassesThe following are the agent classes and interfaces provided in the src directory: com/sun/cldc/communicati
88 Java ME TCK Framework Developer’s Guide • July 2007 com/sun/tck/midp/interview/VmAdvancedInterview com/sun/tck/midp/interview/VmInterview com/s
Appendix B Framework Bundle 89This class provides an implementation of the harness distribution mechanism ontop of HTTP. com/sun/tck/midp/javatest/Mi
xiTablesTABLE 1-1 Configurations and Supported Test Types 8TABLE C-1 Framework Test Description Fields 92TABLE C-2 Framework Keywords 94
90 Java ME TCK Framework Developer’s Guide • July 2007
91APPENDIXCTest Description Fields andKeywordsThis appendix describes the Framework supported fields and keywords for testdescription files.The JavaTe
92 Java ME TCK Framework Developer’s Guide • July 2007TABLE C-1 lists the test description fields supported by the Framework and describeshow their v
Appendix C Test Description Fields and Keywords 93executeArgs An array of strings that are passed to the test classes being executed. Thearguments mig
94 Java ME TCK Framework Developer’s Guide • July 2007KeywordsKeywords are tokens associated with specific tests. Keywords have the followingfunction
Appendix C Test Description Fields and Keywords 95runtime Identifies tests used with runtime products.trusted Identifies tests which must be run in a
96 Java ME TCK Framework Developer’s Guide • July 2007
97GlossaryThe definitions in this glossary are intended for Java Compatibility Test Tools (JavaCTT) and Java Technology Compatibility Kits (TCK). Some
98 Java ME TCK Framework Developer’s Guide • July 2007appeals process A process for challenging the fairness, validity, accuracy, or relevance of one
Glossary 99boundary valueanalysis A test case development technique that entails developing additional test casesbased on the boundaries defined by pr
xii Java ME TCK Framework Developer’s Guide • July 2007
100 Java ME TCK Framework Developer’s Guide • July 2007distributed tests Tests consisting of multiple components that are running on both the devicean
Glossary 101Java Platform, StandardEdition (Java SEplatform) A set of specifications that defines the desktop runtime environment requiredfor the depl
102 Java ME TCK Framework Developer’s Guide • July 2007JavaTest harness A test harness developed by Sun to manage test execution and result reportingf
Glossary 103included according to the referencing rules set out in that platform editionspecification. Other referenced specifications must be referen
104 Java ME TCK Framework Developer’s Guide • July 2007structure-basedtesting A set of test development methodologies that are based on the internalst
Glossary 105test commandtemplate A generalized specification of a test command in a test environment. The testcommand is specified in the test environ
106 Java ME TCK Framework Developer’s Guide • July 2007work directory A directory associated with a specific test suite and used by the JavaTestharnes
107IndexSymbols.jtx files, 100Aactive agent, 97active applet instance, 97agent, 97agent monitor, 97AID, 98all values, 97AMS, 98APDU, 98API, 98API membe
108 Java ME TCK Framework Developer’s Guide • July 2007Iinstantiation, 100interactive tests, 100ISO 7816-4, 98JJAM, 101JAR, 101Java Application Manage
Index 109work directory, 106
xiiiCode ExamplesCODE EXAMPLE 3-1 Simple Test Suite testsuite.jtt File 24CODE EXAMPLE 3-2 Simple Test Class 26CODE EXAMPLE 4-1 Required Distributed Te
110 Java ME TCK Framework Developer’s Guide • July 2007
xiv Java ME TCK Framework Developer’s Guide • July 2007CODE EXAMPLE 4-19 Test Description That Grants Permissions for a Security Test 65CODE EXAMPLE 4
xvPrefaceThis guide describes how to use resources from the Java™ Platform, Micro EditionTechnology Configuration Kit Framework (Framework) to develop
xvi Java ME TCK Framework Developer’s Guide • July 2007 JavaTest Harness User’s Guide: Graphical User InterfaceThis guide provides a description of u
Preface xviiPlatform CommandsThis document does not contain information about basic platform commands andprocedures such as shutting down the system,
xviii Java ME TCK Framework Developer’s Guide • July 2007Typographic ConventionsThis guide uses the following typographic conventions:Related Document
Preface xixAccessing Sun Documentation OnlineThe Java Developer Connection™ program web site enables you to access Javaplatform technical documentatio
PleaseRecycleCopyright 2007 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.Test suite develope
xx Java ME TCK Framework Developer’s Guide • July 2007
1CHAPTER1IntroductionThis chapter introduces using the Framework resources to develop test suites for theJava ME platform, including descriptions of t
2 Java ME TCK Framework Developer’s Guide • July 2007Note – The TCK Project Planning Guide and the Java Technology Test Suite DevelopmentGuide documen
Chapter 1 Introduction 3Development EnvironmentThe following tools and resources are the minimum software requirements for theFramework development en
4 Java ME TCK Framework Developer’s Guide • July 2007Configuration (CDC) and a profile such as Mobile Information Device Profile(MIDP), Foundation Pro
Chapter 1 Introduction 5Resource LimitationsHardware resources on test devices are often limited. Resource constrained devicescan quit operation when
6 Java ME TCK Framework Developer’s Guide • July 2007Framework BundleThe Framework resources are packaged and provided to users as a zip bundle.When t
Chapter 1 Introduction 7Framework Components on the Harness SideThe following components are used for running CLDC, MIDP, and CDC tests in theDistribu
8 Java ME TCK Framework Developer’s Guide • July 2007An agent is a separate program that works in conjunction with the harness to runtests on the devi
Chapter 1 Introduction 9Automated TestsAutomated tests for CLDC, MIDP, and CDC configurations execute on the testdevice without requiring user interac
iiiContentsPreface xv1. Introduction 1Getting Started 1Development Environment 3Use of the Framework 3Target Environment 3Connectivity Requirements 4R
10 Java ME TCK Framework Developer’s Guide • July 2007FIGURE 1-1 Framework Configuration for Standard Automated TestsDiagram of a standard automated t
Chapter 1 Introduction 11Distributed tests are typically slower (due to extra communication between remotecomponents) and more complex than simple aut
12 Java ME TCK Framework Developer’s Guide • July 2007Interactive TestsInteractive tests are the tests that require some form of user interaction and
Chapter 1 Introduction 13FIGURE 1-3 Framework Configuration for Interactive TestsDiagram of the interactive test configuration.OTA TestsOTA tests are
14 Java ME TCK Framework Developer’s Guide • July 2007OTA tests validate API functionality while the device is connected to a remote host(the PC or wo
15CHAPTER2Writing a Simple Automated TestAutomated test execution is the most common and simple of the test configurationsthat are run on the test dev
16 Java ME TCK Framework Developer’s Guide • July 2007 Each test case method must take no arguments, and must return a Status objectthat represents t
Chapter 2 Writing a Simple Automated Test 172. Save this file in the Simple Test Suite source asSimpleTestSuite/tests/pkg3/Test3.java.The pkg3 folder
18 Java ME TCK Framework Developer’s Guide • July 2007Note – The contents of this test description file correspond to the Test3.java testclass.4. Save
Chapter 2 Writing a Simple Automated Test 19Building an Updated Simple Test SuiteThe following steps demonstrate how to build an updated test suite af
iv Java ME TCK Framework Developer’s Guide • July 2007Writing an Automated Test 15▼ To Create a Simple Automated Test 16Building an Updated Simple Tes
20 Java ME TCK Framework Developer’s Guide • July 20073. Enter the ant command to invoke the ant build script.The build creates a SimpleTestSuite-buil
Chapter 2 Writing a Simple Automated Test 213. Use the Configuration Editor to provide configuration information required torun the updated test suite
22 Java ME TCK Framework Developer’s Guide • July 2007
23CHAPTER3Test Suite ConstructionThis chapter describes the organization and construction of a Java ME technologytest suite that uses Framework resour
24 Java ME TCK Framework Developer’s Guide • July 2007 lib directory tests directory classes directory doc directorytestsuite.jtt FileThe testsuit
Chapter 3 Test Suite Construction 25The testsuite.jtt file is located under the root directory of the Simple Test Suite.You can also find it under the
26 Java ME TCK Framework Developer’s Guide • July 2007Organize the tests hierarchically the way you want them displayed in the test tree.The Test Mana
Chapter 3 Test Suite Construction 27Additional examples (Test1.java and Test2.java)can be found in the following SimpleTest Suite directories: Simple
28 Java ME TCK Framework Developer’s Guide • July 2007The classes directory generally contains following sub-directories: classes/preverified - Conta
Chapter 3 Test Suite Construction 29In the test description file, $testHost and $testPort are test environmentvariables and are replaced by actual val
Contents vremote Attribute 44remoteSource Attribute 45executeArgs Attribute 45Distributed Test Execution 46Testing User Interfaces With Interactive Te
30 Java ME TCK Framework Developer’s Guide • July 20071. Define the environment variable required by the test.In the example (Test2.java), the test ca
Chapter 3 Test Suite Construction 31a. Create a class (SampleInterview) that is a subtype of the Interviewclass.The following code creates the SampleI
32 Java ME TCK Framework Developer’s Guide • July 2007d. Use the setFirstQuestion method in the constructor to specify the firstquestion in the sub-in
Chapter 3 Test Suite Construction 33f. Implement exporting the configuration value to the test environment.One of the goals of the interview is to exp
34 Java ME TCK Framework Developer’s Guide • July 2007h. Use the getNext() method to determine the next question in the sub-interview.Every question e
Chapter 3 Test Suite Construction 35j. Use the FinalQuestion marker to identify the last question in the sub-interview.At the end of the sub-interview
36 Java ME TCK Framework Developer’s Guide • July 20074. Update the interview .properties (resource) file.All question text is located in the intervie
Chapter 3 Test Suite Construction 37a. Create a help directory under the directory where the interview classes arelocated.For this example, use the fo
38 Java ME TCK Framework Developer’s Guide • July 2007d. Create a map file (sampleInterview.jhm)inthedefault directory.The JavaHelp system uses IDs fr
Chapter 3 Test Suite Construction 39e. Create the More Info topic files.The More Info topic files are provided in HTML format and displayed in theConf
vi Java ME TCK Framework Developer’s Guide • July 2007Marking Trusted Tests 62Using an Attribute to Mark Double-Duty Tests 63Granting or Denying Secur
40 Java ME TCK Framework Developer’s Guide • July 2007Building a Test SuiteRefer to Chapter 2, “Building an Updated Simple Test Suite” on page 19 for
41CHAPTER4Writing TestsThis chapter describes how to write different types of Java ME technology tests thatuse Framework resources and to set special
42 Java ME TCK Framework Developer’s Guide • July 2007Automated Test ExecutionFIGURE 4-1 and the associated text are for CLDC and MIDP execution mode.
Chapter 4 Writing Tests 43While the tests from the application bundle are loaded onto the device by theAMS, the execution server establishes the seque
44 Java ME TCK Framework Developer’s Guide • July 2007The client test component must use the send and handleMessage methods in theJ2MEDistributedTest
Chapter 4 Writing Tests 45The following is an example of the remote attribute entry that must be added to thetest description file.In the example, the
46 Java ME TCK Framework Developer’s Guide • July 2007The following is an example of the executeArgs attribute entry in which the$testMsgSwitch and $t
Chapter 4 Writing Tests 47FIGURE 4-2 Distributed Test Execution1. getNextApp - The AMS issues a getNextApp command to the execution serveron the works
48 Java ME TCK Framework Developer’s Guide • July 20075. Check or Send Message- The test sends either a message or a check messagerequest to the Frame
Chapter 4 Writing Tests 49Client Test ComponentThe client test component of the interactive test must extend theMidDistribInteractiveTest class. This
Contents viiCommServers 85Messaging 85Test Export Support Libraries 85CDC Agents 85src Directory 86Framework Server Classes and Interfaces 86Agent Cla
50 Java ME TCK Framework Developer’s Guide • July 2007The test description might also include the remoteSource and executeArgsattributes. See “remoteS
Chapter 4 Writing Tests 51FIGURE 4-3 Interactive Test Execution1. getNextApp - The AMS issues a getNextApp command to the execution serveron the works
52 Java ME TCK Framework Developer’s Guide • July 20074. Test Name - The execution server returns the name of the next test in theapplication bundle t
Chapter 4 Writing Tests 53Testing Application Provisioning WithOTA TestsOver-the-air (OTA) tests are MIDP-specific tests that verify an OTA applicatio
54 Java ME TCK Framework Developer’s Guide • July 2007done at the build time. If the test writer creates a JAR file or a JAD file with specialinformat
Chapter 4 Writing Tests 55remote AttributeThe remote attribute specifies the execution command for the server testcomponent. The following is an examp
56 Java ME TCK Framework Developer’s Guide • July 2007The following is an example of a test description for a trusted OTA test. See“remote Attribute”
Chapter 4 Writing Tests 57OTA Test ExecutionIn FIGURE 4-4, arrows indicate the direction of dataflow between the device and theworkstation. The number
58 Java ME TCK Framework Developer’s Guide • July 2007FIGURE 4-4 OTA Test Execution1. Request an Action - The server-side test requests an action from
Chapter 4 Writing Tests 59Example of OTA TestThe following is an example of an OTA server component. In the example, thesource of the MIDlet suite is
viii Java ME TCK Framework Developer’s Guide • July 2007
60 Java ME TCK Framework Developer’s Guide • July 2007Testing Security-ConstrainedFunctionality With Security TestsThis section addresses writing diff
Chapter 4 Writing Tests 61Trusted TestsTrusted tests verify API implementation behavior for signed MIDlet suites. In mostcases, these tests verify tha
62 Java ME TCK Framework Developer’s Guide • July 2007If other keywords (such as positive) are used, they would be included in the sameline as the unt
Chapter 4 Writing Tests 63The following is an example of adding a trusted keyword entry to a testdescription file.When other keywords (such as positiv
64 Java ME TCK Framework Developer’s Guide • July 2007Granting or Denying Security PermissionsA security test might require that certain permissions b
Chapter 4 Writing Tests 65The following is an example of a grant attribute and permissions added to a testdescription file.The value of the grant attr
66 Java ME TCK Framework Developer’s Guide • July 2007Denying Security PermissionsWhen writing security tests, a test writer can specify the permissio
Chapter 4 Writing Tests 67Adding Resource Files in TestsTest writers must sometimes develop tests that require extra resource files (such asimage, dat
68 Java ME TCK Framework Developer’s Guide • July 2007For example, the following test requires a Duke.png to create the Image object forsuccessful exe
Chapter 4 Writing Tests 69The following is an example of a test description file containing a resources entry,directory, and file name.CODE EXAMPLE 4-
ixFiguresFIGURE 1-1 Framework Configuration for Standard Automated Tests 10FIGURE 1-2 Framework Configuration for Distributed Tests 11FIGURE 1-3 Frame
70 Java ME TCK Framework Developer’s Guide • July 2007Enabling Test SelectionTest selection in a test run is of value to a user when a test suite incl
Chapter 4 Writing Tests 71 selectIf expression in test description - This mechanism provides a flexibleway for developers to make individual tests se
72 Java ME TCK Framework Developer’s Guide • July 20071. Add a selectIf entry to the test description file for a test class that usersmight be require
Chapter 4 Writing Tests 73<TR><TD SCOPE="row"> <B>selectIf</B> </TD><TD> isFeatureSupported </TD>&
74 Java ME TCK Framework Developer’s Guide • July 20072. Write an interview question that obtains the value of the environment variablefrom the user.T
Chapter 4 Writing Tests 753. Add interview question .smry and .text entries to the .properties file.For each added interview question, the developer m
76 Java ME TCK Framework Developer’s Guide • July 2007Question keys are created in the following form:interview-class-name.question-name The .smry en
77APPENDIXATest APIThe following is the Java ME technology-specific API that every test developer mustknow: Test Status MultiTest J2MEDistributedT
78 Java ME TCK Framework Developer’s Guide • July 2007A test must also define main as follows:Defining main in this manner enables the test to also b
Appendix A Test API 79J2MEDistributedTestClass name:com.sun.tck.j2me.services.messagingService.J2MEDistributedTestThis is the base class for distribut
Comments to this Manuals