This book shows how to understand what application you want to write, what strategies are likely to get you there, and then how to measure your level of success. This book offers practical, concrete advice about how to stay in tune with your project and ensure that your products are at least as good as your plans.
—Phil Goodwin, Staff Engineer at Sun Microsystems.
Produce scalable, reliable, high-performance Web-enabled applications in Java
Web infrastructure is everywhere. And yet until this book there was no guide to show how your choices in design, coding, and testing impact the scalability, performance, and functionality of your Web-enabled applications.
Java Testing and Design: From Unit Testing to Automated Web Tests teaches you a fast and efficient method to build production-worthy, scalable, and well performing Web-enabled applications. The techniques, methodology, and tools presented in this book will enable developers, QA technicians, and IT managers to work together to achieve unprecedented productivity in development and test automation.
With Java Testing and Design, you will be prepared for a laundry list of new APIs, protocols, and tools being packed into the next generation of J2EE, .NET, and open-source systems. While these new software libraries, tools, and techniques are a big move forward for all of us, they push us to learn even more technology to turn out complex, highly functional, and interoperable software applications.
Author Frank Cohen shares proven best practices based on his extensive experience at leading enterprises (General Motors, BEA, AMP, 2Wire, Elsevier, U.S. Navy, Sun) and delivers an immediately useful set of open-source tools, techniques, and code that will automate the testing of your Web-enabled applications.
Coverage includes:
- Software development and test automation methodologies
- Exposes the scalability problems in SOAP-based Web Services
- Building, testing, and monitoring integrated multiple-protocol Web-enabled applications
- Performance kits for developers using BEA WebLogic, IBM WebSphere, and Sun Java System (formerly Sun ONE)
- Architecture, code, and test agents for J2EE, Web Services, P2P, and .NET
- Secure Internet services using current and next-generation technologies and much more!
Table of Contents
Foreword.
Preface.
Acknowledgments.
I. GAUGING WEB-ENABLED APPLICATIONS
1. The Forces at Work Affecting Your Web-Enabled Software.
The First Three Axioms. Web-Enabled Applications, the New Frontier. Why Writing High-Quality Software Today Is Hard. The Myth of Version 2.0 Solidity. Management's Quest for Grail. Trying for Homogeneity When Heterogeneity Rules. The Language of Bugs. The Evil Twin Vice Presidents Problem. A Concise History of Software Development. Web-Enabled Applications. Test Paradigms and Lifecycle Processes. Testing Methods. Click-Stream Testing. Unit Testing. Functional System Testing. Scalability and Performance Testing. Quality of Service Testing. Defining Test Agents. Scalability and Performance Testing with Test Agents. Testing for the Single User. Creating Intelligent Test Agents. Automated Testing. Summary.
2. When Application Performance Becomes a Problem.
Just What Are Criteria? Defining Criteria for Good Web Performance. Are the Features Working? Is Performance Acceptable? How Often Does It Fail? Web-Enabled Application Measurement Tools. The Web Rubric. The Four Tests of Good Performance. Components of a Good Test Agent. Web-Enabled Application Types. The Web-Enabled Application Points System (WAPS). The Web-Enabled Application's Framework. The Flapjacks Architecture. Adopting Flapjacks and Intelligent Test Agents. Building Intelligent Test Agents in a Flapjacks Environment. Script Languages and Test Agents. Generating Meaningful Data. Summary.
3. Modeling Tests.
Modeling User Behavior for Meaningful Test Results. Lifecycles, Projects, and Human Nature. The Micromax Lifecycle. Categorizing Problems. Prioritizing Problems. Reporting Problems. Criteria for Evaluating Problems. Considerations for Web-Enabled Application Tests. Functionality and Scalability Testing. Functional Testing. Scalability Testing. Testing Modules for Functionality and Scalability. Management Styles. Service Level Agreements. Grid Computing and Intelligent Agents. The Road to Easy Setup, Use, and Maintenance. Self-Healing Systems. Understanding Performance and Scalability Criteria. Defining SPC. SPC in Action. Modeling a User's Goals. Test States. Using UML and Code Comments to Model Tests. Putting the Test Together. Summary.
4. Java Development and Test Automation Tools.
The Three Waves. Desktop Application Development and Test Automation. Client/Server Development and Test Automation. Web-Enabled Development and Test Automation. Achieving the Troika—the Fourth Wave. A Test Automation Lifecycle. Summary.
5. Bridging from Methodology to Design.
Searching for Tools to Enable the Troika. How to Get TestMaker. TestMaker and the Open Source Process. Spending Five Minutes with TestMaker. Installing TestMaker on a Windows or Linux Computer. Running TestMaker. Getting to Know the TestMaker Graphic Environment. Opening and Running Test Agents. Building Agents with the New Agent Wizard. Why I Like Jython. 1. Jython Is Quick. Data Structures and List Iteration Come for Free. 3. Dynamic Variables with Automatic Typing. 4. Functions Are First Class. 5. Java Integration. 6. Bean Property Introspection. 7. Sun Is Adopting Scripting in Java. Using Jython to Incorporate JUnit. JUnit for Repeatable Tests. A JUnit Example. JUnit and TestMaker. Summary.
II. COMPONENTS, INTEROPERABILITY, AND OPTIMIZATION
6. Design And Test In HTTP/HTML Environments.
The HTTP/HTML Environment. What Usually Goes Wrong. Compliance, As in Non, and Browser Caching. Invalid Data. Session Problems. Constructing HTTP Test Agents. Hands-On HTTP Communication. Understanding Cookies, Sessions, and Redirection. Validating Response Data. Summary.
7. Tuning SOAP and XML Web Services.
The Web Services Vision. XML-RPC for Web Interoperability. Where XML-RPC Falls Short. Universal Interoperability with SOAP. Web Service Scalability Techniques. Web Service Interoperability Problems. Discovery. Definition. Request/Response. On the Horizon. Using TestMaker to Understand WSDL. Constructing SOAP Calls. Different Types of SOAP Calls. Validating Response Data. Making It Easier to Write Agents. Resources. Summary.
8. State, Design, and Testing.
A Question of State. Lifecycle for Testing Stateful Systems. Techniques to Establish State. Preparation and Setup Agents. Setup_agent. Using Databases to Configure Tests. Using Lingo to Make Test Content Close to Real. Summary.
9. Integrating with .NET Web Services.
Interoperability and Integration. How Is .NET Different? Document-Style Scalability. SOAP Headers in .NET. WSDL .NET Style. A Test Agent for .NET Environments. Near Term Considerations. Summary.
10. Building and Testing Intranets and Secure Environments.
Getting a Head Start. Security by Routing. Virtual Private Networks. Network Segments and Subnets. Transport Security. SOAP over SSL. .NET Passport Authentication. HTTP Basic Authentication. SOAP and Security. Generating Certificates and KeyStores. The Java Keytool. Summary.
11. A Web Application Framework from Construction to Test.
The Trading Desk and Intelligent Test Agents. Scalability Test Goals. System Infrastructure. User Archetypes. Understanding the Test Requirements. Constructing the Test. Implementing User Archetypes in Code Modules. Implementing the Master Component. Setup. Run. Cleanup. Property Files for Test Configuration. Implementing the Logging Component. Avoiding Test Scalability Problems. A First Look at the Results. Summary.
12. Turning Test Agent Results into Actionable Knowledge.
What to Expect from Results Analysis. Goal: Our New Web Site Needs to Handle Peak Loads of 50 Concurrent Users. Goal: The Web Site Registration Page Needs to Work Flawlessly. Goal: Customer Requests for Month-End Reports Must Not Slow Down the Order-Entry Service. Goal Summary. The Big Five Problem Patterns. Resource Problems. Concurrency Problems. Component Problems. Contention Problems. Crash Recovery Problems. Key Factors in Results Analysis. Scenarios Where Results Data Misleads. The Node Problem. The Hidden Error. Dileep's Dilemma. Diminishing Returns. Back to the Stock Trading Example. Implementing the Tally Agent. Summary.
III. CASE STUDIES: BUILDING RELIABLE APPLICATIONS.
13. Concurrency and Scalability In A High-Volume Datacenter.
Introduction. The 2Wire Component Management System. Understanding What Happens over the Wire. Testing in a Complex Environment. The Test Method. Test Environment Considerations. Constraints in the Test Environment. Summary.
14. Making the Right Choices for SOAP Scalability.
Why is SOAP So Popular? SOAP Encoding Styles. Simple Object Access Needs Simple Testing. Should You Let the Tools Do the Driving? May I Freak Out Now? The Performance Kit. How Do I Get the Performance Kit? Installing the Performance Kit. Getting Started. Some Other Things We Found. Summary.
15. Multiprotocol Testing in an Email Environment.
Needs and Benefits. Scoping the Project. Test Design and Methodology. User Archetypes. Installation and Configuration. From Archetypes to Test Agent Scripts. Building Muriel. Building Marilyn. Result Analysis. Summary.
Index.
Downloadable Sample Chapter
Download the Sample
Chapter related to this title.