SilkTest - PowerPoint PPT Presentation

About This Presentation
Title:

SilkTest

Description:

While the Library Browser gives you the proper Syntax for a given Method, it is very abstract. ... broken up into styles of pages such as 'Home', 'Expert' and ' ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 53
Provided by: hend158
Category:

less

Transcript and Presenter's Notes

Title: SilkTest


1
SilkTest Introduction to Automation
DS Hendler, Anna Medeiros , December 2000
2
What is SilkTest ?
  • SilkTest is
  • A powerful tool for running automated test cases
    on the front end
  • A tool for testing Web based applications across
    different browsers
  • Very very stupid you have to tell it everything
    in its own language (4test)
  • Inflexible when it comes to interpreting your
    commands
  • It cannot guess at what you mean
  • It requires a certain syntax with certain words
  • This can be quite maddening

3
What can you do with it ?
  • Mostly anything you can do in a Web browser, you
    can do with SilkTest.
  • Enter text in text fields
  • Click buttons
  • Check boxes
  • Get files
  • Clear your cache
  • etc.

4
Using a browser
  • Though SilkTest is its own product, you still
    have to use a browser to access your application
  • You have to tell SilkTest what kind of browser
    you are going to use for your testing so that it
    knows what it is looking at.
  • Our version of SilkTest supports Netscape 4, IE 4
    and IE 5.
  • Silk already knows what these browsers can do
    from a set of browser extensions, so you can run
    your automated cases in Netscape or IE
  • However, you can only run SilkTest on one
    instance of a browser at a time
  • -- One IE browser going at a time

5
Browser extensions
  • You choose your browser extensions in 2 places
    once on the computers where you are going to run
    SilkTest, and then in the program itself.
  • On the computer side, the extension chooser is
    called the Extension Enabler.
  • On the program side, the chooser is called the
    Extensions Manager

6
Extension Enabler
  • The Extension Enabler tells SilkTest what
    browsers you are going to use on your computer.
  • It is found under Start Menu / Programs/ SilkTest

7
Extensions Manager
  • The Extensions Manager is part of SilkTest.
  • Through it, you tell SilkTest what browser you
    are using.
  • The Extensions Manager is located in the menu
    under Options / Extensions

8
Extensions Manager
You should only choose one browser at a time
IE 5 is chosen here
9
Extensions Manager
  • When you choose a browser in the Manager,
    SilkTest tells itself what that browser can do.
  • It has the browsers abilities pre-programmed in.

10
Runtime Options
  • Runtime Options tell SilkTest where your files
    are and what browser you are using
  • This window is located under the menu Options /
    Runtime

11
Runtime Options
12
Types of files Include files
  • SilkTest uses 3 kinds of files
  • Include files (.inc)
  • Test files (.t)
  • Plan files (.pln)
  • (SilkTest creates a 4th type, the results file
    (.res), to display the outcome of a test case,
    but you do not create this file directly)
  • The include extension (.inc) means that the file
    is included in running a SilkTest process, but is
    not involved directly in running the process.
  • There are 3 types of include files
  • Frames
  • Functions
  • Tags
  • (Tags will be covered in a later class)

13
File Types Frame files
  • The frame file tells SilkTest what the Web
    application looks like
  • You will use the frame file already made for our
    application.
  • You point to a frame file through Runtime Options
    / Use Files

14
File Types Test Case files
  • Test case files (.t), or script files, tell
    SilkTest what you want it to do
  • All your test case files should be in the same
    file folder
  • You pointed to this folder through your Runtime
    Options / Use Path

Test case files
15
File Types Function files
  • Functions are a special kind of include file
    (.inc)
  • Functions act like a frame file, but look like a
    test case
  • They are single-purpose, often-used test case
    procedures that you store as an include file
  • They must exist in the same folder as your cases

16
File Types Coming Together
  • Frame, function and test cases come together in
    the test case file
  • You call functions in the test case by
    referencing them by their name

Test case file
Function file
More than one function can be called by a test
case
Frame file
17
File Types Plan files
  • Can can combine multiple test case files in a
    plan file (.pln)
  • A plan file is a collection of test cases
  • You can choose to run one, a few, or all of the
    cases in your plan

