1. What is selenium?
Selenium is a powerful open-source Web function testing tool series of throughtworks. This series now mainly includes the following four:
1. Selenium core: supports DHTML test cases (similar to data-driven tests). It is the engine of selenium IDE and selenium RC.
2. Selenium ide: a plug-in of Firefox that supports script recording.
3. Selenium RC: Selenium remote control. I will introduce selenium RC in subsequent articles.
4. Selenium grid: Allows multiple test tasks to be run concurrently in different environments, greatly accelerating functional testing of Web applications.
2. select an appropriate selenium Tool
Since there are so many selenium tools, how should we choose ?? I found a table from "Selenium Official Website:
|
Selenium ide |
Selenium remote control |
Selenium Core |
Selenium core HTA |
Browser support |
Firefox only |
Many |
All |
Only IE |
Remote Installation required |
No |
No |
Yes |
No |
Support for HTTPS/SSL |
Yes |
Yes * |
Yes |
Yes |
Supports cross-Origin |
Yes |
Yes * |
No |
Yes |
Java |
No |
Yes |
No |
No |
Save test results to disk |
Yes |
Yes |
No |
Yes |
Multi-language support |
Selenese only |
Many |
Selenese only |
Selenese only |
Selenium grid is not introduced here, but another selenium core HTA is introduced. Selenium core HTA is actually an extra mode of selenium core. You only need to slightly modify the selenium core configuration to be In the HTA mode, selenium core HTA can work under the highest security level (privileged) of IE, which means it can only work under ie. Due to the large limitation, the discussion of selenium core HTA will be excluded below.
1. browser support:
(1). Selenium IDE can only work in Firefox.
(2) Selenium Remote Control supports many browsers, including the n most commonly used browsers, such as Firefox, ie, and safari.
(3) Selenium core supports the widest range of browsers, which is related to its implementation. As the engine of IDE and RC, selenium core can work in almost any browser.
2. Remote Installation is required: Do I need to install it on the server of the website under test?
Only selenium core is needed here, which is due to the same-origin policy. This is also a huge restriction on selenium core. If you want to test Google.com, You have to install a selenium core on the Google server.
Selenium IDE and selenium core HTA are not restricted by the same-source policy, because they expand the browser.
Selenium RC provides a code server to ensure that selenium JS files appear to come from the same remote server and comply with the same origin policy. The proxy server spoofs the browser and determines that there are indeed directories like http://www.google.com/selenium.
3. Support for HTTPS/SSL:
It is supported. Selenium RC adds * after "yes" because it is supported in the latest version.
4. Java: Specifically, JRE is required.
This is only required by selenium RC. The "Proxy Server" mentioned in above 2 is a Java program that needs to be started before running the test case.
5. Save the test results to the disk.
Only selenium core cannot write any test results to the disk (because it is written in Javascript, it cannot write data to the disk ), the solution is of course you can send the test results to another server to save. This is also a major limitation of selenium core.
6. multi-language support
(1) Selenium ide only supports selenium language.
(2) Selenium RC supports many languages, such as C #, Java, Python, and Ruby.
(3). Selenium core also only supports selenium language.
The selenium language test case is as follows:
It has the following advantages: it is simple. It uses three elements (command, target, value) to form an action and has auxiliary recording script tools (such as Firefox IDE and selenium core ), testers who do not understand the program can easily write test cases.
Its disadvantage is that selenese has some strict restrictions: it has no conditions (no "if" expression), and it has no loops (no "for" expression ). This makes it difficult or impossible to write complex tests.
OK. Now let's take a look at which tool to use for testing!
(1). Selenium ide supports only Firefox browsers. There are too few browsers supported, and it is not convenient to carry out automated tests in the future depending on Firefox. However, its recording is quick and easy to use! With the Code Conversion Function, you can convert selenium language test cases to C #, Java and other language test cases. I suggest using selenium ide + firebug to write test cases, then convert the test case to another language, and then call selenium RC to run the test case.
(2 ). selenium core, which has the advantage of being simple in writing test cases and supports a vast majority of browsers, but also has obvious disadvantages. Selenium core needs to be installed remotely, and the selenese language also limits the possibility of complex cases, and there is no good external expansion, which will be fatal. Because a testing tool cannot meet your testing needs by 100%. When it cannot meet your testing needs, it must have an extension mechanism that allows you to use other methods to meet your needs, otherwise, even if the test software has powerful functions, please use it with caution. Otherwise, some problems cannot be solved only after a large amount of resources are invested, and it is too late. This is my personal experience.
(3 ). selenium RC is a recommended tool. It supports many browsers and can use C #, Java and other languages to write test cases, which is easy to maintain and provides good scalability, therefore, selenium RC will be used as the default test tool in subsequent documents.
[Go] selenium Private food series 1 -- Introduction to Selenium