Cainiao automated testing (1) ---- selenium ide

Source: Internet
Author: User
By wormhole, 29122 reading, 13 comments, favorites, Edit
---- // Preface

For our new users, automated testing has always been a relatively advanced field, of course, relative to manual testing. Recently, I was interested in automated testing. No, the specific point should be the interest in the selenium tool. Why is it not qtp? I have studied qtp before, and I also bought this advanced guide for qtp automated testing. After reading this document for a few days, I don't know why I can't continue. Well! I have always preferred open-source technologies and tools. We first used lR for performance testing. Later we found that after the jmeter tool, basically we could solve the problem with jmeter, so we didn't use LR anymore. There are many advantages to open source, and of course there are also many shortcomings. Here we will not be embarrassed. Haha.

Let's talk about selenium! If you want to learn something, finding relevant learning materials is the first step. Let's talk about the information I think is better: Selenium Private food series, selenium official documents, selenium 1.0 testing tools. However, I bought a book and posted my comments on Dangdang.

"I wanted to buy it. Later I heard from my friends that the content has a very large line spacing and has the meaning of gathering the number of pages. The previous part is the document on the official website of selenium, including the following? Have practical experience in writing the author's company. It's basically the same as what a friend says. Why did I buy it again later. There are not many Chinese documents of selenium, and the online documents are scattered. I am very poor at English. Therefore, the English documents seem too hard. Selenium 1.0 testing tools is actually a good book, but unfortunately there is no Chinese, but it can be done slowly, but selenium 2.0 has come out, selenium RC has been replaced by selinum server, A lot of new technologies have been added to keep up with you. Therefore, I can only select this book, hoping to help me. "My notes are based on the book" zero-cost automated Web Testing-Based on seleinum and bromine.

---- // Understand the IDE panel

For installation of selenium IDE, refer to my previous article "Selenium RC configuration".

For convenience and conciseness, we will follow the numerical mark introduction:

1.File: Create, open, and save test cases and test cases.Edit: Copy, paste, delete, undo, and select all commands in the test case.Options: Used to set seleniunm IDE.

2. Enter the address of the website to be tested.

3. Speed control: control the running speed of the case.

4. Run all: Run all cases in a test case set.

5. Run: run the selected test case.

6. Pause/resume: pause and resume test case execution.

7. One step: You can run a line of commands in one case.

8. Recording: Click it to record your browser operations.

9. List of case sets.

10. Test script; Table label: displays commands and parameters in the form of tables. Source Tag: The Source tag is displayed in the original format, which is in HTML format by default. It can also be displayed in other languages.

11. View the number of failed or failed scripts.

12. Command parameters before election.

13. Log/reference/UI element/Rollup

Logs: errors and information are displayed automatically when you run the test.

Reference: When you enter and edit the selenese command in the table, the corresponding reference document is displayed on the panel.

UI element/rollup: see UI-element documentation in the Help menu.

 

---- // Edit the command

The recording script recorded by selenium is not 100% that meets our needs. Therefore, editing the recording script is essential.

1. edit a command line or comment.

Select a command line under the table label. The command consists of command, target, and value. You can edit these three parts.

2. Insert command.

Right-click a command and select the "Insert new command" command to insert a blank field and edit the blank line process.

3. Insert Annotation

In the same way as above, right-click and select the "Insert new comment" command to insert the annotation blank line. The content of this line is not executed, which can help us better understand the script, the inserted content is displayed in purple.

4. Move commands or annotations

Sometimes we need to move the order of a certain line of command, we just need to left click and drag to the corresponding position.

 

---- // Record our first script

Our recording process:

Open a new tag with Firefox ----- enter Google URL (http://www.google.com.hk/) ---- enter: Selenium in the search box ---- click the Google search button.

Note: Enable and disable the Red Circle recording button on the selenium ide panel.

Recorded script:

 

---- // Debug the script

1. Set the breakpoint.

To set a breakpoint, select a command line, right-click, select "toggle breakpoint" from the drop-down menu, and click "run". The script stops running at the breakpoint. I have used the debug function of myecilpse to debug scripts!

2. debug the script through the page source code

In many cases, debugging of automated test cases is inseparable from viewing the page source code. We can use Firefox's firebug tool, about firebug installation (browser menu bar --- tools --- view components --- Search firebug --- install and restart the browser ).

For example, we are not sure or want to get the properties of Google search buttons. Right-click the button and choose View element.

In the firebug tool opened below the browser, you can view the button code.

 

3. Positioning assistance

When recording a script by selenium IDE, it stores additional information and allows you to select Locators of other formats to replace the default format. This special feature is useful for learning locators.

We can choose other commands to replace the "name = btng" command. Of course, the script can still be run.

These are some basic things about selenium IDE. The next article is in preparation.

End:

Cainiao automated testing (1) ---- selenium ide

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.