Automated Testing implementation (2)

Source: Internet
Author: User

On this day, I forgot about the automation knowledge again. Compared with the mainstream testing tools, selenium is the final test tool. In terms of tool selection, you still need to pay attention to user usage and documentation.

Why not use qtp? No other, no money = #

Then I captured selenium's knowledge and recorded two scripts with IDE. I found several problems:

1. There is a custom control in the webpage under test to control the scope ,. Click a part of the control. The upper and lower arrows of the control move one of them based on the distance from the click point and refresh the page.

During recording, I found that selenium ide did not respond to this incident. After analysis, this control is composed of up and down divs and uses mouse events to call Js. But I did not find the js code, and I am not clear about the specific operating mechanism. Naturally, I thought of a simple clickat method, and clicked directly at a coordinate of the control. Run it without any response ==# it turns out that JS only corresponds to the mouse down event. Then change to the mousedownat method, OK.

In actual tests, the widget size remains unchanged, that is, the coordinates of each range are also certain. For such exhaustive tests, coordinates can be used.

2. The webpage contains an Ajax table. Table data is changed according to the filtering range, but all the basic elements of the table are completely fixed, and the refresh time is not necessarily the same. If it is less than 1 second, it is several dozen seconds. Most methods of clickandwait and waitfor cannot be used during recording to wait for the Ajax refresh to complete the operation. A GIF prompt is displayed during the refresh process. In the refresh process, the display of the GIF is block, and the result is set to none. So I want to use the waitforattribute method to determine whether the refresh is complete. When the result is run, it is often judged that an error causes timeout failure. Depressed for half a day.

Later, I accidentally converted the source code from HTML to Python, and found that the waitfor method is a method that cyclically judges is. So we can use python to judge whether the refresh is complete through several elements. OK.

 

I did not do anything for the whole day. Later, I looked at the source code of xpath and Python client selenium, and basically understood what was going on. The preparation for the tool is also basically here. The test cases of the website have not been viewed yet. You need to make up for them immediately. I heard a speech from a colleague yesterday and learned that the customer of this project submitted many bugs. I suddenly remembered that I should compare the bug reports of QA and client.

 

Today.

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.