Starting with Silk Test Automation

August 6, 2008

SilkTest Projects
• SilkTest projects organize all the resources associated with a test set and present them visually in the Project Explorer, making it easy to see, manage, and work within your test environment.

• Projects store relevant information about a project, including references to all the resources associated with a test set, such as plans, scripts, data, option sets, .ini files, results, and frame/include files, as well as configuration information, Editor settings, and data files for attributes and queries.

• Since you need to configure the project only once, you can simply open the project and run your tests.

• Create a new project yourself by adding the appropriate files to the project, or you can have SilkTest automatically create a new project from an existing file

SilkTest Test Plan
• Optional file that outlines test cases in suite. User can link scripts and test cases to each section of the test plan and run the selected cases from here.
• Master Test Plans can reference other test plans
• Able to import ASCII text file or Microsoft Word file format
• Mirror manual test plan that lists out the test cases
• Comments Section, denoted by //
• Group Description
• Logical Groupings of tests
• Test Description
• Statement of the functionality tested by test case
• Test Plan Statements
• Identify script files to be used
• Identify test case to use
• Identify test data to be used by test cases

Frame File
Photobucket
• Central, global repository of information pertaining to the Web application under test
• Contains information including window declarations, base states, constants and variables
• Lists tags used by SilkTest to recognize each web object
• Allows user to define logical descriptions (‘identifiers’) for each web object that can be referenced in test scripts
• Defines initial Web page SilkTest will load
• Has the .inc file extension

Setting up a Frame file…While SilkTest is running:
- Click File
- Select New…
- Select Test Frame and click OK
- Select opened browser window to record frame on and click OK
- Frame files are required for test suite
- Contains URL for SilkTest recovery system to use while running test cases
- Select Frame file:
- Options/Runtime
- In the Use Files field, add name of the test frame file through the use of the Add button.

A window declaration:
- Contains information about each web object contained in a web application, such as object classes and identifying tags
- Describes a window and all of its child objects
- Allows customized names to identify each web object
- Needs to be defined for each window that SilkTest will encountered during testing. (ie, the different control center pages)
- Must be declared after any BaseState code

Capturing a Window Declaration:
- Open test frame file
- Select Record/Window Declarations
- Position curser on page you wish to capture
- Press to pause tracking
- If necessary, modify identifier information
- Paste to Editor – new window declaration is inserted into frame file

Base States:
- Base States are the stable state you expect the Web application to be in before each testcase is executed

A Default Base State:
- Is created when a new frame file is recorded
- Ensures the default browser is running during the execution of testing scripts, browser is not minimized and browser is active
- Allows SilkTest’s recovery system to resume the execution of remaining test cases, should the previous test case fails
- Uses constant const sLocation stored in main window declaration of frame file to determine which window should be loaded

Application States:
- State you want your Web application to be in at the start of a given testcase
- For example, setting the browser to go directly to Control Center Login page.
- Can be based on DefaultBaseState or another application state
- Reduces redundant code
- Can be defined within the frame file or test script file
- Reuse existing application states to save effort, modularize routines, reduce maintenance

Create an Application State:
- Open frame file
- Select Record/Application State
- Enter name for new application state (no spaces)
- Select starting point for application state from other application states in listbox
- Start Recording
- When Record Status dialog appears and light is flashing green, drive application to desired new state
- Click Done
- Paste to Editor

Run Base STate:
-Open test frame file
-Select Run/Application State
- Select Application State from Application State list
- Click Run

Test Case/ Test Script
Photobucket
A Testcase:
- Is an automated test that tests one objective of the testplan
- Drives the application to the state where the test will be performed
- Verifies the application works as expected

A Test Script:
- Is the file containing test cases pertaining to the web application you are testing
- Has the .t file extension

Creating the Test Case:
- Ensure the test frame file is open
- Select File/New
- Select 4Test Script
- Click OK. A blank document should be displayed.
- Click File/Save As…Save file with .t extension
- Record or add testcases to the script file as needed

Recording an Action:
- Select Record/Testcase
- Enter name for testcase
- Choose starting point for testcase by selecting application state from listbox
- Click Start Recording – application should be driven to state elected
- Press . Capturing Properties dialog box displays progress bar.
- Review contents of Verify window to ensure correct object under test.
- In Properties to Verify list, check property you want to test.
- Click OK
- Click Done on Record Status Dialog
- Paste to Editor – testcase is appended to bottom of script file

Results File
Photobucket
Automatically generated by SilkTest
- .Res extension
- Failures occur when:
- Object does not meet verification requirements
- Web application has changed and testcase no longer valid for applications
- SilkTest encounters Windows or message boxes not expected by the recorded script

Previous post: Some Basic QA Tools for Web Pages

Next post: Getting Started with Silk Test