Friday, December 16, 2016

Lesson #4 - Selenium IDE - Creating Your First test


After we covered the main theoretical aspects of selenium IDE, I think that you we can examine the practical side, for that reason I want to demonstrate a simple test case that covers few aspects that involve in the process of creating, configuring and saving test cases.

 

The Use case:

Access my LinkedIn account with Invalid credentials, and then insert a valid credentials 

The Algorithm:
  1. Open “Google” search engine.
  2. Type the website link (LinkedIn).
  3. Select the first result that returned from the search query.
  4. In the login site insert invalid credentials (In my case I typed Invalid password).
  5. Try to “Log-In” (Authentication failure).
  6. Insert a valid password
  7. Try to “Log-In” (Authentication Succeed).

 

Instructions:

  1. Open a new Firefox browser.
  2. Press Ctrl+Alt+S to start the selenium applications.
  3. Recording is started (Default).
  4. Perform the steps that I described in the algorithm stage.
  5. After step 7, navigate to the Selenium Grid and stop the recording process.

How this algorithm is reflected in the selenium grid? 

 

 



Command
Description
Html Code (Source TAB)
Open
Open the requested web browser (www.google.co.il)
<tr>
                <td>open</td>
                <td>https://www.google.co.il</td>
                <td></td>
</tr>
Type
In the google search grid we type the described value “LinkedIn”
<tr>
                <td>type</td>
                <td>id=lst-ib</td>
                <td>linkedin linkedin</td>
</tr>
ClickAndWait
Click on the first result that returned from the search query
<tr>
            <td>clickAndWait</td>
            <td>link=Sign In | LinkedIn</td>
            <td></td>
</tr>
Type
Under the credentials window , Inserting an Invalid password
(Value = e)
<tr>
                <td>type</td>
                <td>id=session_password-login</td>
                <td>e</td>
</tr>
Click
Click on the Login Button
<tr>
                <td>click</td>
                <td>id=btn-primary</td>
                <td></td>
</tr>
Type
Under the credentials window , Inserting a alid password
(Value = J)
<tr>
                <td>type</td>
                <td>id=session_password-login</td>
                <td>J</td>
</tr>
Click
Click on the Login Button
<tr>
                <td>click</td>
                <td>id=btn-primary</td>
                <td></td>
</tr>



How to Save and Load a test plan?

After the creation of our first selenium test case, it’s the time to learn how to reuse the code with the basic operations of “Save” and “Load”. 

Save a test case/Suite

To save a test case, please follow the next basic instructions:

Save:


  1. Select File - > Select “Save Test Case” (Equal to “Ctrl + s”).
  2. In the Save As dialog - > Enter the requested file name (in our case “Example 1”).
  3. Press “Save”

Save As:


  1. Select File - > Select “Save Test Case as”
  2. In the Save As dialog - > Enter the requested file name (in our case “Example 1”).
  3. Press “Save”

Save a Test Suite

Sometimes we have more than one test case, in that case we will need to use the save “Suite” command, and this command will save few test cases into one project.

  1. Select File - > Select “Save Test Suite”
  2. In the Save As dialog - > Enter the requested file name (in our case “Example 1”).
  3. Press “Save”

Load a test case/Suite

To Load a test case, please follow the next basic instructions:

 

Load Test Case


  1. Select File - > Select “Open” (Equal to “Ctrl +O”).
  2. In the “Select File” dialog - > select the relevant HTML file.

Load Test Suite


  1. Select File - > Select “Open Test Suite”.
  2.  In the “Select File” dialog - > select the relevant file.
 

No comments:

Post a Comment

My Presentations