Lists script(s) to be used
Echoes Runtime Options information
Lists the cases and what they do in plain language
18
File Types Recap
  • SilkTest uses 3 types of files include, test
    case and plan files
  • The frame file tells SilkTest what the
    application looks like
  • The test case file refers to the frame file and
    tells the browser what to do
  • A function is a procedure that is used in many
    different cases
  • It is written like a test case, but saved like a
    frame file
  • A plan will help you organize many cases

19
Window Identifiers
  • Now that we have an idea what SilkTest needs to
    run a script, lets get a view into how SilkTest
    views the application.
  • In order to see how Silk views the application,
    we use the Window Identifiers tool
  • It is found in the tool bar under the Record /
    Windows Identifiers

20
Window Identifiers
  • Choosing the Window Identifiers launches the
    Record Window Identifiers tool

21
Window Identifiers -- Use
  • How to use the Window Identifiers tool
  • Hover your pointer over the object you want to
    view

22
Window Identifiers -- Use
  • With the information the Window Identifiers gives
    us, we know how the program views our application.
  • An HtmlPushButton, like all Html objects, has
    certain properties and functions you can perform
    on it
  • To find out what SilkTest will allow you do with
    this object, we use the Library Browser

23
Library Browser
  • The Library Browser gives you a list of all the
    object classes SilkTest recognizes as well as all
    the actions (called Methods) you can perform on
    those objects
  • It is found in the menu under Help / Library
    Browser

24
Library Browser / Help Topics
  • While the Library Browser gives you the proper
    Syntax for a given Method, it is very abstract.
  • An example, as well as a more detailed
    explanation, of the Method is given under the
    Help topics
  • Although you often have to do some digging to
    find the proper help topic.
  • It usually contains the word Method in the
    Help topic

25
Help Topics
  • The Help Topics give a more extensive explanation
    of the syntax of a Method, what it does, and
    important usage notes.
  • One of the more useful aspects of the Help Topics
    is the Example, which shows how you can use the
    Method in a script
  • (This example clicks an item labeled 3 in a
    list)

26
SilkTest Tools -- Recap
  • Use the Window Identifiers to see how SilkTest
    views a given object
  • Use the Library Browser to see what Methods you
    can perform on an object
  • Use the Help Topics to find Real Life examples,
    important notes on Methods, and detailed
    explanations of Syntax

27
Writing a Test Case
  • Remember that Test case files (.t), or script
    files, tell SilkTest what you want it to do
  • SilkTest requires the syntax you find in the
    Library Browser and Help Topic files in order to
    perform the tasks you want it to do.

28
Creating a Test Case
  • Choose File/ New to create a new test case
  • This window will open
  • Choose 4Test Script as the File Type and click
    the OK button

29
Writing the Test Case
  • Test cases are referenced by name
  • To create a test case called Search, type
    testcase Search () on the first line.

