JavaTest™ Architect’s Guide JavaTest Harness Sun Microsystems, Inc. www.sun.com March 10, 2009 02-2009 Copyright©2009SunMicrosystems,Inc.,4150NetworkCircle,SantaClara,California95054,U.S.A.Allrightsreserved. SunMicrosystems,Inc.hasintellectualpropertyrightsrelatingtotechnologyembodiedintheproductthatisdescribedinthis document.Inparticular,andwithoutlimitation,theseintellectualpropertyrightsmayincludeoneormoreoftheU.S.patentslistedat http://www.sun.com/patentsandoneormoreadditionalpatentsorpendingpatentapplicationsintheU.S.andinothercountries. THISPRODUCTCONTAINSCONFIDENTIALINFORMATIONANDTRADESECRETSOFSUNMICROSYSTEMS,INC.USE, DISCLOSUREORREPRODUCTIONISPROHIBITEDWITHOUTTHEPRIOREXPRESSWRITTENPERMISSIONOFSUN MICROSYSTEMS,INC. U.S.GovernmentRights-CommercialSoftware.GovernmentusersaresubjecttotheSunMicrosystems,Inc.standardlicense agreementandapplicableprovisionsoftheFARanditssupplements. Useissubjecttolicenseterms. Sun,SunMicrosystems,theSunlogo,Java,Jini,JavaTest,JAR,JDK,Javadoc,JavaME,JavaSEandJavaCompatibilityTestToolsare trademarksorregisteredtrademarksofSunMicrosystems,Inc.oritssubsidiariesintheU.S.andothercountries. UNIXisaregisteredtrademarkintheU.S.andothercountries,exclusivelylicensedthroughX/OpenCompany,Ltd. TheAdobelogoisaregisteredtrademarkofAdobeSystems,Incorporated. THISPRODUCTISCOVEREDANDCONTROLLEDBYU.S.EXPORTCONTROLLAWSANDMAYBESUBJECTTOTHE EXPORTORIMPORTLAWSINOTHERCOUNTRIES.NUCLEAR,MISSILE,CHEMICALBIOLOGICALWEAPONSOR NUCLEARMARITIMEENDUSESORENDUSERS,WHETHERDIRECTORINDIRECT,ARESTRICTLYPROHIBITED.EXPORT ORREEXPORTTOCOUNTRIESSUBJECTTOU.S.EMBARGOORTOENTITIESIDENTIFIEDONU.S.EXPORTEXCLUSION LISTS,INCLUDING,BUTNOTLIMITEDTO,THEDENIEDPERSONSANDSPECIALLYDESIGNATEDNATIONALSLISTSIS STRICTLYPROHIBITED. Copyright©2009SunMicrosystems,Inc.,4150NetworkCircle,SantaClara,California95054,États-Unis.Tousdroitsréservés. SunMicrosystems,Inc.détientlesdroitsdepropriétéintellectuellerelatifsàlatechnologieincorporéedansleproduitquiestdécrit danscedocument.Enparticulier,etcesanslimitation,cesdroitsdepropriétéintellectuellepeuventinclureunouplusieursdesbrevets américainslistésàl’adressesuivante:http://www.sun.com/patentsetunouplusieursbrevetssupplémentairesoulesapplicationsde brevetenattenteauxÉtats-Unisetdanslesautrespays. CEPRODUITCONTIENTDESINFORMATIONSCONFIDENTIELLESETDESSECRETSCOMMERCIAUXDESUN MICROSYSTEMS,INC.SONUTILISATION,SADIVULGATIONETSAREPRODUCTIONSONTINTERDITESSANSL’ AUTORISATIONEXPRESSE,ÉCRITEETPRÉALABLEDESUNMICROSYSTEMS,INC. DroitsdugouvernementdesÉtats-Unis-LogicielCommercial.LesdroitsdesutilisateurdugouvernementdesÉtats-Unissontsoumis auxtermesdelalicencestandardSunMicrosystemsetauxconditionsappliquéesdelaFARetdecescompléments. L’utilisationestsoumiseauxtermesdelicence. Sun,SunMicrosystems,lelogoSun,Java,Jini,JavaTest,JAR,JDK,Javadoc,JavaME,JavaSEetJavaCompatibilityTestToolssontdes marquesdefabriqueoudesmarquesdéposéesenregistréesdeSunMicrosystems,Inc.ousesfiliales,auxÉtats-Unisetdansd’autres pays. UNIXestunemarquedéposéeauxÉtats-Unisetdansd’autrespaysetlicenciéeexlusivementparX/OpenCompany,Ltd. LelogoAdobeestunemarquedéposéedeAdobeSystems,Incorporated. Ceproduitestsoumisàlalégislationaméricaineenmatièredecontrôledesexportationsetpeutêtresoumisàlarèglementationen vigueurdansd’autrespaysdansledomainedesexportationsetimportations.Lesutilisationsfinales,ouutilisateursfinaux,pourdes armesnucléaires,desmissiles,desarmesbiologiquesetchimiquesoudunucléairemaritime,directementouindirectement,sont strictementinterdites.Lesexportationsouréexportationsverslespayssousembargoaméricain,ouversdesentitésfigurantsurles listesd’exclusiond’exportationaméricaines,ycompris,maisdemanièrenonexhaustive,lalistedepersonnesquifontobjetd’unordre denepasparticiper,d’unefaçondirecteouindirecte,auxexportationsdedesproduitsoudesservicesquisontrégisparlalégislation américainesurlecontrôledesexportationsetlalistederessortissantsspécifiquementdésignés,sontrigoureusementinterdites. Please Recycle Contents Preface xvii 1. Introduction 1 Examples 2 Part I The Basics 2. JavaTest Tutorial 5 Start the JavaTest Harness 6 Quick Start Wizard 7 Configure the Test Information 8 Run Tests 10 Browse the Results 12 The Folder Pane 12 The Test Pane 14 Exclude the Failed Test 16 Generate a Report 17 Summary 18 3. Overview 19 Remote Execution 22 iii 4. Creating a Test Suite 25 Create a Test Suite Directory 26 Create thetestsuite.jtt File 26 Copyjavatest.jar 27 Set Up theclasses Directory 27 Create a Test 28 Run the Test Suite 31 Odds and Ends 31 Top-Level Test Suite Directory 32 The Test Suite JAR File 33 Class Paths 34 5. Writing Tests 37 The Test Execution Model 37 TheTest Interface 38 Class Paths 39 Test Status 40 Test Description Entries 41 Keywords 42 Multiple Tests in a Single Test File 43 Subtyping MultiTest 44 Organizing Tests Within Your Test Suite 44 Source Files 45 Class Files 45 Error Messages 46 6. Creating a Configuration Interview 47 Designing Your Configuration 47 What is a Configuration? 47 iv JavaTest Architect’s Guide • March 10, 2009 Test Script Information 48 Test Description Entries 48 Which Tests to Run 49 Designing Your Interview 49 Command Strings 50 Example 1 50 Example 2 52 Test Environment Variables 53 Writing Your Interview 53 Interview Classes 54 The Current Interview Path 55 Determining the Next Question 55 Error Checking 56 Exporting the Test Environment 56 Question Types 57 Designing Your Questions 60 Landing Point Questions 60 Sub-Interviews 60 Putting it all Together 62 Providing the Prolog 65 Providing the Environment Group 66 Providing the Resource File for the Interview 66 Providing the More Info Help for the Interview 66 Creating Question Text and More Info 67 Writing Style 67 Creating Question Text and Keys 69 Creating More Info 70 Set Up the More Info System 70 Contents v For Each Question in Your Interview 72 Customizing Standard Question More Info 73 Creating the JAR File 73 Part II Advanced Topics 7. Compiling Test Suites 77 8. The TestSuite Object 81 Thetestsuite.jtt File 81 Overriding Default Methods 85 9. Test Finder 87 Tag Test Finder 87 HTML Test Finder 89 Binary Test Finder 90 BinaryTestWriter 91 BinaryTestFinder 92 10. Test Scripts 95 Design Decisions 95 Simple Test Scripts 95 More Flexible Test Scripts 97 Writing Custom Commands 99 Test Result 100 11. Service Management 103 Description 103 Services-Related Work Flow 105 Implementation 106 Implementation ofServiceReader Interface 107 vi JavaTest Architect’s Guide • March 10, 2009 Implementation ofService Interface 108 Service Properties 109 Service Management Architecture 111 Mechanism to InstantiateService,Connector, andServiceExecutor Interfaces 114 Separate Services Start Up 114 12. Running JUnit Tests 117 The Retrofit Process 117 Prerequisites for Converting Tests 118 ▼ Procedure for Converting Tests 118 Technical Details 120 Support Classes 120 JUnitSuperTestFinder 121 JUnitAnnotationTestFinder 122 JUnitBareMultiTest 123 JUnitAnnotationMultiTest 123 Implementation Notes 123 Areas for Improvement 124 References 124 13. Customization 127 Customizing the Splash Screen 127 Example ofsplash.properties File 128 Notes About the Implementation 128 A. Standard Commands 129 ActiveAgentCommand 130 Usage 130 Arguments 130 Contents vii Description 131 Examples 132 See Also 132 ExecStdTestSameJVMCmd 133 Usage 133 Arguments 133 Description 134 Examples 134 See Also 134 ExecStdTestOtherJVMCmd 135 Usage 135 Arguments 135 Description 136 Examples 136 See Also 136 JavaCompileCommand 137 Usage 137 Arguments 137 Description 137 Examples 138 See Also 138 PassiveAgentCommand 139 Usage 139 Arguments 139 Description 140 Examples 141 See Also 141 ProcessCommand 142 viii JavaTest Architect’s Guide • March 10, 2009 Usage 142 Arguments 142 Description 142 Examples 143 See Also 143 SerialAgentCommand 144 Usage 144 Arguments 144 Description 145 Examples 146 See Also 146 B. Formats and Specifications 147 Test URL Specification 147 Test Paths 148 Exclude List File Format 149 Syntax 149 Test URL and Test Cases 150 BugIDs 151 Keywords 151 Synopsis 151 Comments and Header Information 151 C. What Technical Writers Should Know About Configuration Interviews 153 Question Text 154 More Info 155 Formatting Styles 156 Usage and Conventions 157 Glossary 159 Contents ix Index 165 x JavaTest Architect’s Guide • March 10, 2009
Description: