Test tool: Selenium

Source: Internet
Author: User




Selenium is an acceptance testing tool ThoughtWorks specifically written for WEB applications.

One, according to Selenium home page, compared with other test tools, the greatest advantage of using Selenium is:
1. The Selenium test runs directly in the browser, just as the real user does.

2. Selenium testing can be run in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintoshand. None of the other test tools can cover so many platforms.
3. By writing a selenium test script that mimics the user's operation, the application can be tested from the perspective of the end user.
4. By running tests in different browsers, it is easier to find out the incompatibility of the browser.
Selenium consists of two modes: Testrunner and driven.
1, Testrunner

Testrunner's test scripts are written in an HTML language through a simple table layout, including commands (assertions), targets, and values of three. The assertion typically uses the ID or name of the component, but XPath and Dom locators are also supported.

For example:

<table>    <tr>     <td>open</td>      <td>/change_address_form.html</td>     <td></ td>    </tr>   <tr>     <td>type </td>     <td>address_field</td>     < Td>betelgeuse State prison</td>    </tr>   <tr>      <td>clickandwait</td>     <td>//input[@name = ' Submit ']</td>     <td></td>    </tr>    <tr>     <td>verifyTextPresent</td>      <td>address Change successful</td>     <td></td>     </tr>  </table> 
Test suites to achieve full test coverage of your application, you typically need more than one test case. This is why Selenium uses a test suite. Test suites are used to group a number of test cases with similar functionality so that they run sequentially.
Test suites, like test cases, are written in a simple HTML table. The name of the default test suite that selenium executes is testsuite.html. The following example shows a test suite that tests the application like a typical user.
Note that the test suite uses a table that contains only one column, and each row in the table points to a file that contains a test case.
For example:
<table>
<tr>
<td>test Suite for the whole application</td>
</tr>
<tr>
<td><a href= "test_main_page.html" >access_fcksavedurl= "test_main_page.html" >Access mainpage</a ></td>
</tr>
<tr>
<td><a href= "test_login.html" >login toapplication</a></td>
</tr>
<tr>
<td><a href= "test_address_change.html" >Changeaddress</a></td>
</tr>
<tr>
<td><a href= "test_logout.html" >logout fromapplication</a></td>
</tr>
</table>
2, driven

Driven Selenium scripts are written in one of several supported programming languages-Java, Ruby, and Python drivers are currently available. These scripts run in a separate process outside the browser. The task of the driver is to execute the test script and to drive the browser by communicating with the browser bot running in the browser. The communication between the driver and the browser bot uses a simple Selenium-specific connection language Selenese. Driven scripts are more powerful and flexible than Test runner scripts, and they can be integrated with the XUNIT framework. The disadvantage of the driven script (compared to the Test runner script) is that this script is more complex to write and deploy. This is because the driver must perform the following tasks: Start the server.
Deploy the application under test (AUT).
Deploy the test script.
Start the browser.
Send command to Browser bot.
Verifies the result of the command executed by the browser bot.
You can consult this number: 858568103, will provide you with some information to help you solve some problems.

Test tool: Selenium

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.