Build a lightweight, automated test framework Webz

Source: Internet
Author: User
Tags keyword list xpath

First, what is Webz

WEBZ is the "keyword driven" automated test framework I wrote in Python, based on Webdriver.

The framework was designed with automated tests that freed testers from simple but repetitive tests. The keyword driven mode is because I think it allows testers (test executives) to get started quickly, and to perform automated tests without writing code.

Second, why Open source

WEBZ's development has been used in some existing open source projects, I am very grateful to the author of these open source projects, I hope I can become an open source, and everyone to share their achievements, together to exchange technology, grow together.

GitHub address for this project:Https://github.com/ZMANONE/WebZ

Third, open source instructions

#portions Copyright (c) ZMAN (zhangning)# #This Source Code Form was subject to the terms of the Mozilla public#License, v. 2.0. If a copy of the MPL is not distributed with this#file, you can obtain one at http://mozilla.org/MPL/2.0/.##Name:webz#Description:keyword-driven Automated Testing Framework#Author:zman (zhangning)##This project also uses some Third-party modules:##selenium:licensed under the Apache License, Version 2.0 (the "License");#Copyright 2008-2013 Software Freedom Conservancy.##splinter:licensed under the BSD License;#Copyright: Splinter authors. All rights reserved.##reportlab:licensed under the BSD License;#Copyright Reportlab Europe Ltd. 2000-2014.##xlrd:licensed under the BSD License;#portions copyright 2005-2009, Stephen John Machin, Lingfo Pty Ltd. All rights reserved.#

Iv. Methods of Use

1. Place the Chromedriver.exe in any location and add it to the system environment variable.

2. Place the completed automated test case file "Case.xlsx" under the D-packing directory.

3. Run WebZ.exe. If the use case is executed correctly, the test report will be found in the D:\WebZ directory.

  Note: This program is packaged in a Win7 x64 environment.

Example:

test Case (CASE.XLSX):

As shown, this file contains two test cases that show you some of the underlying keywords in webz. For a detailed definition of keywords, see the Appendix.

The person who writes the test case knows some front-end knowledge, that is very good, does not understand also does not matter, now many browsers have "the element examines" the function. Take Chrome as an example, press F12 to enter the review element mode and click the Magnifier icon.

Then click on the element you want to manipulate, such as "Baidu" button, the browser will highlight the element information, directly right-click Copy CSS or XPath, and then with the WEBZ provided by the keyword can be used to manipulate the elements.

Let's run. These two use cases, which automatically generate test reports (if there are failed cases, list the failure steps):

(Well, the report was in Chinese, because I sent it to GitHub, so I changed the Chinese into English, internationalized ...). )

Five, the realization analysis

If you want to run webz in a python development environment, use PYTHON3 and you will also need to install several Open source libraries: Reportlab, XLRD, Selenium, splinter.

The WEBZ structure is roughly the same:

Read the Use cases in Excel for format preprocessing, segmentation, reading the defined keywords, sorting through webdriver, and capturing the failure information (if the use case fails, tries again, tries three times), and finally generates the report.

When design webz, the idea is that this is a lightweight web automation testing framework, but to preserve the scalability of the features, the main can be self-expanding and encapsulation of keywords.

"Automated testing is about automating some repetitive, yet simple, manual tests rather than replacing automation. Consider achieving cost and profitability before automating testing "-well, that's what I said, my current personal point of view-Welcome to explore:)

  

  If you have any questions or suggestions to WEBZ, you can contact me Oh, thank you!

-----------------------------------------------------------------

Appendix:

WebZ keyword list

1. Open Web page | (directly fill in the URL)

such as: Open Web page |www.baidu.com (note: The URL does not include/HTTP)

2. Click the | method @@ 控件 Name method support: ID, CSS, XPath

such as: click | [Email protected] @ti [2]>ao[3]>ca[0]

3. Fill in | method @@ 控件 name @@ 控件 method support: ID, CSS, XPath

such as: Fill in | [Email Protected]@[email protected]@ I love to test

4. back

5. Refresh

6.

7. Wait

Wait two seconds

8. Click on the text | (write text directly)

For example: Click on text | Learn more

9. Go to | (direct write URL)

such as: to |www.baidu.com

Validation | method @@ 文字 method support: URL, CSS, XPath, text

such as: Validation | [Email protected] @www. yiban.cn

Another example: Validation | [Email protected]@ Welcome

One by one . Mouse Move to | method @@ 文字 method Support: CSS, XPath

such as: Mouse move to | [Email protected] @img1

(This method is used for some controls that contain animations, because some controls move to the top of the mouse and change without clicking.) )

Build a lightweight, automated test framework Webz

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.