Documente Academic
Documente Profesional
Documente Cultură
ii
Contents
Automate a manual test that is based on keywords . . . . . . . . . . . . . . 1
Introduction: Automate a manual test that is based on keywords . . . . . . . . . . . . . Module 1: Use keywords to create a manual test . Lesson 1: Create a manual test project . . . . Lesson 2: Create keywords. . . . . . . . Lesson 3: Create a manual test script using keywords . . . . . . . . . . . . . Lesson 4: Create a datapool . . . . . . . Lesson 5: Reuse keywords in a new manual test script . . . . . . . . . . . . . . . Module 2: Create automated functional test scripts and associate them with keywords . . . . . . . . . . 1 2 2 2 Lesson 1: Create a functional test project and associate it with a manual test project . . . Lesson 2: Record scripts based on predefined keywords . . . . . . . . . . . . Lesson 3: Publish automated scripts . . . Module 3: Run scripts . . . . . . . . . Lesson 1: Run a partially automated keyword-enabled test script . . . . . . Lesson 2: View the test log . . . . . . Summary: Automate a manual test that is based keywords . . . . . . . . . . . . . . . . . . 8 . 8 . 10 . 11
. 4 . 5 . 6 . 7
. . 12 . . 12 on . . 13
iii
iv
Learning objectives
After completing this tutorial, you will be able to use keywords to automate a manual test.
Time required
60 minutes Related information View the PDF version Tutorial: Create a functional test Tutorial: Create a data-driven functional test
Learning objectives
After completing this tutorial, you will be able to: v Define keywords in a manual test environment v Use the keywords in a manual test script v Create automated test scripts and associate them with the keywords in a functional test environment v Run keyword-enabled manual test scripts from your manual test environment v View test logs Note: Consider printing the tutorial before you begin and using the printed copy as you work through the lessons. You can either print the PDF version of the tutorial or print each individual lesson by right-clicking inside each topic and clicking Print.
Time required
This tutorial takes approximately 60 minutes to finish. If you explore other concepts related to this tutorial, it might take longer to complete.
Prerequisites
You must have both Rational Functional Tester and Rational Manual Tester installed on your computer.
Learning objectives
After completing the lessons in this module, you will understand how to do the following tasks: v Create a manual test project and keyword library v Create keywords v Create a manual test script using keywords v Create a datapool v Reuse keywords in other manual test scripts
Time required
This module takes approximately 15 minutes to complete.
Prerequisites
This module requires that you to have Rational Manual Tester installed on your computer.
You are now ready to define new keywords in the keyword library.
A keyword is a reusable manual test statement or group of manual test statements. Keywords can be reused in other test scripts within the project and shared with other members of your test team. You can also associate these keywords with automated test scripts. To create new keywords: 1. Optional: By default, the Keyword view is open. If not, select Window Show View Keywords to open the Keyword view. 2. In the Keyword view, click the New Keyword icon ( ). 3. Type the name of the keyword included in the following table in the Name field and click OK.
Table 1. Keyword Start application Order CDs Steps Start the application Select a composer Select a CD title Click Place Order Login as an existing customer Select the customer [[Customer name]] Type xxxx in the Password field Click OK Specify details and place order Enter a credit card number, for example, 7777777777777777 Enter an expiration date, for example, 07/017 Click Place Order Verify order Verify that the order is for the correct customer
After you create a new keyword, it opens in the Script Editor. 4. Type the keyword step statements for the keyword in the Script Editor from Table 1. 5. Click File Save to save the keyword. 6. Repeat this process for each keyword listed in Table 1 7. After you define all the keywords, the Libraries View will show:
4. Click File Save. 5. Type the name of the script as AutomateKeywordTutorial.rmt and click OK. The saved script is displayed in the Project explorer under the Script folder.
Add data
To add data to the datapool: 1. Right-click in the Datapool Editor and select Add Variable.
Automate a manual test that is based on keywords
2. Type Customer name in the Name field. 3. Right-click in the Datapool Editor and select Add Record. The addition of a new record is indicated by a record number in the Datapool Editor. 4. Double-click the cell next to the record number and type the record value. Create the following two records: v Trent Culpito v Susan Flontly 5. Click File Save to save the datapool.
You now have a new script that contains common keywords. Although the first script you created in a previous lesson will log in to the test application as an existing customer, the new script will log in as a new customer.
Module 2: Create automated functional test scripts and associate them with keywords
In this module you learn how to create automated functional test scripts in Rational Functional Tester and associate the scripts with keywords. This module is divided into three lessons that must be completed in sequence for the tutorial to work properly.
Learning objectives
After you complete the lessons in this module you will understand how to do the following: v Create a functional test project and associate it with a manual test project v Record automated test scripts based on predefined keywords v Publish automated test scripts
Time required
This module takes approximately 30 minutes to complete.
Prerequisites
This module requires that you have both Rational Manual Tester and Rational Functional Tester installed on your computer.
Lesson 1: Create a functional test project and associate it with a manual test project
In this lesson, you create a functional test project and associate it with a manual test project. In order to view the keywords defined in a manual test project in Functional Tester, you must associate a functional test project with a manual test project. Start Rational Functional Tester and then perform the following tasks before you record your first test script. To 1. 2. 3. 4. create a new functional test project and associate it with a manual test project: Click File New Functional Test Project. Under Project name, type FTKeywordtutorial (no spaces). Under Project location, type C:\FTKeywordproject. Functional Tester creates this directory. Select Associate the project to a Manual Test Project.
5. Under Manual Test Project Location, type C:\KeywordProject\AutomateKeywordTutorial. Alternatively, you can browse to your manual test project location and select the project. 6. Under Manual Test Project Name, type AutomateKeywordTutorial. 7. Click Finish. The FTKeywordtutorial project is displayed in the Functional Test Projects view, which is the left pane in the Functional Test perspective. The Keyword Library view displays the keywords.
Start application
To create an automated script for the keyword Start application: 1. In the Keyword Library view, right-click the Start application keyword and click Record. 2. Click Finish. 3. In the Recording Monitor toolbar, click the Start Application icon ( ). 4. Select ClassicsJavaA and click OK. The Functional Tester sample application, ClassicsCD, opens. 5. In the Recording Monitor toolbar, click the Stop Recording icon ( ).
A new functional test script Startapplication is created and displayed in the Functional Test Projects view. Important: Leave the test application open. This is required to record scripts for the rest of the keywords.
Order CDs
To 1. 2. 3. 4. 5. 6. create an automated script for the keyword Order CDs: In the Keyword Library view, right-click the Order CDs keyword and select Record. Click Finish. Click the + next to Haydn to expand the folder in the Composers tree. In the list, click Symphonies Nos. 94 & 98. Select Order Place New Order in the ClassicsCD toolbar, . In the Recording Monitor toolbar, click the Stop Recording icon ( ).
A new functional test script OrderCDs is created and displayed in the Functional Test Projects view.
).
A new functional test script Specifydetailsandplaceorder is created and displayed in the Functional Test Projects view.
Verify order
To create an automated script for the keyword Verify order: 1. In the Keyword Library view, right-click the Verify order keyword and select Record. 2. Click Finish. 3. In the ClassicsCD application, click Order View Existing Order Status. Do not click either of the password fields at this time. 4. Click OK. You will test the label Order for Trent Culpito in the View Existing Orders window. 5. In the Recording Monitor, click the Insert Verification Point or Action Command button ( ). 6. In the Select an Object page, select After selecting an object advance to next page. 7. Drag the Object Finder over the label Order for Trent Culpito to select it. While holding down the mouse button, note that the label is outlined with a red border and the object name is displayed (javax.swing.JLabel). After you select the object, the Select an Action page opens because you opted in the previous step to advance to next page. 8. Select Perform a Properties Verification Point, which is the second action from the top, and then click Next. 9. Accept the suggested default on the Insert Properties Verification Point Command page and click Next. Note: Make sure that the Include Children field is set to None.
10. In the Property column select the text, opaque, and visible properties to test them during playback. You may have to click the check box twice for the selection to persist. 11. Click Finish. 12. In the ClassicsCD View Existing Orders window, click Close. 13. Close the ClassicsCD application by clicking the x button. 14. In the Recording Monitor toolbar, click the Stop Recording icon ( ).
A new functional test script Verifyorder is created and displayed in the Functional Test Projects view.
A new functional test script Loginasnewcustomer is created and displayed in the Functional Test Projects view.
).
A new functional test script Specifycustomerdetails is created and displayed in the Functional Test Projects view. You now have automated scripts for all the keywords.
10
Note: By default, the automated scripts are copied to the manual test project parent directory. 3. Click Finish. You are ready to execute the manual test scripts and all associated automated scripts from Rational Manual Tester.
Learning objectives
After you complete the lessons in this module you will understand how to do the following tasks: v Run a partially automated keyword-enabled test script
Automate a manual test that is based on keywords
11
Time required
This module takes approximately 15 minutes to complete.
Note: Notice that the script runs for a second time with a different customer name from the datapool. When the test run is complete, a log is displayed in the Project Explorer under the Logs folder.
12
To 1. 2. 3.
view a test log: In the Project Explorer, expand the Logs folder. Double-click the log that you want to view. The log opens in the Log Viewer. Click the Events tab to view results of individual test statements.
Notice that the manual keyword statements have different icons than keywords that are associated with automated scripts.
Lessons learned
By completing this tutorial, you learned how to perform the following tasks: v Define keywords v Create and associate automated test scripts with keywords v Run keyword scripts v View and analyze logs
Additional resources
If you want to learn more about the topics that are covered in this tutorial, consult the following resources: v Functional Tester Help v Manual Tester Help v Functional Tester Welcome Page v Manual Tester Welcome Page Related information ibm.com eclipse.org
13