Using a Modular Approach: Recording Individual Scripts
By setting up the JSTs, you've specified all the scripts you need to write. Currently, you need to create:
- OpenFile
- ClearDisplay (used three times)
- EnterFieldData
- Add
- SaveDB
- OpenSearch
- DefineSearchString
- GetSearchResults
- VerifyRecord
- CloseSearch
- CloseDB
This may sound like a lot of scripts, but each is well-contained and quick to create.
Going into Create Test Script mode
- Select Create Test Script from the main menu.
- Enter
namedb
as the Class name and click Start.
JavaStar opens the Record/Playback window and the Name Database application. You may need to move the windows around to make sure you can see both the Record/Playback window and the Name Database window while you work.
Recording OpenFile
- Start recording a script named
OpenFile
.
Click Record and enter OpenFile
as the test name. Note that the Record with map files field is already filled in for you. Click OK.
- In the Name Database main window, click Open.
The file dialog opens.
- Navigate to the tutorial directory, select
test.db
and click Open.
- In the Record/Playback window, click Synchronize to enter Synchronization mode.
- In the Name Database main window, select the component by clicking on the Name Database - test.db text at the top of the window.
The selection code appears in the Synchronization panel, and the default method changes to Using text.
- In the Synchronization window, click Use default.
- Enter a purpose in the Why field.
For Why, type Proceed only if correct file loaded
.
- Click the Insert synchronization into test button.
This inserts the synchronization code into the script.
- Click Continue.
- Click Stop.
This completes the OpenFile
script.
Recording ClearDisplay
This simple script is used several times by JSTs, giving it immediate re-use potential.
- Start record mode and name the test
ClearDisplay
.
- In the Name Database main window, click Clear.
- Stop recording.
Recording EnterFieldData
- Start record mode and name the test
EnterFieldData
.
- Click in the Name text field and type
Count von Count
.
- Pressing Tab to advance to each field (except between Phone and Email, where you need to click inside the Email field to continue), complete the rest of the fields as shown:

Values for data entry fields
- Stop record mode.
Recording Add
- Enter record mode using the test name
Add
.
- In the Name Database main window, click Add.
- Stop record mode.
Recording SaveDB
- Enter record mode using the test name
SaveDB
.
- In the Name Database main window, click Save.
- Stop record mode.
Recording OpenSearch
- Enter record mode using the test name
OpenSearch
.
- In the Name Database main window, click Search.
- Stop record mode.
Recording DefineSearch
- Start record mode using
DefineSearch
as the test name.
- In the Search window, click on the select criteria choice list and choose address2.
- Enter the search string into the contain strings text field.
Type Transylvania
.
- Stop record mode.
Recording GetSearchResults
- Start record mode using
GetSearchResults
as the test name.
- In the Search dialog of the Name Database, click the Search button to perform the search.
- Verify the item count:
- Go into Verification mode.
Click Verify.
- Click in the search results list to select that component.
- Click Customize.
- Select Using simple methods and fields.
- Click the Select simple methods and data members button.
- Scroll through the method list and select
int getItemCount()
.
- Click Enter a purpose.
- Enter the purpose of the verification and click Insert verification into test.
- Click Continue.
- In the results list of the Search window, select the
Count von Count
record.
- Click View Result.
- Stop record mode.
Recording VerifyRecord
- Enter record mode using the test name
VerifyRecord
.
- Immediately enter Verification mode.
Click Verify.
- In the Name Database main window, select the first field to verify.
Click in the Name text field to select that component.
- Click Use default to accept using text as the method.
- Enter a purpose.
In the Why field, type Verify data entry
.
- Click the Insert verification into test button.
- For the remaining record fields (including the Telephone field):
- Click in the next field to select the component.
- Click Use default.
- Click Insert verification into test.
- Click Continue.
- Stop record mode.
Recording CloseSearch
- Enter record mode using the test name
CloseSearch
.
- In the Search window, click Close.
- Stop record mode.
Recording CloseDB
- Enter record mode using the test name
CloseDB
.
- In the Name Database main window, click Close.
- Stop record mode.
Quit Playback/Record
- Click the Quit button in the Playback/Record window and confirm your choice.
Send feedback to
JavaStar-feedback@suntest.com
Copyright © 1998
Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303.
All rights reserved.