|
Wireless applications written in the Java programming language (wireless Java applications), like all other types of software, must be tested to ensure functionality and usability under all working conditions. Testing is even more important in the wireless world because working conditions vary a lot more than they do for most software. For example, wireless Java applications are developed on high-end desktop machines but deployed on handheld wireless devices with very different characteristics. The aim of this article is to help you test your wireless applications. The article:
Overview of Software TestingSoftware testing is a systemic process to find differences between the expected behavior of the system specified in the software requirements document and its observed behavior. In other words, it is an activity for finding errors in the software system. There is no one agreed-upon goal of software testing. One school of thought describes the goal of testing as demonstrating that errors are not present. Dijkstra (1930 - 2002) describes the goal of testing as showing the presence of faults but not their absence. The ultimate goal, however, is to find errors and fix them so users can be confident that they can depend on the software. Errors (also known as bugs or glitches) in software are generally introduced by people involved in software development (including analysts, architects, designers, programmers, and the testers themselves). Examples of errors include:
Many developers view the subject of software testing as "not fashionable," and as a result too few of them really understand the job software testers do. Testing is an iterative process and should start from the beginning of the project. Software developers need to get used to the idea of designing software with testing in mind. Some of the new software development methodologies such as eXtreme Programming stress incremental development and testing. eXtreme Programming is ideally suited for some types of applications, depending on their size, scope, and nature. User interface design, for example, benefits highly from rapid prototyping and testing usability with actual users. One way to make testing simple is to design applications with testing in mind. Organizing the system in a certain way can make it much easier to test. Another implication is that the system must have enough functionality and enough output information to distinguish among the system's different functional features. It is now common to describe a system's functional requirements (features that the system must provide) by using the Unified Modeling Language (UML) to create a use case diagram, then detailing the use cases in a consistent written form. Documenting the various uses of the system in this way simplifies the task of testing the system by allowing the tester to generate test scenarios from the use cases. The scenarios represent all expected paths users will traverse when they use the features that the system must provide. Developers distinguish these functional requirements from system requirements not related to particular functionality, constraints related to performance, configuration, and usability. Testing Activities The testing that needs to be performed can be split into two classes: functional (black-box) testing and structural (white-box) testing. In black-box testing, each of the components -- and ultimately the system as a whole -- is treated as a black box, and testers verify that it supports all the features identified (often as use cases) in the requirements documents. Black-box testing activities include:
Black-box testing concerns itself with externally visible behavior, and ignores the source code. In white-box testing, the focus is on the code that produces the behavior. One common white-box testing activity is path testing, also known as code coverage. Its goal is to identify faults in the implementation by exercising all possible paths through the code at least once. Testers check that every branch in the code has a test that exercises that branch.
Fortunately, you don't have to draw flow graphs for your code by hand, as several code coverage tools are readily available. Challenges of Testing Wireless ApplicationsThe wide variety of Java technology-enabled devices such as wireless phones and PDAs results in each device running a different implementation of the CLDC and MIDP. Varying display sizes add to the complexity of the testing process. In addition, some vendors provide proprietary API extensions. As an example, some J2ME vendors may support only the HTTP protocol, which the MIDP 1.0 specification requires, while others support TCP sockets and UDP datagrams, which are optional. To make your application both portable and easy to test, design it using standardized APIs defined through the Java Community Process (JCP), so it will run as-is on devices with different J2ME implementations. If you feel you must use vendor-specific extensions, design your application in such a way that it defaults to the standard APIs if it's deployed on a device that doesn't support the extensions. Testing Wireless Java ApplicationsThe testing activities described above are applicable to testing wireless Java applications. In other words, you perform unit or class testing, then you integrate components and test them together, and eventually you test the whole system. In this section I provide guidelines for testing wireless applications. Validating the Implementation Ensuring that the application does what it's supposed to is an iterative process that you must go through during the implementation phase of the project. Part of the validation process can be done in an emulation environment such as the J2ME Wireless Toolkit, which provides several phone skins and standard input mechanisms. The toolkit's emulation environment does not support all devices and platform extensions, but it allows you to make sure that the application looks appealing and offers a user-friendly interface on a wide range of devices. Once the application has been tested on an emulator, you can move on to the next step and test it on a real device, and in a live network. Usability Testing In usability testing (or GUI navigation), focus on the external interface and the relationships among the screens of the application. As an example, consider an email application that supports entry and validation of a user name and password, enables the user to read, compose, and send messages, and allows maintenance of related settings, using the screens shown in Figure 1, among others.
In this example, start the test at the Login window. Enter a user name and a password and press the soft button labeled Login. Enter a valid user name and password. The application should display the main menu. Does it? The main menu should display a SignOut button. Does it? Press the SignOut button. Does the application return to the Login screen? Write yourself a note to raise the question, "Why does the user 'log' in but 'sign' out?" Now enter an invalid user name or incorrect password. The program should display a meaningful message box with an OK button. Does it? Press the OK button. Does the application return to the Login screen? You need to test the GUI navigation of the entire system, making notes about usability along the way. If, for example, the user must traverse several screens to perform a function that's likely to be very popular, you may wish to consider moving that particular function up the screen layers. Some of the questions you should ask during usability testing include:
The MIDP Style Guide provides helpful hints about user interface design. Network Performance Testing The goal of the next type of testing is to verify that the application performs well in the hardest of conditions (for example, when the battery is low or the phone is passing through a tunnel). Testing performance in an emulated wireless network is very important. The problem with testing in a live wireless network is that so many factors affect the performance of the network itself that you can't repeat the exact test scenarios. In an emulated network environment, it is easy to record the result of a test and repeat it later, after you have modified the application, to verify that the performance of the application has improved. Server-Side Testing
It is very likely that your wireless Java applications will communicate with server-side applications. If your application communicates with servers you control, you have a free hand to test both ends of the application. If it communicates with servers beyond your control (such as Automating Unit Testing One of the unit-testing tools most widely used by Java developers is the JUnit framework. A similar framework for J2ME unit testing is J2MEUnit. Here is a sample test:
When using J2MEUnit in your testing, you need to:
J2MEUnit provides two test runners that allow you to run your tests, collect results, and display them:
Debugging Information
Adding debugging information in your code is very important. You can display trace points, values of variables, and other information during testing and debugging. One way to minimize the tedium of writing
You can easily use the The J2ME Wireless Toolkit provides a debugger that's easy to use. If you use the Sun ONE Studio 4, Mobile Edition, see the article Debugging Wireless Applications with Mobile Edition for useful guidance. Testing ChecklistsThis section provides checklists you will find useful when testing your application, in both emulation and live environments. These checklists include tests that are usually performed in the Motorola Application Certification Program, described a little later in the article. Navigation Checklist
Network Checklist
Other Important Issues
Certification ProgramsSeveral certification programs for J2ME applications are available. The two most widely known at this writing are those sponsored by Motorola and Nokia. Motorola The Motorola Application Certification Program is designed to promote consistent user interface and high standards of operation in J2ME wireless applications. The benefits of the certification program cited by Motorola are:
Note that this certification program is not free (check the pricing information); but it is a good way to form a partnership with an important vendor.
To get Motorola to certify your J2ME application, you must schedule a test by submitting a package -- a MIDlet suite or a single MIDlet -- online at
For more detailed information on the certification process and the fees involved, check out the Motorola Certification Application Program. If your J2ME application meets all the certification requirements, Motorola will provide you with the "Motorola Compatible" logo, and will place your application and user manual on Motorola's application distribution server. If your J2ME application does not achieve certification the first time you submit it, you can fix the problems and resubmit (for an extra charge). Nokia The Nokia OK Program is a testing and evaluation process for third-party applications that run on Nokia mobile devices. Once an application completes the process, it is granted the Nokia OK designation, meaning that the application has met the Nokia standards and can be used on Nokia products with confidence. The benefits of the program according to Nokia include:
The certification process is similar to Motorola's. It is less expensive, but not free. For more detailed information, visit the Nokia OK Program. ConclusionTesting is a systematic approach to finding errors in programs. It is a very challenging process in the wireless application market because an application is developed on one platform and deployed on ones that are vastly different. The process is complicated even further by the availability of a wide range of devices that implement different versions of the KVM, CLDC, and MIDP, and that provide extension APIs not available on all devices. To achieve the maximum portability, verify that your applications use the standard APIs. This article also provided guidelines and checklists to help you test your wireless Java applications. For more information
AcknowledgmentsSpecial thanks to Gary Adams of Sun Microsystems for his contributions to this article. Back To Top | |||||||||||||||||||||||||||||||||
|
| ||||||||||||