30
Fonts and Colors
  • As you type, you will notice that the color of
    your text changes, according to its function in
    the 4test language
  • The default colors for the 4test language are
  • Black code
  • Purple numbers (i 5)
  • Brown strings (This is a string)
  • Blue keywords (testcase Login)
  • Green Comments ( // this is a comment )

31
Viewing the Frame
  • Remember
  • The frame file tells SilkTest what the Web
    application looks like
  • You will use the frame file already made for our
    application.
  • You point to your frame file through Options
    /Runtime/ Use Files selection from the menu

32
Using the Frame
  • The frame tells you what items you have to work
    with in our application
  • You will be using a frame that has already been
    defined
  • It is broken up into styles of pages such as
    Home, Expert and Admin

33
Using the frame
  • When you write your test cases, refer to the
    frame file to determine what window identifiers
    to use.
  • Remember Methods such as Click and SetText
    can be found through the Library Browser.

34
Running the Test Case
  • To run the Test Case, click on the Green arrow or
    select Run/Testcase from the menu. A results
    file will appear once the test is complete.

35
Creating a Test Plan
  • Choose File/New to create a test plan.
  • Choose Testplan as the File Type and click the
    OK button

36
Adding a Test Case to a Test Plan
  • Right click on the plan and choose Test
    Detail from the menu.

37
Adding to a Plan (cont)
  • You may choose a script to add to the testplan.
    In this case Ive added the script created
    earlier.
  • To add a test case, click on the Testcases button
    and a list of test cases available in that script
    displays.

38
Adding to a Plan (cont)
  • Once you have your test cases set in the plan,
    you will need to separate them
  • Doing this process allows you to call only
    certain test cases you wish to run, as well as
    allowing yourself a more human description of
    your case
  • To do this, type your descriptive name
  • above your case name press the Enter key
  • Put your cursor on your test case line
  • Click the Right Arrow button in the toolbar to
  • indent your case

39
Adding to a Plan (cont)
  • Now that you have the Script and case information
    in your plan, you will have to add Header
    information.
  • This is the text that echoes what is written in
    the Runtime Options window.

40
Running Test Cases from the Test Plans
  • You can select certain cases to run by Marking
    them in the yellow bar in the Plan
  • To Mark the entire test plan, go to Testplan/Mark
    All from the menu
  • To Mark an individual test case, put your cursor
    by the test case you want to mark and go to
    Testplan/Mark from the menu. Or click on the
    Mark icon (the yellow square with the beside
    it)
  • The yellow box icons shown below (circled in red)
    allow you to mark and unmark test cases as well
    as find marked sections in your plan.
  • The green arrow icons shown below (circled in
    blue) allow you to run the entire test plan, test
    script or just a test case.

41
Verification
  • There are a variety of methods that can be used
    to get information on objects you are trying to
    verify.
  • To determine what these methods are, go to the
    Library Browser and choose the objects class you
    are trying to verify.

In this example I chose to find the methods
available for an HtmlLink
42
The Verify Function
  • The Verify Function is a simple way to check the
    information returned by a method.
  • Syntax
  • Verify (Actual Value, Expected Value, Error
    Message optional)
  • Example
  • Verify (Home.Browse.GetText (), Browse,
    Incorrect Text)
  • (Browse is an HtmlLink in our application.
    GetText () is one method available for HtmlLinks,
    as shown on the previous slide.)
  • The text returned by the GetText method is our
    actual value. Im expecting the word Browse to
    be returned. If it is not returned, the error
    Incorrect Text will be displayed in my results
    file.

43
The Verify Function
  • This is the Help Topics entry for the Verify
    function

44
Walkthrough Add a new user
  1. Create a new test script.
  2. Name the test case Type testcase AddUser ()
    on first line.

45
Walkthrough Add a new user (cont)
  • Using the frame in your handout we will write a
    test case to signup a new user. For example
  • // Test case to Add a new user
  • - testcase AddUser ()
  • Home.Login.Click ()
  • Home.SignUp.Click ()
  • Home.YourName.SetText ("Bob10")
  • (To write comments, use the // to comment your
    code. You can also go to Outline/(Un)comment
    Block from the menu to comment or uncomment
    sections of code.)
  • Add a verify function to confirm the user is
    logged in once it is created. (Ive also
    included the example Browse Verify function from
    our previous slide)

46
Completed Test Case
Complete sample test case.
47
Walkthrough Add test case to a plan
  1. Create a new test plan.
  2. Add the test script and test case using the Test
    Detail option.

48
Walkthrough Add test case a plan (cont)
  • Edit the test plan.
  • Add the heading information.
  • Separate the testcases so they can be marked
    separately.
  • Mark your test case and run it.

49
Completed Test Plan with results file
50
Exercise
  • Write a test case to login a user using this
    frame verify that the user is logged in.
  • You will find a more complete frame in your
    handout

51
Exercise
  • Write a test case to login a user using the
    previously given frame verify that the user is
    logged in
  • Results

52
SilkTest Automation Recap
  • We have learned
  • What SilkTest is and what its basic component
    parts are
  • How to get SilkTest to view a Web application
  • How to use a Frame
  • How to write a Test Case
Write a Comment
User Comments (0)
About PowerShow.com