CN111913889A - Test system building method and test system - Google Patents
Test system building method and test system Download PDFInfo
- Publication number
- CN111913889A CN111913889A CN202010954860.4A CN202010954860A CN111913889A CN 111913889 A CN111913889 A CN 111913889A CN 202010954860 A CN202010954860 A CN 202010954860A CN 111913889 A CN111913889 A CN 111913889A
- Authority
- CN
- China
- Prior art keywords
- test
- app
- directory
- management platform
- control system
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/34—Graphical or visual programming
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Human Computer Interaction (AREA)
- Debugging And Monitoring (AREA)
Abstract
本发明实施例涉及软件自动化测试领域,公开了一种测试系统搭建方法及测试系统。包括:在新建的交互应用测试工程中创建分层目录,用于将页面元素、测试数据以及测试用例分别存储在对应的目录下;导入测试工程实施所需的文件;分别封装APP操作以及Web操作的公共方法;配置Appium执行环境,以在测试用例执行时启动Appium.exe后得到自动化测试控制系统;基于自动化测试控制系统以及可视化数据管理平台构造测试场景类;基于构造的测试场景类配置测试执行文件以实现套件测试。本发明可实现交互项目自动化测试、降低各个测试场景的耦合度,实现数据驱动测试,提高脚本的稳定性和可读性,降低测试人员的代码编写能力门槛,提高代码编写效率。
The embodiment of the invention relates to the field of software automatic testing, and discloses a test system construction method and a test system. Including: creating a hierarchical directory in the newly created interactive application test project to store page elements, test data and test cases in corresponding directories; importing files required for the implementation of the test project; encapsulating APP operations and Web operations respectively public method; configure the Appium execution environment to obtain an automated test control system after launching Appium.exe during test case execution; construct a test scene class based on the automated test control system and the visual data management platform; configure the test execution based on the constructed test scene class file to implement suite testing. The invention can realize automatic testing of interactive items, reduce the coupling degree of each test scenario, realize data-driven testing, improve the stability and readability of scripts, lower the code writing ability threshold of testers, and improve code writing efficiency.
Description
技术领域technical field
本发明涉及软件自动化测试技术领域,特别涉及一种测试系统搭建方法及测试系统。The invention relates to the technical field of software automatic testing, in particular to a test system construction method and a test system.
背景技术Background technique
随着移动互联网的快速发展,智能手机的使用群体越来越广泛,移动手机已作为娱乐通讯生活学习必备工具。与此同时兴起了各类移动互联网应用的开发,其中大部分的终端应用都有其相应的后台管理系统,这类系统应用的测试涉及平台终端的交互功能,平台和终端通知执行,在版本迭代频繁的情况下,测试工作繁琐且准确性较差、人力成本高。目前,现有单测平台功能或单测终端功能的自动化测试方法包括:With the rapid development of the mobile Internet, the use of smart phones has become more and more extensive, and mobile phones have become an essential tool for entertainment, communication, life and learning. At the same time, the development of various mobile Internet applications has arisen, most of which have their corresponding background management systems. The testing of such system applications involves the interaction function of the platform terminal, and the execution of platform and terminal notifications. In frequent cases, the test work is cumbersome, the accuracy is poor, and the labor cost is high. At present, the existing automated testing methods for single-testing platform functions or single-testing terminal functions include:
1、Web端自动化测试。基于QC和QTP(Quick Test Professional)的Web端UI(UserInterface,用户界面)自动化测试,该方法需要录制和编辑自动化测试脚本,通过脚本完成对被测软件的自动化测试并输出测试结果;基于Selenium的未分层的Web端UI自动化测试,具有一定java代码编写能力的测试人员按照测试业务场景编写测试数据、页面对象和方法,执行脚本输出测试结果,该方案编写的脚本比基于QC和QTP的Web端UI自动化测试框架在稳定性、规范性、可读性上有所提升。1. Web-side automated testing. Web-side UI (UserInterface, user interface) automated testing based on QC and QTP (Quick Test Professional), this method needs to record and edit automated test scripts, complete automated testing of the software under test through scripts and output test results; Selenium-based Unlayered web-side UI automation test, testers with certain java code writing ability write test data, page objects and methods according to the test business scenario, and execute the script to output the test result. The script written by this solution is better than QC and QTP-based Web The end UI automation testing framework has improved in stability, standardization, and readability.
2、App端自动化测试。基于adb和Monkey的App端UI自动化测试,模拟用户的按键输入、触摸屏输入、手势输入等,该方法主要用于测试android app的稳定性;基于Appium的未分层安卓App自动化测试,Appium作为一款开源的自动化测试工具,可以非常快捷创建安卓UI自动化测试用例,测试人员按照测试业务场景编写测试数据、页面对象和方法,执行脚本输出测试结果。2. App-side automated testing. App-side UI automation testing based on adb and Monkey simulates user's key input, touch screen input, gesture input, etc. This method is mainly used to test the stability of android apps; based on Appium-based automated testing of unlayered Android apps, Appium is used as a This open source automated testing tool can quickly create Android UI automated test cases. Testers write test data, page objects and methods according to test business scenarios, and execute scripts to output test results.
发明人发现相关技术至少存在以下问题:现有的方案在一定程度上提供了单端UI自动化测试方法,但是并不能很好的满足平台和终端交互项目的自动化测试需要。基于QC和QTP的Web端UI自动化测试,受限QTP、QC等非开源、录制的脚本可读性差、稳定性差、运行速度慢、难以维护;基于Selenium的未分层的Web端UI自动化测试,要求测试人员必须要有较好的脚本代码编写能力,门槛较高,测试数据和测试方法场景未分层,维护成本极高;基于adb和Monkey的App端UI自动化测试,点击和手势皆随机,难以满足对特定功能的测试需要;基于Appium的未分层安卓App自动化测试,其在页面元素和数据的管理方面没有标准化的框架和规范,测试元素获取繁琐、脚本编写技术门槛较高、维护成本较大,单端自动化提升的效率也有限。The inventor found that the related art has at least the following problems: the existing solution provides a single-end UI automated testing method to a certain extent, but cannot well meet the automated testing needs of platform and terminal interaction projects. Web-side UI automation testing based on QC and QTP, limited QTP, QC and other non-open source, recorded scripts have poor readability, poor stability, slow running speed, and difficult to maintain; Selenium-based unlayered Web-side UI automation testing, Testers are required to have good script code writing ability, the threshold is high, the test data and test method scenarios are not layered, and the maintenance cost is extremely high; based on adb and Monkey App-side UI automation test, clicks and gestures are random, It is difficult to meet the testing needs of specific functions; the automated testing of unlayered Android apps based on Appium has no standardized framework and specifications in the management of page elements and data, and the acquisition of test elements is cumbersome, the technical threshold for scripting is high, and maintenance costs are high. Larger, the efficiency of single-ended automation improvement is also limited.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本发明实施方式的目的在于提供一种测试系统搭建方法及测试系统,可实现平台终端交互项目自动化测试,并且通过将界面元素、数据、用例执行进行分层,降低各个测试场景的耦合度,通过可视化界面编辑元素和数据,实现数据驱动测试,提高脚本的稳定性和可读性,降低测试人员的代码编写能力门槛,提高代码编写效率。In view of this, the purpose of the embodiments of the present invention is to provide a test system construction method and test system, which can realize automated testing of platform terminal interaction items, and reduce the complexity of each test scenario by layering interface elements, data, and use case execution. Coupling, editing elements and data through the visual interface, realizing data-driven testing, improving the stability and readability of scripts, lowering the code writing ability threshold of testers, and improving code writing efficiency.
为解决上述技术问题,本发明的实施方式提供了一种测试系统搭建方法,包括:In order to solve the above technical problems, embodiments of the present invention provide a method for building a test system, including:
在新建的交互应用测试工程中创建分层目录,用于将页面元素、测试数据以及测试用例分别存储在对应的目录下;Create a hierarchical directory in the newly created interactive application test project to store page elements, test data and test cases in corresponding directories;
导入所述测试工程实施所需的文件;Import the files required for the implementation of the test project;
分别封装APP操作以及Web操作的公共方法;Encapsulate the public methods of APP operation and Web operation respectively;
配置Appium执行环境,以在测试用例执行时启动Appium.exe后得到自动化测试控制系统;Configure the Appium execution environment to obtain an automated test control system after launching Appium.exe during test case execution;
基于所述自动化测试控制系统以及可视化数据管理平台构造测试场景类;Construct test scene classes based on the automated test control system and the visual data management platform;
基于构造的所述测试场景类配置测试执行文件以实现套件测试。Configure a test execution file based on the constructed test scenario class to implement suite testing.
本发明的实施方式还提供了一种测试系统,包括:可视化数据管理平台以及如前所述的自动化测试控制系统以及可视化数据管理平台;Embodiments of the present invention also provide a test system, including: a visual data management platform, the aforementioned automated test control system and a visual data management platform;
所述自动化测试控制系统与所述可视化数据管理平台通信连接。The automated test control system is connected in communication with the visual data management platform.
本发明实施方式相对于现有技术而言,通过封装Selenium和Appium实现平台终端交互项目的自动化测试,且将界面元素、数据、用例执行进行分层,并通过可视化界面实现元素和数据的存储和修改,从而降低各个测试场景的耦合度,实现数据驱动测试,提高脚本的稳定性和可读性,降低测试人员的代码编写能力门槛,提高代码编写效率。Compared with the prior art, the embodiment of the present invention realizes the automatic test of the interactive project of the platform terminal by encapsulating Selenium and Appium, and layers the interface elements, data and use case execution, and realizes the storage and storage of the elements and data through the visual interface. Modification, thereby reducing the coupling degree of each test scenario, realizing data-driven testing, improving the stability and readability of scripts, lowering the code writing ability threshold of testers, and improving code writing efficiency.
作为一个实施例,分别封装APP操作以及Web操作的公共方法,包括:As an embodiment, the public methods for encapsulating APP operations and Web operations respectively include:
在BaseObject目录下编写包含selenium、appium的启动方法、显示等待、隐式等待及其他基本方法的类;In the BaseObject directory, write classes that include the startup methods of selenium and appium, display wait, implicit wait and other basic methods;
在AppObject目录下根据待测试的交互应用封装公共方法类;Encapsulate public method classes according to the interactive application to be tested in the AppObject directory;
在BrowserManager目录下编写Web及APP的启动初始化类;Write the startup initialization classes for Web and APP in the BrowserManager directory;
在PageObject目录下按照Web页面封装公共方法类;Encapsulate public method classes according to Web pages in the PageObject directory;
在Data目录下存放可配置参数;Store configurable parameters in the Data directory;
在Test目录下编写单个用例场景类。Write a single use case scenario class under the Test directory.
作为一个实施例,基于所述自动化测试控制系统以及可视化数据管理平台构造测试场景类,包括:As an embodiment, a test scenario class is constructed based on the automated test control system and the visual data management platform, including:
解析所述可视化数据管理平台传入的Web元素数据;其中,所述Web元素数据包括定位类型、定位信息、元素名称、需要定义的操作方法、所述Web页面id,根据不同页面对selenium进行封装,形成web页面元素操作方法的核心API。Parse the Web element data passed in by the visual data management platform; wherein, the Web element data includes positioning type, positioning information, element name, operation method to be defined, and the Web page id, and encapsulates selenium according to different pages , which forms the core API of web page element operation methods.
作为一个实施例,基于所述自动化测试控制系统以及可视化数据管理平台构造测试场景类,还包括:As an embodiment, a test scenario class is constructed based on the automated test control system and the visual data management platform, further comprising:
解析所述可视化数据管理平台传入的APP元素数据;其中,所述APP元素数据包括定位类型、定位信息、元素名称、需要定义的操作方法、所述app的id,根据所述app的页面对Appium进行封装,形成所述app页面元素操作方法的核心API。Parse the APP element data passed in by the visual data management platform; wherein, the APP element data includes positioning type, positioning information, element name, operation method to be defined, and the id of the app, according to the page of the app. Appium encapsulates and forms the core API of the app page element operation method.
作为一个实施例,还包括:As an embodiment, it also includes:
通过IDE新建一个Maven的java项目,引用TestNG框架,以得到所述交互应用测试工程。Create a Maven java project through the IDE, and refer to the TestNG framework to obtain the interactive application test project.
作为一个实施例,还包括:As an embodiment, it also includes:
基于所述可视化数据管理平台实现待测试的交互应用的页面元素、测试数据以及测试结果的可视化编辑。Visual editing of page elements, test data and test results of the interactive application to be tested is realized based on the visual data management platform.
作为一个实施例,所述导入所述测试工程实施所需的文件,包括:As an embodiment, the importing the files required for the implementation of the test project includes:
在lib目录下存放Selenium、sikuli、及maven和Jre的jar包;在source目录下存放driver、Autoit、uploadfile等执行文件及其他业务文件;Store Selenium, sikuli, and maven and Jre jar packages in the lib directory; store driver, Autoit, uploadfile and other executable files and other business files in the source directory;
在对应的lib和source目录下导入依赖的jar、source文件。Import the dependent jar and source files in the corresponding lib and source directories.
作为一个实施例,所述自动化测试控制系统同时控制Web测试客户端以及App测试客户端执行所述测试执行文件。As an embodiment, the automated test control system simultaneously controls the Web test client and the App test client to execute the test execution file.
作为一个实施例,所述自动化测试控制系统以及所述可视化数据管理平台通过Ftp或者Sql数据库交换数据。As an embodiment, the automated test control system and the visual data management platform exchange data through Ftp or Sql database.
附图说明Description of drawings
图1是根据本发明实施方式的平台终端交互项目自动化测试系统搭建方法的流程图;1 is a flowchart of a method for building an automated testing system for platform terminal interaction items according to an embodiment of the present invention;
图2是根据本发明实施方式的测试系统的结构示意图。FIG. 2 is a schematic structural diagram of a testing system according to an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合附图对本发明的各实施方式进行详细的阐述。然而,本领域的普通技术人员可以理解,在本发明各实施方式中,为了使读者更好地理解本发明而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本发明所要求保护的技术方案。In order to make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the various embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, those of ordinary skill in the art can appreciate that, in the various embodiments of the present invention, many technical details are set forth for the reader to better understand the present invention. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present invention can be realized.
本发明的第一实施方式涉及一种平台终端交互项目自动化测试系统搭建方法。如图1所示,本实施例的平台终端交互项目自动化测试系统搭建方法包括步骤101至步骤106。The first embodiment of the present invention relates to a method for building an automated testing system for platform terminal interaction items. As shown in FIG. 1 , the method for building an automated testing system for a platform terminal interaction item in this embodiment includes
步骤101:在新建的交互应用测试工程中创建分层目录,用于将页面元素、测试数据以及测试用例分别存储在对应的目录下。Step 101: Create a hierarchical directory in the newly created interactive application test project for storing page elements, test data and test cases in corresponding directories respectively.
步骤102:导入测试工程实施所需的文件。Step 102: Import the files required for the implementation of the test project.
步骤104:分别封装APP操作以及Web操作的公共方法。Step 104: Encapsulate public methods of APP operation and Web operation respectively.
步骤104:配置Appium执行环境,以在测试用例执行时启动Appium.exe后得到自动化测试控制系统。Step 104: Configure the Appium execution environment to obtain an automated test control system after launching Appium.exe when the test case is executed.
步骤105:基于自动化测试控制系统以及可视化数据管理平台构造测试场景类。Step 105: Construct a test scenario class based on the automated test control system and the visual data management platform.
步骤106:基于构造的测试场景类配置测试执行文件以实现套件测试。Step 106: Configure a test execution file based on the constructed test scenario class to implement suite testing.
可选地,步骤101通过IDE新建一个Maven的java项目,引用TestNG框架,以得到交互应用测试工程。具体地,首先配置好java工程依赖环境,通过IDE新建一个Maven的java项目,并捆绑TestNG。步骤101创建的分层目录包含BaseObject、AppObject、BrowserManager、PageObject、Date、Test、Util等目录,还包括lib目录,source目录以及pom.xml以及testng.xml等文件。Optionally,
可选地,步骤102导入测试工程实施所需的文件可以包括:在lib目录下存放Selenium、sikuli、及maven和Jre的jar包;在source目录下存放driver、Autoit、uploadfile等执行文件及其他业务文件;在对应的lib和source目录下导入依赖的jar、source文件。Optionally, importing files required for the implementation of the test project in
本实施例中,步骤103分别封装APP操作以及Web操作的公共方法包括:In this embodiment, the public methods for encapsulating the APP operation and the Web operation respectively in
在BaseObject目录下编写包含selenium、appium的启动方法、显示等待、隐式等待及其他基本方法的类;在AppObject目录下根据待测试的交互应用封装公共方法类;在BrowserManager目录下编写Web及APP的启动初始化类;在PageObject目录下按照Web页面封装公共方法类;在Data目录下存放可配置参数;在Test目录下编写单个用例场景类。Write classes containing selenium and appium startup methods, display waits, implicit waits and other basic methods in the BaseObject directory; encapsulate public method classes according to the interactive application to be tested in the AppObject directory; write Web and APP in the BrowserManager directory Start the initialization class; encapsulate public method classes according to Web pages in the PageObject directory; store configurable parameters in the Data directory; write a single use case scenario class in the Test directory.
步骤104配置Appium执行环境,以在测试用例执行时启动Appium.exe,从而使得测试时无需手动启动Appium.exe,实现自动化测试。Step 104 configures the Appium execution environment to start Appium.exe when the test case is executed, so that it is not necessary to manually start Appium.exe during the test, thereby realizing automated testing.
步骤101~步骤104即可完成自动化测试控制系统的搭建。然后,通过步骤105以及步骤106分别完成测试场景类构造以及自动化测试控制脚本的配置,从而实现App的自动化测试。
步骤105基于所述自动化测试控制系统以及可视化数据管理平台构造测试场景类包括:解析可视化数据管理平台传入的Web元素数据;其中,Web元素数据包括定位类型、定位信息、元素名称、需要定义的操作方法、Web页面id,根据不同页面对selenium进行封装,形成web页面元素操作方法的核心API,从而构造出Web端测试场景类。步骤105还包括:解析可视化数据管理平台传入的APP元素数据;其中,APP元素数据包括定位类型、定位信息、元素名称、需要定义的操作方法、app的id,根据app的页面对Appium进行封装,形成app页面元素操作方法的核心API,从而构造出Web端测试场景类。Step 105 constructs a test scene class based on the automated test control system and the visual data management platform, including: parsing the Web element data passed in by the visual data management platform; wherein, the Web element data includes the positioning type, positioning information, element name, and needs to be defined. Operation method, Web page id, encapsulate selenium according to different pages, form the core API of the operation method of the web page element, and construct the Web-side test scene class. Step 105 also includes: parsing the APP element data passed in by the visual data management platform; wherein, the APP element data includes positioning type, positioning information, element name, operation method to be defined, and id of the app, and the Appium is encapsulated according to the page of the app , forming the core API of the app page element operation method, thereby constructing the web-side test scene class.
步骤106基于构造的测试场景类配置测试执行文件以实现套件测试包括:配置测试执行文件TestNG.xml,通过步骤105中传入的用例类名使用<suite>标签实现套件测试。In
本实施例中,基于可视化数据管理平台实现待测试的交互应用的页面元素、测试数据以及测试结果的可视化编辑。具体地,可视化数据管理平台可以用于Web页面和APP页面元素的存储修改、测试数据的存储修改、测试结果的查看,测试人员可以在可视化界面上进行输入、修改、查看,页面元素、测试数据、测试结果数据的存储字段格式如下:In this embodiment, the visual editing of page elements, test data and test results of the interactive application to be tested is implemented based on the visual data management platform. Specifically, the visual data management platform can be used for the storage and modification of Web pages and APP page elements, the storage and modification of test data, and the viewing of test results. Testers can input, modify, and view on the visual interface. , The storage field format of test result data is as follows:
本实施例中,自动化测试控制系统同时控制Web测试客户端以及App测试客户端执行测试执行文件,以实现平台终端交互项目的自动化测试。可选地,自动化测试控制系统以及该可视化数据管理平台可以通过Ftp或者Sql数据库交换数据。In this embodiment, the automated test control system simultaneously controls the Web test client and the App test client to execute the test execution file, so as to realize the automated test of the interactive project of the platform terminal. Optionally, the automated test control system and the visual data management platform can exchange data through Ftp or Sql database.
本实施方式的搭建方法,通过封装Selenium和Appium实现平台终端交互项目的自动化测试,且将界面元素、数据、用例执行进行分层,并通过可视化界面实现元素和数据的存储和修改,从而降低各个测试场景的耦合度,实现数据驱动测试,提高脚本的稳定性和可读性,降低测试人员的代码编写能力门槛,提高代码编写效率。The construction method of this embodiment implements automated testing of platform terminal interaction projects by encapsulating Selenium and Appium, and layers interface elements, data, and use case execution, and realizes storage and modification of elements and data through a visual interface, thereby reducing the need for various Test the coupling of scenarios, realize data-driven testing, improve the stability and readability of scripts, lower the threshold of testers' ability to write code, and improve the efficiency of code writing.
本发明的第二实施方式涉及一种测试系统,包括:可视化数据管理平台以及如前述实施例所述的自动化测试控制系统,该自动化测试控制系统与可视化数据管理平台通信连接。可选地,自动化测试控制系统与可视化数据管理平台通过FTP服务器以及SQL服务器通信连接。The second embodiment of the present invention relates to a test system, comprising: a visual data management platform and the automated test control system as described in the foregoing embodiments, the automated test control system is communicatively connected to the visual data management platform. Optionally, the automated test control system and the visual data management platform are communicated and connected through an FTP server and a SQL server.
本实施例中,可视化数据管理平台用于提供可视化界面,用户可通过该可视化界面对页面元素、用例场景以及测试结果等的数据进行编辑管理。In this embodiment, the visual data management platform is used to provide a visual interface through which a user can edit and manage data such as page elements, use case scenarios, and test results.
在自动化测试控制系统搭建完成后,可基于可视化数据管理平台传入的APP端测试数据、用例,通过自动化测试控制系统封装的APP操作公共方法构造APP测试场景类,类似地,可基于可视化数据管理平台传入的Web端测试数据、用例,通过自动化测试控制系统封装的Web操作公共方法构造Web测试场景类。然后配置测试执行文件TestNG.xml,通过构造的用例类名使用<suite>标签实现套件测试。在测试前,通过可视化数据管理平台得到自动化测试脚本并上传至FTP、sql服务器。在测试过程中,自动化测试控制系统从FTP、sql服务器下载自动化测试脚本,并控制自动化测试脚本在Web测试客户端以及App测试客户端的执行。并将脚本执行结果上传到FTP、SQL服务器,测试执行结果传输到可视化数据管理平台供用户查看。After the automated test control system is built, the APP test scene class can be constructed based on the APP-side test data and use cases input from the visual data management platform, and through the APP operation public methods encapsulated by the automated test control system. Similarly, it can be based on visual data management The web-side test data and use cases passed in by the platform construct the web test scene class through the web operation public methods encapsulated by the automated test control system. Then configure the test execution file TestNG.xml, and use the <suite> tag to implement suite testing through the constructed use case class name. Before the test, the automated test script is obtained through the visual data management platform and uploaded to the FTP and SQL server. During the test, the automated test control system downloads automated test scripts from FTP and SQL servers, and controls the execution of automated test scripts on the Web test client and the App test client. Upload the script execution results to FTP and SQL servers, and transfer the test execution results to the visual data management platform for users to view.
本实施方式的测试系统,通过封装Selenium和Appium实现平台终端交互项目的自动化测试,且将界面元素、数据、用例执行进行分层,并通过可视化界面实现元素和数据的存储和修改,从而降低各个测试场景的耦合度,实现数据驱动测试,提高脚本的稳定性和可读性,降低测试人员的代码编写能力门槛,提高代码编写效率。The test system of this embodiment implements automated testing of platform terminal interaction projects by encapsulating Selenium and Appium, and layers interface elements, data, and use case execution, and realizes storage and modification of elements and data through a visual interface, thereby reducing the need for various Test the coupling of scenarios, realize data-driven testing, improve the stability and readability of scripts, lower the threshold of testers' ability to write code, and improve the efficiency of code writing.
下面以一个平台终端交互项目的网页黑名单测试用例为例,对上述实施例进行具体说明,所谓交互即平台和终端之间的多端数据交互。该项目包括一个后台管理平台和学生端、家长端两个终端,后台管理平台和家长端共同管理学生端,本文介绍其中一种网页黑名单的执行方法:通过后台管理平台设置黑名单,下发指令到学生端,学生端执行该指令。其中:平台网页黑名单新增标签、输入框、确定按钮的xpath(此处选择xpath)、操作方法(分别对应click、sendKeys、click)、元素名称(addbut、blackwebname、confirmbut),学生端终端默认浏览器的网址输入框、搜索按钮、搜索后显示的警告文字的xpath(此处选择xpath)、操作方法(分别对应sendKeys、click、assertEqual)、元素名称(webname、searchbut、warning)。The above embodiment will be specifically described below by taking a web page blacklist test case of a platform terminal interaction project as an example. The so-called interaction refers to the multi-terminal data interaction between the platform and the terminal. The project includes a background management platform and two terminals, the student terminal and the parent terminal. The background management platform and the parent terminal jointly manage the student terminal. This article introduces one of the implementation methods of the webpage blacklist: set the blacklist through the background management platform, and send the The instruction is sent to the student side, and the student side executes the instruction. Among them: the new label of the platform webpage blacklist, the input box, the xpath of the OK button (select xpath here), the operation method (corresponding to click, sendKeys, click respectively), the element name (addbut, blackwebname, confirmbut), the default of the student terminal The browser's URL input box, search button, xpath of the warning text displayed after search (select xpath here), operation method (corresponding to sendKeys, click, assertEqual respectively), element name (webname, searchbut, warning).
根据实施例一的搭建方法搭建好测试执行环境,其中的目录分层和通过可视化数据管理平台输入数据用于自动化测试执行系统的主要实现方法如下:According to the construction method of the first embodiment, a test execution environment is built, and the main implementation methods of the directory hierarchy and the input data through the visual data management platform for the automated test execution system are as follows:
目录分层:在工程中创建分层目录的方法将界面元素、测试数据、测试用例进行有效的分层,界面元素统一放在PageObject、AppObject目录下,测试数据存放在Data目录下,测试用例存放在Test目录下,通过可视化数据管理平台进行元素和数据的输入。Directory layering: The method of creating layered directories in the project effectively layer interface elements, test data, and test cases. The interface elements are uniformly placed in the PageObject and AppObject directories, the test data is stored in the Data directory, and the test cases are stored Under the Test directory, input elements and data through the visual data management platform.
通过可视化数据管理平台输入数据用于自动化测试:对web页面的操作方法进行封装,通过可视化数据管理平台传入的页面id,元素xpath、元素名称(addBut)创建新增网页黑名单类addBlackWebPage.java存放于PageObject目录下。主要实现伪代码为:Input data through the visual data management platform for automated testing: encapsulate the operation method of the web page, and create a new web page blacklist class addBlackWebPage.java through the page id, element xpath, and element name (addBut) passed in by the visual data management platform Stored in the PageObject directory. The main implementation pseudocode is:
测试数据存放在Data目录下,把新增网页黑名单网址https://www.taobao.com/存放在testData.java下,主要实现伪代码为:The test data is stored in the Data directory, and the newly added webpage blacklist URL https://www.taobao.com/ is stored in testData.java. The main implementation pseudocode is:
对APP页面操作方法进行封装,通过可视化数据管理平台传入的appid、xpath、操作方法、元素名称创建BrowserApp.java类存放于AppObject目录下,主要实现伪代码为:The APP page operation method is encapsulated, and the BrowserApp.java class is created and stored in the AppObject directory through the incoming appid, xpath, operation method, and element name from the visual data management platform. The main implementation pseudocode is:
web端和app端测试场景类的构造,测试用例存放在Test目录下,根据可视化数据管理平台传入的操作类型创建web端addClass.java(实现网页黑名单的新增),App端isBlackWeb.java(实现网页黑名单指令执行的验证)。配置TestNG.xml,使用<suit>标签实现套件测试,其实现的主要代码:The construction of test scene classes on the web side and the app side, the test cases are stored in the Test directory, and the web side addClass.java is created according to the operation type passed in by the visual data management platform (to realize the addition of the web page blacklist), and the App side isBlackWeb.java (implementing the verification of the execution of the webpage blacklist instruction). Configure TestNG.xml and use the <suit> tag to implement suite testing. The main code of its implementation:
本实施例的搭建方法以及搭建出的测试系统能实现平台终端交互项目的自动化测试、分层的设计思路能降低代码耦合度、可视化数据管理平台和自动化控制系统的结合能有效降低代码编写和维护成本。The construction method and the constructed test system of this embodiment can realize automated testing of platform terminal interaction projects, the layered design idea can reduce the degree of code coupling, and the combination of the visual data management platform and the automated control system can effectively reduce code writing and maintenance. cost.
本发明的第三实施方式涉及一种电子设备。本实施方式的电子设备可以是独立的服务器。该电子设备包括:存储器和处理器;A third embodiment of the present invention relates to an electronic device. The electronic device of this embodiment may be an independent server. The electronic device includes: a memory and a processor;
其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行以实现如实施例一的自动化测试控制系统的搭建方法。Wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to implement the method for building an automated test control system according to the first embodiment.
存储器作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。处理器通过运行存储在存储器中的非易失性软件程序、指令以及模块,从而执行设备的各种功能应用以及数据处理,即实现上述自动化测试控制系统的搭建方法。As a non-volatile computer-readable storage medium, the memory can be used to store non-volatile software programs, non-volatile computer-executable programs and modules. The processor executes various functional applications and data processing of the device by running the non-volatile software programs, instructions and modules stored in the memory, that is, the construction method of the above-mentioned automatic test control system is realized.
存储器可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施方式中,存储器可选包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至外接设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required by at least one function. Additionally, the memory may include high speed random access memory, and may also include nonvolatile memory, such as at least one magnetic disk storage device, flash memory device, or other nonvolatile solid state storage device. In some embodiments, the memory may optionally include memory located remotely from the processor, such remote memory being connectable to an external device via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
一个或者多个模块存储在存储器中,当被一个或者多个处理器执行时,执行上述任意方法实施方式中的自动化测试控制系统的搭建方法。One or more modules are stored in the memory, and when executed by one or more processors, execute the method for building an automated test control system in any of the foregoing method embodiments.
上述设备可执行本发明实施方式所提供的方法,具备执行方法相应的功能模块和有益效果,未在本实施方式中详尽描述的技术细节,可参见本发明实施方式所提供的方法。The above device can execute the method provided by the embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method. For technical details not described in detail in this embodiment, refer to the method provided by the embodiment of the present invention.
本发明的第四实施方式涉及一种非易失性存储介质,用于存储计算机可读程序,所述计算机可读程序用于供计算机执行上述部分或全部的方法实施例。The fourth embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, and the computer-readable program is used for a computer to execute some or all of the above method embodiments.
即,本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。That is, those skilled in the art can understand that all or part of the steps in the method for implementing the above embodiments can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium and includes several instructions to make a device ( It may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, removable hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes.
本领域的普通技术人员可以理解,上述各实施方式是实现本发明的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本发明的精神和范围。Those skilled in the art can understand that the above-mentioned embodiments are specific examples for realizing the present invention, and in practical applications, various changes in form and details can be made without departing from the spirit and the spirit of the present invention. scope.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010954860.4A CN111913889A (en) | 2020-09-11 | 2020-09-11 | Test system building method and test system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010954860.4A CN111913889A (en) | 2020-09-11 | 2020-09-11 | Test system building method and test system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN111913889A true CN111913889A (en) | 2020-11-10 |
Family
ID=73267608
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010954860.4A Pending CN111913889A (en) | 2020-09-11 | 2020-09-11 | Test system building method and test system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111913889A (en) |
Cited By (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113448845A (en) * | 2021-06-22 | 2021-09-28 | 重庆长安汽车股份有限公司 | UI automation test method and system |
| CN114048134A (en) * | 2021-11-15 | 2022-02-15 | 北京天融信网络安全技术有限公司 | Automatic testing method and device based on POM and data driving |
| CN114238142A (en) * | 2021-12-24 | 2022-03-25 | 四川启睿克科技有限公司 | Automatic mobile terminal ui testing method based on apium + python |
| CN114490384A (en) * | 2022-01-26 | 2022-05-13 | 浙江绿城未来数智科技有限公司 | Automatic testing system and method for platform property of APP shell |
| CN115248782A (en) * | 2022-09-22 | 2022-10-28 | 中邮消费金融有限公司 | Automatic testing method and device and computer equipment |
| WO2022237826A1 (en) * | 2021-05-12 | 2022-11-17 | 华为云计算技术有限公司 | User interface testing method and system, cluster, medium, and program product |
| CN115373978A (en) * | 2022-07-07 | 2022-11-22 | 北京思特奇信息技术股份有限公司 | A method and system for automated testing based on Appium |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6182245B1 (en) * | 1998-08-31 | 2001-01-30 | Lsi Logic Corporation | Software test case client/server system and method |
| CN106407112A (en) * | 2016-09-09 | 2017-02-15 | 浪潮软件集团有限公司 | Automatic testing method based on Selenium and TestNG |
| CN106547689A (en) * | 2016-10-20 | 2017-03-29 | 金航数码科技有限责任公司 | A kind of automatic test cases development system and method based on web |
| CN107562626A (en) * | 2017-08-31 | 2018-01-09 | 国家电网公司 | A kind of method that encapsulation Selenium and Sikuli realizes Web automatic tests |
| CN107643981A (en) * | 2017-08-29 | 2018-01-30 | 顺丰科技有限公司 | A kind of automatic test platform and operation method of polynary operation flow |
| CN107908564A (en) * | 2017-11-27 | 2018-04-13 | 于海生 | A kind of UI test frames based on data separating principle |
| CN108427646A (en) * | 2018-04-13 | 2018-08-21 | 中国民航信息网络股份有限公司 | Android App automated test frames construction method based on Appium and device |
-
2020
- 2020-09-11 CN CN202010954860.4A patent/CN111913889A/en active Pending
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6182245B1 (en) * | 1998-08-31 | 2001-01-30 | Lsi Logic Corporation | Software test case client/server system and method |
| CN106407112A (en) * | 2016-09-09 | 2017-02-15 | 浪潮软件集团有限公司 | Automatic testing method based on Selenium and TestNG |
| CN106547689A (en) * | 2016-10-20 | 2017-03-29 | 金航数码科技有限责任公司 | A kind of automatic test cases development system and method based on web |
| CN107643981A (en) * | 2017-08-29 | 2018-01-30 | 顺丰科技有限公司 | A kind of automatic test platform and operation method of polynary operation flow |
| CN107562626A (en) * | 2017-08-31 | 2018-01-09 | 国家电网公司 | A kind of method that encapsulation Selenium and Sikuli realizes Web automatic tests |
| CN107908564A (en) * | 2017-11-27 | 2018-04-13 | 于海生 | A kind of UI test frames based on data separating principle |
| CN108427646A (en) * | 2018-04-13 | 2018-08-21 | 中国民航信息网络股份有限公司 | Android App automated test frames construction method based on Appium and device |
Cited By (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2022237826A1 (en) * | 2021-05-12 | 2022-11-17 | 华为云计算技术有限公司 | User interface testing method and system, cluster, medium, and program product |
| CN113448845A (en) * | 2021-06-22 | 2021-09-28 | 重庆长安汽车股份有限公司 | UI automation test method and system |
| CN114048134A (en) * | 2021-11-15 | 2022-02-15 | 北京天融信网络安全技术有限公司 | Automatic testing method and device based on POM and data driving |
| CN114238142A (en) * | 2021-12-24 | 2022-03-25 | 四川启睿克科技有限公司 | Automatic mobile terminal ui testing method based on apium + python |
| CN114238142B (en) * | 2021-12-24 | 2024-11-05 | 四川启睿克科技有限公司 | A mobile UI automation testing method based on appium+python |
| CN114490384A (en) * | 2022-01-26 | 2022-05-13 | 浙江绿城未来数智科技有限公司 | Automatic testing system and method for platform property of APP shell |
| CN115373978A (en) * | 2022-07-07 | 2022-11-22 | 北京思特奇信息技术股份有限公司 | A method and system for automated testing based on Appium |
| CN115248782A (en) * | 2022-09-22 | 2022-10-28 | 中邮消费金融有限公司 | Automatic testing method and device and computer equipment |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111913889A (en) | Test system building method and test system | |
| US11561846B2 (en) | API notebook tool | |
| CN110928529B (en) | Method and system for assisting operator development | |
| US10705942B1 (en) | Simulated testing of API | |
| CN112256321B (en) | Static library packaging method, device, computer equipment and storage medium | |
| CN108964968B (en) | Service access management method and system in container cloud environment | |
| US9563415B2 (en) | Generating visually encoded dynamic codes for remote launching of applications | |
| WO2019153472A1 (en) | Automated interface testing method, device, equipment, and storage medium | |
| WO2018228211A1 (en) | Application conversion method, apparatus and device | |
| CN110347378A (en) | The building method and device of item development environment | |
| CN113590465B (en) | Method for automatically generating mock service based on SDK | |
| CN112988165A (en) | Kubernetes-based interactive modeling method and device, electronic equipment and storage medium | |
| US20150160938A1 (en) | Automation in rule engine in an integration development environment | |
| CN115470101A (en) | Data testing method and device, computer equipment and storage medium | |
| CN112241373A (en) | Automated test method, test apparatus, processor and test system | |
| Keig | Advanced Express Web Application Development | |
| CN115480757B (en) | iOS system engineering component generation method, device, equipment and storage medium | |
| CN111078529A (en) | Client write-in module testing method and device and electronic equipment | |
| CN113641594B (en) | Cross-terminal automatic testing method and related device | |
| Bischoff et al. | Writing API Tests with Karate: Enhance your API testing for improved security and performance | |
| CN116521535A (en) | UI automation test platform implementation method and device, electronic equipment and storage medium | |
| CN115905020A (en) | Application testing method and device, electronic equipment and storage medium | |
| CN104539697B (en) | A kind of client, server and the method for making Android mobile application | |
| Sur | Visual Studio 2013 and. NET 4.5 Expert Cookbook | |
| Kovalenko | PhoneGap By Example |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201110 |