We continued to improve our testing during the Construction phase. Adding Raj to the team accelerated our adoption of automated tests. Raj created a test repository for automated acceptance tests and produced tests for the major use cases. This section shows an example of one such test, including the test script created by Rational XDE Tester and a test report. Recording a test with Rational XDE Tester is similar to recording tests with other test automation tools. You simply walk through the test case in the software while the testing tool records what you do and how the software reacts. During the test recording session you identify those actions or values that determine the success or failure criteria. With XDE Tester these are called verification points . When you have finished, the testing tool writes a script that can be played back whenever you want to retest the software, in this case PSP Tools. Listing 9.16 shows the script we created for testing the second use case. The script is written in Java. We are developing PSP Tools in Java, so reading and modifying the script requires little training time ”we don't have to learn a special scripting language just for testing. The code shown in Listing 9.16 performs the following operations:
Any Java programmer should be able to easily follow the code. Listing 9.16 Portion of test script for use case 2package Folder1; import resources.Folder1.UC2Helper; import com.rational.test.ft.*; import com.rational.test.ft.object.interfaces.*; import com.rational.test.ft.script.*; import com.rational.test.ft.value.*; import com.rational.test.ft.vp.*; /** * Description : XDE Tester Script * @author administrator */ public class UC2 extends UC2Helper { /** * Script Name : <b>UC2</b> * Generated : <b>Jun 3, 2003 9:40:41 PM</b> * Description : XDE Tester Script * Original Host : WinNT Version 5.0 Build 2195 (Service Pack 1) * * @since 2003/06/03 * @author administrator */ public void testMain (Object[] args) { // Insert Code Here try { // Frame: PSP Tools PSPMainFrame().click(); PSPMainFrame().click(); menubar().click(atPath("File")); menubar().click(atPath("File->Open...")); // Filename().click(); JDialog().inputChars("d:\pspproject\project1"); Open().click(); // PSPLoginDialog().click(); passwordtext().click(); PSPLoginDialog().inputChars("psp"); Login().click(); // Frame: PSP Tools tree().click(atPath("project1")); menubar().click(atPath("Project")); menubar().click(atPath("Project->New Task...")); // TabbedPage: Task text().click(); PSPMainFrame().inputChars("task2"); AddTask().click(); tree().click(atPath("project1->task2")); tree().click(atPath("project1->task2->Location(PLUS_MINUS)")); tree().click(atPath("project1->task2->Time Details")); tree().click(atPath("project1->task2->Defect Details")); tree().click(atPath("project1->task2")); menubar().click(atPath("Project")); menubar().click(atPath("Project->Delete Task")); // Yes().click(); // Frame: PSP Tools menubar().click(atPath("File")); menubar().click(atPath("File->Close")); logInfo("Use Case 3 Passed"); } catch(Exception Ex) { logError("Use Case 3 Failed"); } } } When you finish running a test, a test report is written as an HTML page. See Figure 9.4 for a sample test report page. By creating HTML output, which many test tools do, you can make the results available to the whole team by publishing the results immediately on a Web site. Figure 9.4. Sample test report
|