"Dove into the" series of Python + Selenium framework design articles 1- K value of several frames, do not look do not regret it, date is not waiting

1. What is the automated testing framework

  In understanding what is automated testing framework before the first look at what is the framework? The whole or part of the system frame reusable design, the performance of a set of methods and between the member instance of an abstract interaction member; another definition that, the framework may be customized application developer application skeleton. The former is the application, which is given in terms of a given object from

Righteousness. From the definition of the frame can understand, the frame can be reused basic platform; framework can also be things like organizational structure. In fact, the latter is more appropriate, because the frame and frame has always been the organization and classification used.

  So the definition of automated testing framework are: tool consists of one or more components of automated test base module, automated test management module, automated testing statistics module and other collections.

  As defined by sub-frame, the frame can be divided into automated testing: testing framework basic functions, performs the management framework; different types of test points, can be divided into: automated testing framework functionality, performance automated testing framework; according to points beta It can be divided into: automated testing framework unit, the interface automated testing framework, the automation system test frame

Rack; according to the composition of the structure points, can be divided into: single automated testing framework, a comprehensive automated testing framework; press the deployment points, it can be divided into: stand-alone automated testing framework, distributed automation testing framework.

  In Baidu Encyclopedia is defined as: automated testing framework, the framework that is used in automated test used. By definition frame, either automated testing framework provides automated testing based reusable modules, such as: Selenium  [. 1]  , Watir, etc., which mainly provide the most basic automated testing functions, such as opening a program to simulate mouse

And keyboard clicks, or actions to the object being tested, and finally verify the properties of the measured object to determine the correctness of the program; building block may be provided either automated test execution and management functions, such as: Framework Phoenix, Robot  [2]  , STAFF  [3]  And so on, they do not themselves provide automated testing support base, but for the organization, management and implementation

Those independent automated test line, the test is completed statistical test results, in general such a base frame generally integrated automated testing modules, such as: robot can be integrated frame Selenium  [. 4]  Framework, Phoenix Framework is an integrated framework of selenium.

  In short, automated testing framework by a few standards, protocols, rules of composition, provides an environment to run the script. Automated testing framework provides a lot of convenience to users to efficiently get something done, for example, clearly structured script development, in many ways, the platform executes the script, a good script execution reports to track the results.

Frame has the following advantages:

1) code reuse

2) maximum coverage

3) very low-cost maintenance

4) very little human intervention

5) Simple Report Output

2. Why automated testing?

①, low efficiency of black-box testing return

②, manual testing of contingency and uncertainty

③, inadequate return coverage

④, delivered product quality can not be guaranteed, thanks assessment

⑤, the more complex the system, the more problems

⑥, the longer the line, the butterfly member failure rate due to the effect (faster iteration, overtime)

3. automated testing can solve the problem?

①, to improve the response rate after problems

②, reduce the cost of return

③, increase return coverage

④, improve the efficiency of return

⑤, improve the stability return

4. What are the shortcomings of automated testing?

①, can not reduce the cost of inputs, but in order to speed up the test results back, improve test quality

②, automation applied to regression and smoke, not found BUG

③, Record & Playback function is tasteless, visualization is not a good practice

All functions ④, not all systems are suitable for all automated testing

5. Common Framework Classification Test

Selenium automated testing many developers have QTP turn over there, so they are in the early design of the framework can be divided into the following categories:

1) based on the test frame module

2) based on the library (Library) structure of the test frame

3) frame data driving test, and the like QTP

4) keyword-driven testing framework, but also over the QTP

5) mixing test frame, and an integrated 34

6) Behavior Driven Development Testing Framework

 Here we do not introduce one by one these frameworks, literally imagine some of the background of these frameworks and components, this is only a basic understanding of the framework.

6. The basic frame assembly

We have to think about the framework components:

1) requires a configuration file management

2) a test script code and business logic separated

3) reports and log file output

4) a custom library package

5) management, script execution mode

6) the introduction of third-party plug-ins

7) Continuous Integration

Explanation:

      We need a configuration file to control some of the environmental information, switches, configuration file can be txt / xml / yaml / properties / ini, use more general .properties in JAVA, the article is Python series, I might choose the ini file.

       Business logic code and test scripts separation, as we have just started to learn Selenium as demo code and scripts in a class file. We do not use code refactoring, reuse. After separation of code and use case documents, clearer, than to develop scripts for easy debugging.

       Reports and log file output, the number of case you perform, how case results, which are required to report to show the general use of third-party plug-ins to achieve this, a lot of reporting formats are html, simple, clear style. Log output is also very important, if an error occurs, the script fails, locate the position of a problem quickly through the log.

      User-defined library, this is well understood, many of us need to repeat the function call, so we write a public method, put under kits, each time convenient to call, for example, the browser engine class and basepage.py package.

      Manage and execute scripts manner, for example, in unit testing framework Python unittest usage is very high.

      Third-party plug-ins, sometimes, some of the features we need to use third-party plug-ins, better able to achieve, for example AutoIT, to achieve file upload and download. As well as the use of third-party plug-ins to generate reports based on test reports in html format.

      Continuous integration, git, svn, ant, maven, jenkins, we will integrate it into jenkins, achieve continuous integration, a key to execute test scripts.

7. Summary of design automation framework

According to the above framework describes the basic components of the characteristics of the macro brother roughly by the following diagram to describe a simple automated test framework, may contain configuration files, the main source frameworks, products, business pages, test scripts collection, logging and reporting, and continuous integration etc. these components currently expect only so much, if the latter think the macro brother further improve it.

8. The detailed design automation framework

根据以上的框架概念设计的特点介绍,宏哥这里详细地用以下图来描述一下,一个简单而又实用的自动化测试框架,可能包含以下这些组成部分。宏哥目前细化到这里,后期会将这个框架的代码放到github上,欢迎有兴趣和有能力的大佬给出建议或者完善这个自动化测试框架。

   

9. 小结

  框架的简单介绍就到这里,有些人把框架想得太复杂了,框架无非就是一些软件的集合,达到特定的目的。这里我们上图画出来的框架,就是一个简单的自动化测试框架,别笑,这确实是一个简单但又包含必要的组件的自动化测试框架设计实例,如果你学会了这个设计思路和思想,那么,你已经达到了自动化测试第二个阶段的水平:能够简单设计自动化测试框架和维护框架的能力。

 

好了,今天的分享就到这里吧!!!谢谢各位的耐心阅读。

 

您的肯定就是我进步的动力。如果你感觉还不错,就请鼓励一下吧!记得随手点波 推荐 不要忘记哦!!!

别忘了点推荐留下您来过痕迹

 

Guess you like

Origin www.cnblogs.com/du-hong/p/12052492.html