Giter Site home page Giter Site logo

automated-test's Introduction

Automated-Test

Web自动化测试框架

测试框架:

python3+Selenium+unittest+HTMLTestRunner+pageObject Web自动化测试框架

(selenium+unittest搭建的WebUI自动化测试框架)

环境部署: python3、selenium3 
开发工具: Pycharm
集成工具: Jenkins
测试代码托管平台:GitHub
通过主从服务器执行测试

测试代码结构:

Image text

  • common文件夹存放公有元素,如url,测试报告发送邮件地址,使用信息等;

  • file文件夹存放测试过程中需要使用的文件,如图片,txt,zip文件等

  • page文件夹用于存放测试过程中需要使用的页面元素

  • report文件夹用于存放测试生成的测试报告

  • testcase文件夹中存放测试用例

  • HTMLTestRunner.py是将测试结果生成为html版的测试报告的文件

  • run.py 执行run.py文件可以执行全部测试用例

生成的测试报告例子如下所示

Image text

发送邮件如下所示:

调用common中的sendEmail,向指定邮箱发送最新的测试报告文件

Image text

PageObject设计模式

由于Web页面自动化测试的过程中会存在许多重复的元素,且很多Web页面测试的元素值不稳定,经常变更, 为了使得Web页面自动化测试的代码更具有健壮性,因此使用PageObject设计模式, 将web自动化测试的测试用例和测试用例中需要使用到的元素解耦。

解耦后的代码方便修改,增强了自动化测试代码的复用性。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.