

技术领域technical field
本发明涉及轨道交通信号领域和软件测试领域,特别涉及一种用于轨旁安全平台离线工具的自动化测试框架及方法。The invention relates to the fields of rail traffic signals and software testing, in particular to an automated testing framework and method for off-line tools of a trackside safety platform.
背景技术Background technique
安全计算机轨旁型平台可应用于地铁、国铁或轨道交通系统中安全等级定义为SIL4(Safety Integrity Level-4,安全完整性等级4级)的信号系统中,例如有轨电车道岔控制器、国铁列控联锁一体化系统/无线闭塞中心/临时限速服务器、城轨智能安全型计算机联锁系统/区域控制器/数据存储单元等。安全计算机轨旁型平台加载SIL4安全应用后构成整体SIL4级系统产品时,整个系统的安全性可达到SIL4的要求。与轨旁安全平台配套的离线工具需符合EN50128-2011对SIL2软件的开发要求。为确保该离线工具稳定运行并生成准确配置数据,在离线工具发布前需对其进行全面测试,确保工具能够满足各类场景及要求。目前,对于轨旁安全平台离线工具的测试完全采用人工测试,这一方式主要存在以下几方面缺点:The safety computer wayside platform can be applied to signal systems whose safety level is defined as SIL4 (Safety Integrity Level-4) in subways, national railways or rail transit systems, such as tramway switch controllers, National railway train control interlocking integrated system/wireless block center/temporary speed limit server, urban rail intelligent and safe computer interlocking system/area controller/data storage unit, etc. When the safety computer wayside platform is loaded with SIL4 safety applications to form an overall SIL4 level system product, the safety of the entire system can meet the requirements of SIL4. Offline tools matched with the wayside safety platform must comply with the development requirements for SIL2 software in EN50128-2011. In order to ensure that the offline tool runs stably and generates accurate configuration data, it needs to be fully tested before the offline tool is released to ensure that the tool can meet various scenarios and requirements. At present, manual testing is completely used for the testing of offline tools of the trackside safety platform. This method mainly has the following disadvantages:
1、测试用例数量大,输入文件的数据变化均需通过人工改写,并同步更新MD5值,当更改的数据涉及多个车站编号,需来回切换文件夹以找到对应车站的输入文件;每个步骤涉及的输入文件均更改完毕后,需手动点击可执行文件运行离线工具,耗时耗力,重复步骤繁多,测试效率低下;1. The number of test cases is large, and the data changes of the input files need to be rewritten manually, and the MD5 value is updated synchronously. When the changed data involves multiple station numbers, it is necessary to switch folders back and forth to find the input files of the corresponding stations; each step After all the input files involved are changed, it is necessary to manually click the executable file to run the offline tool, which is time-consuming and labor-intensive, with many repeated steps and low test efficiency;
2、测试成败标识完全由人工检查,存在一定缺陷逃逸率;2. The test success or failure mark is completely checked manually, and there is a certain defect escape rate;
3、测试报告内的测试记录及结果统计需人工逐条记录,无法自动输出内容详尽的测试报告;3. The test records and result statistics in the test report need to be manually recorded one by one, and the detailed test report cannot be automatically output;
4、复用性差,涉及多轮测试时无法一键回归,需反复复制黏贴往期测试车站号内的相关文件作为输入并重新执行离线工具,涉及大量重复劳动。4. Poor reusability. When multiple rounds of testing are involved, one-click regression is not possible. It is necessary to repeatedly copy and paste the relevant files in the previous test station number as input and re-execute the offline tool, which involves a lot of repetitive labor.
发明内容Contents of the invention
本发明的目的在于提供一种自动化测试框架及方法,解决轨道交通信号系统中轨旁安全平台离线工具在确认测试过程所存在的技术问题,相比人工测试方式大幅提升效率,且具备较强复用性。The purpose of the present invention is to provide an automated testing framework and method to solve the technical problems of the offline tools of the trackside safety platform in the rail transit signal system during the confirmation test process, which greatly improves the efficiency compared with the manual testing method, and has strong complexity. usability.
为实现上述目的,本发明通过以下技术方案实现:To achieve the above object, the present invention is achieved through the following technical solutions:
一种自动化测试框架,用于根据预先编写好的测试用例文档对轨旁安全平台离线工具进行软件测试,所述测试用例文档中包括多个用例,软件测试由各用例测试构成;所述自动化测试框架包括:A kind of automated testing framework, is used for carrying out software testing to the off-line tool of trackside safety platform according to the test case document written in advance, includes a plurality of use cases in the described test case document, and software test is made up of each use case test; Described automated test Framework includes:
待测工具模块,为所述轨旁安全平台离线工具;The tool module to be tested is an offline tool of the trackside safety platform;
标准输入模块,为可供所述待测工具模块成功运行的全部标准输入文件的集合;The standard input module is a collection of all standard input files available for the successful operation of the tool module to be tested;
用例模块,包括用例输入子模块和用例输出子模块;其中,所述用例输入子模块为执行各用例所需的输入文件的集合,由人工建立或基于所述标准输入模块自动生成;所述用例输出子模块为执行各用例后生成的输出文件的集合;The use case module includes a use case input submodule and a use case output submodule; wherein, the use case input submodule is a collection of input files required for each use case, which is manually established or automatically generated based on the standard input module; the use case The output sub-module is a collection of output files generated after executing each use case;
配置模块,用于设置及保存所述自动化测试框架的参数配置;A configuration module, configured to set and save the parameter configuration of the automated testing framework;
测试模块,用于基于所述用例模块的用例输入子模块和配置模块对待测工具模块进行自动化测试,生成用例输出子模块;其中,所述测试模块能够基于配置模块和标准输入模块自动生成用例输入子模块。The test module is used to automatically test the tool module to be tested based on the use case input submodule and the configuration module of the use case module, and generate the use case output submodule; wherein the test module can automatically generate the use case input based on the configuration module and the standard input module submodule.
优选地,每个用例包括1个或多个用例步骤,每个用例测试由各用例步骤测试构成,Preferably, each use case includes one or more use case steps, and each use case test is composed of each use case step test,
所述用例输入子模块包括多个用例步骤输入文件集,每个所述用例步骤输入文件集为执行该用例步骤所需的1个或多个用例步骤输入文件的集合;The use case input submodule includes a plurality of use case step input file sets, each of the use case step input file sets is a collection of one or more use case step input files required to execute the use case step;
所述测试模块包括自动生成用例步骤输入文件集单元,所述自动生成用例步骤输入文件集单元能够基于配置模块和标准输入模块自动生成用例步骤输入文件集,各所述用例步骤输入文件集构成用例输入子模块。The test module includes an automatically generating use case step input file set unit, the automatic generation use case step input file set unit can automatically generate a use case step input file set based on the configuration module and the standard input module, each of the use case step input file sets constitutes a use case Import submodules.
优选地,所述配置模块包括基础信息配置单元和用例配置单元;其中,Preferably, the configuration module includes a basic information configuration unit and a use case configuration unit; wherein,
所述基础信息配置单元包括自动生成用例输入子模块标识,用于指示是否自动生成所述用例输入子模块;The basic information configuration unit includes an automatically generated use case input submodule identifier for indicating whether to automatically generate the use case input submodule;
所述用例配置单元包括用于对执行各用例步骤的相关参数进行配置的多个用例步骤配置子单元,各所述用例步骤配置子单元与各用例步骤一一对应;每个所述用例步骤配置子单元包括用于自动生成用例步骤输入文件集的自动生成参数;The use case configuration unit includes a plurality of use case step configuration subunits for configuring the relevant parameters for executing each use case step, each of the use case step configuration subunits corresponds to each use case step; each of the use case step configurations The subunit includes auto-generation parameters for automatically generating the set of input files for the use-case steps;
所述自动生成用例步骤输入文件集单元是基于自动生成用例输入子模块标识和自动生成参数,自动生成所述用例步骤输入文件集。The automatically generating use case step input file set unit automatically generates the use case step input file set based on the automatically generating use case input submodule identification and automatic generating parameters.
优选地,所述用例步骤输入文件集的各用例步骤输入文件可能为人工准备的符合用例步骤的输入文件,也可能为从所述标准输入模块中复制并改写的标准输入文件。Preferably, each use case step input file in the use case step input file set may be a manually prepared input file conforming to the use case step, or may be a standard input file copied and rewritten from the standard input module.
优选地,所述自动生成参数包括复改文件名称、改写字段名称和改写目标值,分别用于指示需要复制并改写的标准输入文件的名称,所述标准输入文件中需要改写的字段名称,所述字段的改写目标值。Preferably, the auto-generated parameters include a rewritten file name, a rewritten field name, and a rewritten target value, which are respectively used to indicate the name of the standard input file that needs to be copied and rewritten, and the field name that needs to be rewritten in the standard input file, so The override target value for the above field.
优选地,所述自动生成用例步骤输入文件集单元的运行与否基于所读取的自动生成用例输入子模块标识确定;Preferably, whether the operation of the input file set unit in the step of automatically generating use cases is determined based on the read identification of the input submodule of automatically generating use cases;
当所述自动生成用例步骤输入文件集单元运行时,其基于当前用例步骤的所述自动生成参数,自动建立用例输入子模块目录和其下对应的用例步骤输入文件集目录,再将所需要的所述标准输入模块中的标准输入文件复制到所建立的用例步骤输入文件集目录中并改写,形成对应的用例步骤输入文件集。When the automatically generated use case step input file set unit runs, it automatically creates a use case input submodule directory and its corresponding use case step input file set directory based on the automatic generation parameters of the current use case step, and then imports the required The standard input file in the standard input module is copied to the established use case step input file set directory and rewritten to form a corresponding use case step input file set.
优选地,所述测试模块包括执行单元,用于基于各所述用例步骤输入文件集,调用所述待测工具模块执行各用例步骤,输出执行结果。Preferably, the test module includes an execution unit, configured to call the tool module under test to execute each use case step based on the input file set of each use case step, and output an execution result.
优选地,所述用例输出子模块包括多个用例步骤输出文件集,每个所述用例步骤输出文件集为执行该用例步骤所输出的一个或多个用例步骤输出文件的集合;Preferably, the use case output submodule includes a plurality of use case step output file sets, each of the use case step output file sets is a collection of one or more use case step output files output by executing the use case step;
所述执行单元的输出执行结果包括,建立用例输出子模块目录和其下对应的用例步骤输出文件集目录,将执行结果放入所述用例步骤输出文件集目录内。The output execution result of the execution unit includes establishing a use case output submodule directory and a corresponding use case step output file set directory under it, and putting the execution result into the use case step output file set directory.
优选地,每个所述用例步骤配置子单元包括:Preferably, each of the use case step configuration subunits includes:
用例-步骤号,用于指示本用例步骤配置子单元所对应的用例步骤;Use case-step number, which is used to indicate the use case step corresponding to the configuration subunit of this use case step;
执行标识,用于指示本用例步骤是否执行;Execution flag, used to indicate whether the steps of this use case are executed;
所述执行单元基于执行标识确定是否执行该用例步骤号对应的用例步骤。The execution unit determines whether to execute the use case step corresponding to the use case step number based on the execution identifier.
优选地,每个所述用例步骤配置子单元包括结果判读参数,所述结果判读参数包括期望结果,所述期望结果为通过人工设置的执行该用例步骤后所期望的执行结果,用于作为判读执行结果的依据;Preferably, each of the use case step configuration subunits includes a result interpretation parameter, and the result interpretation parameter includes an expected result, and the expected result is the expected execution result after executing the use case step set manually, and is used as an interpretation the basis for execution results;
所述测试模块包括判读单元,用于基于所述结果判读参数的期望结果,与对应的所述用例步骤输出文件集内的执行结果进行对比,自动检验执行结果是否正确。The test module includes an interpreting unit, which is used to interpret the expected result of the parameter based on the result, compare it with the execution result in the corresponding use case step output file set, and automatically check whether the execution result is correct.
优选地,所述判读单元通过断言方法比对执行结果和结果判读参数。Preferably, the interpretation unit compares the execution result with the result interpretation parameter through an assertion method.
优选地,所述执行单元的执行结果包括日志信息,或者生成数据和日志信息;Preferably, the execution result of the execution unit includes log information, or generated data and log information;
所述结果判读参数包括期望数据值和期望日志信息;其中,如果执行结果为生成数据符合预期,则设置所述期望数据值,其为执行该用例步骤后各所述用例步骤输出文件中的各结果字段的所期望的生成数据值;如果执行结果为成功运行结束或报错退出符合预期,则设置所述期望日志信息,其为执行该用例步骤后所期望生成的日志;The result interpretation parameters include expected data values and expected log information; wherein, if the execution result is that the generated data meets expectations, then set the expected data values, which are the output files of each of the use case steps after executing the use case steps. The expected generated data value of the result field; if the execution result is that the successful operation ends or the error exit meets expectations, then set the expected log information, which is the log expected to be generated after executing the use case steps;
所述判读单元对于执行结果的检验为日志信息检验或生成数据检验,其中,在所述用例步骤的期待结果为成功运行结束或报错退出时进行日志信息检验,比对执行结果中的日志信息和结果判读参数中的期望日志信息;在所述用例步骤的期待结果为生成数据符合预期时进行生成数据检验,比对执行结果中的生成数据和结果判读参数中的期望数据值。The inspection of the execution result by the interpretation unit is log information inspection or generated data inspection, where the log information inspection is performed when the expected result of the use case step is the successful completion of the operation or an error exit, and the log information in the execution result is compared with the The expected log information in the result interpretation parameter; when the expected result of the use case step is that the generated data meets the expectation, the generated data inspection is performed, and the generated data in the execution result is compared with the expected data value in the result interpretation parameter.
优选地,所述结果判读参数包括测试成败标识,用于指示本用例步骤的测试是否通过,所述判读单元根据判读执行结果的情况自动填写。Preferably, the result interpretation parameter includes a test success or failure flag, which is used to indicate whether the test of the step of this use case is passed, and the interpretation unit automatically fills in according to the status of the interpretation execution result.
优选地,所述期望数据值可以为精确值、范围、枚举或正则。Preferably, the expected data value can be exact value, range, enumeration or regularization.
优选地,所述测试模块包括报告单元,用于在完成本轮测试后统计测试情况并输出测试报告。Preferably, the testing module includes a reporting unit, which is used to make statistical test results and output a test report after the current round of testing is completed.
优选地,所述测试报告可以包含总用例数、执行用例数、用例执行率、测试用例通过率、通过用例号及未通过用例号明细中的部分或全部。Preferably, the test report may include part or all of the total number of test cases, the number of executed use cases, the execution rate of test cases, the passing rate of test cases, the number of passed cases and the number of failed cases.
优选地,所述测试模块包括回归测试单元,用于进行一键回归测试。Preferably, the testing module includes a regression testing unit for one-key regression testing.
优选地,所述回归测试可以选择使用上轮测试的用例输入子模块进行一键回归测试,也可以通过修改所述配置模块的自动生成用例输入子模块标识和自动生成参数进行自动重建用例输入子模块的一键回归测试。Preferably, the regression test can choose to use the use case input submodule of the last round of testing for one-click regression testing, and can also automatically rebuild the use case input submodule by modifying the automatically generated use case input submodule identification and automatically generated parameters of the configuration module. One-click regression testing of modules.
优选地,所述基础信息配置单元还包括模块路径信息,用于设置各模块的根路径信息。Preferably, the basic information configuration unit further includes module path information, which is used to set the root path information of each module.
优选地,所述测试模块还包括读取配置单元,用于读取并存储所述配置模块中的配置信息,提供给测试模块的其他单元使用。Preferably, the test module further includes a configuration reading unit, which is used to read and store the configuration information in the configuration module for use by other units of the test module.
一种自动化测试方法,基于上述任意一种自动化测试框架实现,包括步骤:An automated testing method, implemented based on any of the above automated testing frameworks, comprising steps:
S1、搭建至少包括待测工具模块、标准输入模块、配置模块和测试模块的自动化测试框架;S1. Build an automated test framework including at least a tool module to be tested, a standard input module, a configuration module and a test module;
S2、运行测试模块,通过读取配置单元读取并存储配置模块的所有配置信息;S2. Run the test module, read and store all configuration information of the configuration module by reading the configuration unit;
S3、基于所读取的配置信息,遍历各期望执行的用例步骤逐个测试,并自动判读测试结果。S3. Based on the read configuration information, traverse the steps of each desired use case and test one by one, and automatically interpret the test results.
优选地,步骤S1包括:Preferably, step S1 includes:
导入待测工具模块和标准输入模块;建立测试模块;建立配置模块并配置其参数;建立用例模块根目录。Import the tool module to be tested and the standard input module; establish the test module; establish the configuration module and configure its parameters; establish the root directory of the use case module.
优选地,如果本轮测试需要人工建立用例输入子模块,则步骤S1还包括:Preferably, if the current round of testing needs to manually establish a use case input sub-module, step S1 also includes:
在用例模块根目录下手动建立用例输入子模块目录和其下的各用例步骤输入文件集目录,再手动建立各用例步骤输入文件放置于各对应的用例步骤输入文件集目录中形成用例步骤输入文件集,各用例步骤输入文件集构成用例输入子模块。Manually create the use case input submodule directory and the use case step input file set directory under the root directory of the use case module, and then manually create each use case step input file and place it in each corresponding use case step input file set directory to form a use case step input file Set, each use case step input file set constitutes the use case input sub-module.
优选地,步骤S3包括:Preferably, step S3 includes:
S31、基于所读取的配置信息,判断是否执行自动生成用例步骤输入文件集单元来自动建立用例步骤输入文件集;S31. Based on the read configuration information, judge whether to execute the unit for automatically generating a use case step input file set to automatically create a use case step input file set;
S32、基于用例步骤输入文件集,通过执行单元调用待测工具模块执行当前用例步骤,输出执行结果;S32. Based on the use case step input file set, the execution unit calls the tool module to be tested to execute the current use case step, and outputs the execution result;
S33、基于所读取的配置信息,判读单元检验执行结果,并根据检验情况对测试成败标识进行赋值。S33. Based on the read configuration information, interpret the unit inspection execution result, and assign a test success or failure flag according to the inspection situation.
优选地,步骤S3之后还包括步骤S4:报告单元统计步骤S3的测试情况并输出测试报告。Preferably, step S4 is further included after step S3: the reporting unit counts the test conditions of step S3 and outputs a test report.
优选地,步骤S4之后还包括步骤S5:在需要进行回归测试的情况下,通过回归测试单元进行一键回归测试。Preferably, step S5 is further included after step S4: in the case where regression testing is required, one-click regression testing is performed through the regression testing unit.
综上所述,与现有技术相比,本发明提供的一种自动化测试框架及方法,具有如下有益效果:In summary, compared with the prior art, an automated testing framework and method provided by the present invention have the following beneficial effects:
1.采用自动化测试框架,测试人员无需逐个用例步骤更改输入数据,而是交由测试工具自动完成,减少了手动修改的时间,大大提高了测试效率,降低了测试人员负担,可以把精力用于保障测试用例文件的准确性上;1. Using the automated testing framework, testers do not need to change the input data step by step, but let the test tool complete it automatically, which reduces the time for manual modification, greatly improves test efficiency, reduces the burden on testers, and can focus on Ensure the accuracy of test case files;
2.测试结果可视化,测试框架自动判断执行结果,运行结束后将展示测试通过情况,并根据要求生成测试报告,其包含总用例数、本次执行用例数、用例执行率、测试用例通过率、通过用例号及未通过用例号明细等;2. The test results are visualized, and the test framework automatically judges the execution results. After the running, the test passing status will be displayed, and a test report will be generated according to the requirements, which includes the total number of use cases, the number of current execution use cases, the execution rate of use cases, the pass rate of test cases, Passed use case number and failed use case number details, etc.;
3.复用性强,测试人员可根据一轮执行结束后是否有未通过用例来决定是否进行回归测试,通过更新配置文件可实现指定范围的用例集进行回归测试,复测过程中可使用上一轮已存在的输入文件或是重新对标准输入文件进行改写后执行。3. Strong reusability. Testers can decide whether to perform regression testing according to whether there are failed use cases after a round of execution. By updating the configuration file, a specified range of use case sets can be implemented for regression testing. During the retesting process, the above Execute a round of an existing input file or rewrite the standard input file.
附图说明Description of drawings
图1为本发明的自动化测试方法的流程图;Fig. 1 is the flowchart of automated testing method of the present invention;
图2为本发明的自动化测试框架其中一个实施例的示意图。FIG. 2 is a schematic diagram of an embodiment of the automated testing framework of the present invention.
具体实施方式Detailed ways
以下结合附图和具体实施方式对本发明提出的一种自动化测试框架及方法作进一步详细说明。根据下面说明,本发明的优点和特征将更清楚。需要说明的是,附图采用非常简化的形式且均使用非精准的比例,仅用以方便、明晰地辅助说明本发明实施方式的目的,并非用以限定本发明实施的限定条件,故不具技术上的实质意义,任何结构的修饰、比例关系的改变或大小的调整,在不影响本发明所能产生的功效及所能达成的目的下,均应仍落在本发明所揭示的技术内容能涵盖的范围内。An automated testing framework and method proposed by the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. The advantages and features of the present invention will become clearer from the following description. It should be noted that the drawings are in a very simplified form and all use inaccurate proportions, which are only used to facilitate and clearly illustrate the purpose of the implementation of the present invention, and are not used to limit the limiting conditions for the implementation of the present invention, so they do not have technical In the substantive meaning above, any modification of structure, change of proportional relationship or adjustment of size should still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and goals that can be achieved by the present invention. within the scope covered.
需要说明的是,在本发明中,诸如和等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括明确列出的要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。It should be noted that in the present invention, relational terms such as and etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. This actual relationship or sequence. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only the elements explicitly listed, but also includes none other elements specifically listed, or also include elements inherent in such a process, method, article, or apparatus.
结合附图1~2,本发明提供一种自动化测试框架及方法,用于根据预先编写好的测试用例文档,对轨旁安全平台离线工具进行软件测试,其中,测试用例文档中包括多个用例,每个用例包括1个或多个用例步骤,软件测试由各用例步骤测试构成。所述自动化测试框架包括待测工具模块、标准输入模块、用例模块、配置模块和测试模块;其中,In conjunction with accompanying drawings 1-2, the present invention provides an automated testing framework and method for performing software testing on off-line tools of the trackside safety platform according to pre-written test case documents, wherein the test case documents include multiple use cases , each use case includes one or more use case steps, and software testing is composed of each use case step test. The automated testing framework includes a tool module to be tested, a standard input module, a use case module, a configuration module and a test module; wherein,
待测工具模块为轨旁安全平台离线工具。本实施例中,如附图2所示,其为测试框架根目录下的“OfflineTool”文件夹。The tool module to be tested is an offline tool of the trackside safety platform. In this embodiment, as shown in Figure 2, it is the "OfflineTool" folder under the root directory of the test framework.
标准输入模块为可供待测工具模块成功运行的全部标准输入文件的集合。本实施例中,其为测试框架根目录下的“StandardInput”文件夹,其内包括各车站的本地设备与远端设备的设备信息及通信协议参数、各类协议的配置信息、相匹配的MD5文件等标准输入文件。The standard input module is a collection of all standard input files available for the tool module to be tested to run successfully. In this embodiment, it is the "StandardInput" folder under the root directory of the test framework, which includes equipment information and communication protocol parameters of local equipment and remote equipment at each station, configuration information of various protocols, and matching MD5 files etc. standard input files.
用例模块包括用例输入子模块和用例输出子模块;其中,用例输入子模块为人工建立或基于标准输入模块自动生成的,用于执行各用例所需的输入文件的集合,其包括多个用例步骤输入文件集,每个用例步骤输入文件集为执行该用例步骤所需的一个或多个用例步骤输入文件的集合,每个用例步骤输入文件可能为人工准备的符合用例步骤的输入文件,也可能为为从所述标准输入模块中复制并改写的标准输入文件;用例输出子模块为执行各用例后生成的输出文件的集合,包括多个用例步骤输出文件集,每个用例步骤输出文件集为执行该用例步骤所输出的一个或多个用例步骤输出文件的集合。本实施例中,测试框架根目录下的“TestCase”文件夹为用例模块,其内的“Input”文件夹为用例输入子模块,其内的以“用例号-步骤号”命名的各文件夹为各用例步骤输入文件集,其内存放执行该用例步骤所需的各用例步骤输入文件(如“TestCase1-step1”文件夹存放执行1号用例的步骤1所需的输入文件);其内的“Output”文件夹为用例输出子模块,其内的以“用例号-步骤号”命名的各文件夹为各用例步骤输出文件集,其内存放执行该用例步骤所输出的各用例步骤输出文件。The use case module includes a use case input sub-module and a use case output sub-module; among them, the use case input sub-module is manually created or automatically generated based on the standard input module, and is used to execute a collection of input files required for each use case, which includes multiple use case steps Input file set, each use case step input file set is a collection of one or more use case step input files required to execute the use case step, each use case step input file may be an input file prepared manually to meet the use case step, or may For the standard input file copied and rewritten from the standard input module; the use case output submodule is a collection of output files generated after each use case is executed, including a plurality of use case step output file sets, and each use case step output file set is A collection of one or more use case step output files that are output by executing this use case step. In this embodiment, the "TestCase" folder under the root directory of the test framework is a use case module, and the "Input" folder in it is a use case input sub-module, and each folder named after "use case number-step number" in it Input file set for each use case step, which stores the input files of each use case step required to execute the use case step (for example, the "TestCase1-step1" folder stores the input file required to execute step 1 of use case No. 1); The "Output" folder is the use case output submodule, and the folders named "use case number-step number" in it are the output file sets of each use case step, which stores the output files of each use case step output by executing the use case step .
配置模块用于设置及保存所述自动化测试框架的参数配置;本实施例中,其为测试框架根目录下的“Configuration”文件夹下的“testConfig.xlsx”文件;其包括基础信息配置单元和用例配置单元,其中:The configuration module is used to set and save the parameter configuration of the automated test framework; in this embodiment, it is the "testConfig.xlsx" file under the "Configuration" folder under the root directory of the test framework; it includes the basic information configuration unit and Use case hive, where:
基础信息配置单元包括模块路径信息和自动生成用例输入子模块标识;其中,模块路径信息为各模块的根路径信息;自动生成用例输入子模块标识用于指示是否自动生成用例输入子模块,包括“是”和“否”2个选项。The basic information configuration unit includes module path information and automatically generated use case input sub-module identification; wherein, module path information is the root path information of each module; automatically generated use case input sub-module identification is used to indicate whether to automatically generate use case input sub-module, including " There are 2 options "Yes" and "No".
用例配置单元包括与各用例步骤一一对应的多个用例步骤配置子单元,用于对执行各用例步骤的相关参数进行配置。每个用例步骤配置子单元包括:The use case configuration unit includes a plurality of use case step configuration subunits one-to-one corresponding to each use case step, and is used to configure relevant parameters for executing each use case step. Each use case step configuration subunit includes:
用例-步骤号,指示本用例步骤配置子单元所对应的用例步骤;Use case-step number, indicating the use case step corresponding to the configuration subunit of this use case step;
执行标识,指示该用例步骤是否执行,包括“是”和“否”2个选项;Execution flag, indicating whether the use case step is executed, including two options of "yes" and "no";
自动生成参数,为用于该用例步骤自动生成的用例步骤输入文件集的相关参数,其包括复改文件名称、改写字段名称和改写目标值,分别用于指示该用例步骤中需要复制并改写的标准输入文件的名称,该标准输入文件中需要改写的字段名称和该字段的改写目标值;Automatically generate parameters, which are used to input the relevant parameters of the file set for the use case step automatically generated by the use case step, including the rewrite file name, rewrite field name and rewrite target value, which are used to indicate the need to copy and rewrite in the use case step The name of the standard input file, the name of the field to be rewritten in the standard input file and the rewriting target value of the field;
结果判读参数,包括期望结果和测试成败标识。其中,期望结果为通过人工设置的执行该用例步骤后所期望的执行结果,用于作为判读执行结果的依据,其包括期望数据值和期望日志信息;其中,如果执行结果为生成数据符合预期,则设置期望数据值,其为执行该用例步骤后各用例步骤输出文件中的各结果字段的所期望的生成数据值;期望日志信息为执行该用例步骤后所期望生成的日志,其包括期望成功日志和期望报错日志两类:如果执行结果为成功运行结束符合预期,则期望日志信息为期望成功日志;如果执行结果为报错退出符合预期,则期望日志信息为期望报错日志,内含期望报错语句。测试成败标识用于指示该用例步骤的测试是否通过,包括“Pass”和“Fail”2个选项,其根据判读执行结果的情况自动填写。其中,在一些实施例中,期望数据值无需配置精确值,可以为范围、枚举、正则等形式。Result interpretation parameters, including expected results and test success or failure marks. Among them, the expected result is the expected execution result after executing the steps of the use case manually set, which is used as the basis for judging the execution result, which includes expected data values and expected log information; where, if the execution result is that the generated data meets expectations, Then set the expected data value, which is the expected generated data value of each result field in the output file of each use case step after executing the use case step; the expected log information is the log expected to be generated after executing the use case step, which includes the expected success There are two types of log and expected error log: if the execution result is that the successful operation ends in line with expectations, the expected log information is the expected success log; if the execution result is error reporting and exit meets expectations, the expected log information is the expected error log, which contains the expected error statement . The test success or failure flag is used to indicate whether the test of the use case step is passed or not, including two options of "Pass" and "Fail", which are automatically filled in according to the interpretation of the execution result. Wherein, in some embodiments, the expected data value does not need to be configured with an exact value, and may be in the form of a range, enumeration, regularization, or the like.
测试模块用于基于标准输入模块、用例模块和配置模块对待测工具模块进行自动化检测;本实施例中,其为测试框架根目录下的“Test.bat”文件。测试模块包括:The test module is used to automatically detect the tool module to be tested based on the standard input module, the use case module and the configuration module; in this embodiment, it is the "Test.bat" file in the root directory of the test framework. Test modules include:
读取配置单元,用于读取并存储配置模块中的配置信息,提供给测试模块的其他单元使用;Read the configuration unit, which is used to read and store the configuration information in the configuration module, and provide it to other units of the test module;
自动生成用例步骤输入文件集单元,用于基于所读取的配置信息中的自动生成参数自动生成该用例步骤的用例步骤输入文件集,本单元的运行与否基于所读取的自动生成用例输入子模块标识确定。其中,如果自动生成用例输入子模块标识为“是”则执行本单元,其基于所读取的当前用例步骤的自动生成参数,自动建立用例输入子模块目录(如已经存在则不再重复建立)和其下对应的用例步骤输入文件集目录,再将所需要的标准输入模块中的标准输入文件复制并改写到所建立的用例步骤输入文件集目录中,形成该用例步骤输入文件集;如果自动生成用例输入子模块标识为“否”则不执行本单元,需要人工建立用例输入子模块,即手动建立用例输入子模块目录和其下的各用例步骤输入文件集目录,再手动准备符合用例步骤的用例步骤输入文件放置到各对应的用例步骤输入文件集目录中,最终形成由各用例步骤输入文件集构成的用例输入子模块,手动方式通常适用于不便于自动改写的情况。Automatically generate the use case step input file set unit, which is used to automatically generate the use case step input file set of the use case step based on the automatic generation parameters in the read configuration information, and whether the operation of this unit is based on the read automatically generated use case input Submodule ID OK. Among them, if the automatically generated use case input submodule flag is "Yes", then execute this unit, which automatically creates the use case input submodule directory based on the read automatic generation parameters of the current use case step (if it already exists, it will not be repeated) and the corresponding use case step input file set directory, and then copy and rewrite the standard input files in the required standard input module to the established use case step input file set directory to form the use case step input file set; if automatically If the generated use case input submodule flag is "No", this unit will not be executed, and the use case input submodule needs to be manually established, that is, the use case input submodule directory and the input file set directory of each use case step under it are manually created, and then the steps that meet the use case are manually prepared. The use case step input files are placed in the corresponding use case step input file set directories, and finally a use case input submodule composed of each use case step input file set is formed. The manual method is usually suitable for situations where automatic rewriting is not convenient.
执行单元,用于基于各用例步骤输入文件集,调用待测工具模块执行各用例步骤,输出执行结果。其中,执行单元将对应的用例步骤输入文件集作为输入,运行待测工具模块生成执行结果,建立用例输出子模块目录(如已经存在则不再重复建立)和其下对应的用例步骤输出文件集目录,将执行结果放入该用例步骤输出文件集目录内。其中,执行结果包括日志信息和生成数据,日志信息包括运行成功日志和报错日志,当该用例步骤运行成功后,输出的日志信息为运行成功日志,并且其执行结果除了日志信息还包括生成数据;否则,输出的日志信息为包含报错语句的报错日志,所述报错语句用于指明具体的运行错误。The execution unit is configured to input a file set based on each use case step, invoke the tool module to be tested to execute each use case step, and output an execution result. Among them, the execution unit takes the corresponding use case step input file set as input, runs the tool module to be tested to generate the execution result, and establishes the use case output submodule directory (if it already exists, it will not be repeated) and the corresponding use case step output file set under it directory, put the execution result into the output file set directory of the use case step. Among them, the execution result includes log information and generated data, and the log information includes the running success log and error reporting log. When the use case step runs successfully, the output log information is the running success log, and the execution result includes the generated data in addition to the log information; Otherwise, the output log information is an error log including an error statement, and the error statement is used to indicate a specific operation error.
判读单元,基于所读取的配置信息,检验执行单元输出的执行结果,并根据检验情况对配置信息的测试成败标识进行赋值。其中,判读单元通过断言方法比对结果判读参数和对应的用例步骤输出文件集内的执行结果;对于执行结果的检验为日志信息检验或生成数据检验,其中,日志信息检验包括2种情况:在该用例步骤的期待结果为成功运行至结束时,此时不关注生成数据的具体值(例如试验某用例步骤输入文件内的一个数据的边界值是否会使待测工具模块成功运行至结束,此时不关心生成数据的具体值,只期待该输入文件的边界值能顺利运行至结束),所以只需判断所输出的运行成功日志是否符合配置信息中的期望成功日志;在该用例步骤的期待结果为报错退出时,此情况不生成数据,则判断所输出的执行结果的报错日志中的报错语句是否符合配置信息中的期望报错日志。生成数据检验适用于,期待结果为生成数据符合预期的用例步骤,能够生成数据的前提一定是该用例步骤顺利运行至结束(因为一旦出错将不会生成任何输出),所以此情况只需判断该生成数据是否符合配置模块中的结果期望值,无需进行日志信息检验。最后,如果比对结果完全一致则对测试成败标识赋值“Pass”,否则置为“Fail”。The interpretation unit checks the execution result output by the execution unit based on the read configuration information, and assigns a value to the test success or failure flag of the configuration information according to the inspection situation. Among them, the interpretation unit compares the result interpretation parameters and the corresponding use case steps to output the execution results in the file set through the assertion method; the inspection of the execution results is the log information inspection or the generated data inspection, and the log information inspection includes two situations: The expected result of the use case step is to successfully run to the end, and do not pay attention to the specific value of the generated data at this time (for example, whether the boundary value of a data in the input file of a test use case step will make the tool module under test run successfully to the end, then do not care about the specific value of the generated data, and only expect the boundary value of the input file to run smoothly to the end), so it is only necessary to judge whether the output success log meets the expected success log in the configuration information; the expectation of the use case step When the result is an error report and no data is generated in this case, it is judged whether the error statement in the error report log of the output execution result conforms to the expected error report log in the configuration information. Generated data inspection is applicable. The expected result is that the generated data meets the expected use case steps. The premise of being able to generate data must be that the use case step runs smoothly to the end (because no output will be generated if an error occurs), so this situation only needs to be judged. Whether the generated data conforms to the expected value of the result in the configuration module does not need to check the log information. Finally, if the comparison results are completely consistent, the test success or failure flag is assigned "Pass", otherwise it is set to "Fail".
报告单元,用于在完成本轮测试后(执行标识为“是”的用例步骤全部执行完毕),统计测试情况并输出测试报告。其中,所述测试报告可以包含总用例数、执行用例数、用例执行率、测试用例通过率、通过用例号及未通过用例号明细等,能够便于测试人员决策是否进行回归测试。The reporting unit is configured to collect test statistics and output a test report after the current round of testing is completed (the use case steps marked as "yes" are all executed). Wherein, the test report may include the total number of use cases, the number of executed use cases, the execution rate of use cases, the pass rate of test cases, the details of the passed use case numbers and the failed use case numbers, etc., which can facilitate testers to decide whether to perform regression testing.
回归测试单元,用于进行一键回归测试。其中,是否进行回归测试由测试人员根据报告单元所输出的测试报告的情况决定,回归测试可以选择使用上轮测试的用例输入子模块进行一键回归测试,也可以通过修改配置模块的自动生成用例输入子模块标识和自动生成参数进行自动重建用例输入子模块的一键回归测试。Regression testing unit for one-click regression testing. Among them, whether to perform regression testing is determined by the tester according to the test report output by the reporting unit. The regression testing can choose to use the use case input sub-module of the last round of testing for one-click regression testing, or modify the configuration module to automatically generate use cases. Input sub-module identification and auto-generate parameters for one-click regression testing of input sub-modules for automatic reconstruction of use cases.
另外,如附图1所示,所述自动化测试方法包括步骤:In addition, as shown in accompanying drawing 1, described automated testing method comprises steps:
S1、搭建自动化测试框架。包括:导入待测工具模块和标准输入模块;建立测试模块;建立配置模块并配置其参数;建立用例模块根目录;如果本轮测试需要人工建立用例输入子模块,则在用例模块根目录下手动建立用例输入子模块目录和其下的各用例步骤输入文件集目录,再手动将所需要的输入文件放置于对应用例步骤号文件夹,最终形成用例输入子模块。S1. Build an automated testing framework. Including: importing the tool module to be tested and the standard input module; establishing the test module; establishing the configuration module and configuring its parameters; establishing the root directory of the use case module; Establish the use case input submodule directory and the use case step input file set directory under it, and then manually place the required input files in the folder corresponding to the use case step number, and finally form the use case input submodule.
S2、运行测试模块,通过读取配置单元读取并存储配置模块的所有配置信息。S2. Run the test module, and read and store all configuration information of the configuration module by reading the configuration unit.
S3、基于所读取的配置信息,遍历各期望执行的用例步骤(执行标识为“是”的用例步骤)逐个测试,并自动判读测试结果;包括步骤:S3. Based on the read configuration information, traverse each desired execution of the use case steps (execute the use case steps marked as "yes") to test one by one, and automatically interpret the test results; including steps:
S31、基于所读取的配置信息,判断是否执行自动生成用例步骤输入文件集单元来自动建立用例步骤输入文件集。具体为,如果自动生成用例输入子模块标识为“是”则执行本单元,基于所读取的当前用例步骤的自动生成参数,自动建立用例输入子模块目录(如已经存在则不再重复建立)和对应的用例步骤输入文件集目录,再将所需要的标准输入模块中的标准输入文件复制到所建立的用例步骤输入文件集目录中并改写,形成该用例步骤输入文件集;否则不进行上述操作,使用步骤S1中已人工建立的用例输入子模块的该用例步骤输入文件集。S31. Based on the read configuration information, judge whether to execute the unit of automatically generating the input file set of use case steps to automatically create the input file set of use case steps. Specifically, if the automatically generated use case input submodule flag is "Yes", execute this unit, and automatically create a use case input submodule directory based on the read automatic generation parameters of the current use case step (if it already exists, it will not be repeated) and the corresponding use case step input file set directory, and then copy the standard input files in the required standard input module to the established use case step input file set directory and rewrite them to form the use case step input file set; otherwise, do not perform the above Operation, use the use case step input file set of the use case input sub-module that has been manually established in step S1.
S32、基于用例步骤输入文件集,通过执行单元调用待测工具模块执行当前用例步骤,输出执行结果;其中,将当前的用例步骤输入文件集作为输入,运行待测工具模块生成执行结果,建立用例输出子模块目录(如已经存在则不再重复建立)和其下对应的用例步骤输出文件集目录,将执行结果放入该用例步骤输出文件集目录内;其中,执行结果包括生成数据和日志信息,日志信息包括运行成功日志和报错日志。S32. Based on the use case step input file set, call the tool module to be tested to execute the current use case step through the execution unit, and output the execution result; where the current use case step input file set is used as input, run the tool module to be tested to generate an execution result, and establish a use case Output the submodule directory (if it already exists, do not repeat it) and the corresponding use case step output file set directory under it, and put the execution result into the use case step output file set directory; where the execution result includes generated data and log information , the log information includes running success logs and error logs.
S33、基于所读取的配置信息,判读单元检验执行结果,并根据检验情况对测试成败标识进行赋值。其中,判读单元通过断言方法比对结果判读参数和对应的用例步骤输出文件集内的执行结果,对于执行结果的检验为日志信息检验或生成数据检验;如果执行结果为成功运行结束符合预期,则判断所输出的成功日志是否符合配置信息中的期望成功日志;如果执行结果为报错退出符合预期,则判断所输出的执行结果的报错日志中的报错语句是否符合配置信息中的期望报错日志;如果执行结果为生成数据符合预期,则判断该生成数据是否符合配置模块中的结果期望值。最后,如果比对结果完全一致则对测试成败标识赋值“Pass”,否则置为“Fail”。S33. Based on the read configuration information, interpret the unit inspection execution result, and assign a test success or failure flag according to the inspection situation. Among them, the interpretation unit compares the result interpretation parameters and the corresponding use case steps to output the execution results in the file set through the assertion method, and the inspection of the execution results is log information inspection or generated data inspection; if the execution result is successful and the operation ends in line with expectations, then Judging whether the output success log conforms to the expected success log in the configuration information; if the execution result is an error report and exit meets expectations, then judge whether the error statement in the error report log of the output execution result meets the expected error log in the configuration information; if If the execution result is that the generated data meets expectations, it is judged whether the generated data meets the expected result value in the configuration module. Finally, if the comparison results are completely consistent, the test success or failure flag is assigned "Pass", otherwise it is set to "Fail".
S4、报告单元统计步骤S3的测试情况并输出测试报告。其中,所述测试报告可以包含总用例数、执行用例数、用例执行率、测试用例通过率、通过用例号及未通过用例号明细等,能够便于测试人员决策是否进行回归测试;S4. The reporting unit counts the test situation in step S3 and outputs a test report. Wherein, the test report may include the total number of use cases, the number of execution use cases, the execution rate of use cases, the pass rate of test cases, the details of the passed use case number and the failed use case number, etc., which can facilitate the tester to decide whether to perform regression testing;
S5、在需要进行回归测试的情况下,可以通过回归测试单元进行一键回归测试;其中,是否进行回归测试由测试人员根据报告单元所输出的测试报告的情况决定,回归测试可以选择使用上轮测试的用例输入子模块进行一键回归测试,也可以通过修改配置模块的自动生成用例输入子模块标识和自动生成参数进行自动重建用例输入子模块的一键回归测试。S5. In the case where regression testing is required, one-click regression testing can be performed through the regression testing unit; among them, whether to perform regression testing is determined by the tester according to the test report output by the reporting unit, and the regression testing can choose to use the last round The test case input sub-module performs one-key regression test, and can also perform one-key regression test of automatically rebuilding the use case input sub-module by modifying the automatic generation of use case input sub-module identification and automatic generation parameters of the configuration module.
下面,提供一个具体实施例对本发明进一步描述:Below, a specific embodiment is provided to further describe the present invention:
步骤1、在完成测试用例文档的基础上,搭建自动化测试框架:Step 1. On the basis of completing the test case document, build an automated test framework:
如附图2所示,将离线工具文件夹“OfflineTool”、标准输入文件夹“StandardInput”、自动化测试框架批处理脚本文件Test.bat置于测试框架根目录文件夹下;在测试框架根目录文件夹下建立用例文件夹“TestCase”和配置文件“Configuration”,本实施例无需人工建立用例输入子模块。As shown in Figure 2, place the offline tool folder "OfflineTool", the standard input folder "StandardInput", and the automated test framework batch script file Test.bat under the test framework root directory folder; in the test framework root directory file Create a use case folder "TestCase" and a configuration file "Configuration" under the folder. This embodiment does not need to manually create a use case input sub-module.
测试框架配置文件准备:建立excel文件“testConfig.xlsx”,该配置表格包含两个sheet页,第一个sheet页为“BasicInfo”页,其包含本次测试所需的基础信息,包括离线工具文件夹路径、用例文件夹路径、标准输入文件夹路径和自动生成用例输入子模块选项;其中,自动生成用例输入子模块选项由人工判断本轮测试是否需要自动生成用例输入子模块,若需要则将该选项置为“是”,否则置为“否”。Test framework configuration file preparation: create an excel file "testConfig.xlsx", the configuration table contains two sheet pages, the first sheet page is "BasicInfo" page, which contains the basic information required for this test, including offline tool files Folder path, use case folder path, standard input folder path, and the option to automatically generate use case input submodules; among them, the option to automatically generate use case input submodules is manually judged whether the current round of testing needs to automatically generate use case input submodules, and if necessary, it will be Set this option to "Yes", otherwise set to "No".
第二个sheet页为“TestCaseInfo”页,其主要包含以下配置信息:The second sheet page is the "TestCaseInfo" page, which mainly contains the following configuration information:
A列:用例-步骤号,例:0001-step1。Column A: use case-step number, example: 0001-step1.
B列:执行标识,可用于筛选本轮需要测试的用例步骤。Column B: Execution ID, which can be used to filter the use case steps that need to be tested in this round.
(C-E列为自动生成参数)(C-E are listed as auto-generated parameters)
C列:用例步骤中需要修改的标准输入文件的名称,本测试框架目前支持ini、xml、par、md5格式的文件修改。Column C: the name of the standard input file that needs to be modified in the use case step. This test framework currently supports file modification in the formats of ini, xml, par, and md5.
D列:待修改字段,写明标准输入文件中需要修改的字段位置及名称。Column D: the field to be modified, indicating the position and name of the field to be modified in the standard input file.
E列:D列中的字段期望修改的目标值。Column E: The field in column D is expected to modify the target value.
(F-J列为结果判读参数,其中,F-H列为期望数据值)(F-J columns are the result interpretation parameters, among which, F-H columns are the expected data values)
F列:执行结果对应的输出文件的名称。Column F: the name of the output file corresponding to the execution result.
G列:执行结果体现在输出文件中的字段名称。Column G: The execution result is reflected in the field name in the output file.
H列:该字段的期望值。Column H: The expected value of the field.
I列:期望日志信息,执行结果若存在错误或成功日志,需将预期的日志信息提前录入在此。Column I: Expected log information. If there is an error or success log in the execution result, the expected log information needs to be entered here in advance.
J列:测试成败标识。Column J: test success or failure identification.
步骤2、读取配置信息:运行自动化测试框架批处理脚本文件“Test.bat”,读取并存储配置表格中的所有配置信息。Step 2. Read configuration information: run the automated test framework batch script file "Test.bat" to read and store all configuration information in the configuration table.
步骤3、遍历各执行标识为“是”的用例步骤运行测试:Step 3. Traversing each use case step whose execution flag is "Yes" to run the test:
自动化测试框架批处理脚本文件“Test.bat”遍历配置信息A列中的用例-步骤号,于用例文件夹“TestCase”下生成用例输入子模块文件夹“Input”(仅在其不存在时建立),并在其下生成以当前用例-步骤号命名的用例步骤输入文件集文件夹,并按配置表格C-E列要求将标准输入文件夹“StandardInput”下所需要的标准文件复制到用例步骤输入文件集文件夹并进行修改;目前,本测试框架支持ini、xml、par和md5共4种类型的文件改写,改写后同步更新md5文件中的md5值。The automated test framework batch script file "Test.bat" traverses the use case-step number in column A of the configuration information, and generates the use case input submodule folder "Input" under the use case folder "TestCase" (created only if it does not exist ), and generate a use case step input file set folder named after the current use case-step number under it, and copy the standard files required under the standard input folder "StandardInput" to the use case step input file according to the requirements of the C-E column of the configuration table Collect folders and modify them; currently, this test framework supports four types of file rewriting: ini, xml, par, and md5. After rewriting, the md5 value in the md5 file is updated synchronously.
调用离线工具文件夹“OfflineTool”下的轨旁安全平台离线工具批处理脚本文件“run.bat”,执行当前用例步骤生成执行结果,于用例文件夹“TestCase”下生成用例输出子模块文件夹“Output”(如已经存在则不再重复建立),并在其下生成以当前用例-步骤号命名的用例步骤输出文件集文件夹,将生成的数据文件及日志文件放入该用例步骤输出文件集文件夹内。其中,成功日志文件命名为“log.log”,报错日志文件命名为“error.log”。Call the trackside safety platform offline tool batch script file "run.bat" under the offline tool folder "OfflineTool", execute the current use case steps to generate execution results, and generate the use case output submodule folder under the use case folder "TestCase" Output" (if it already exists, it will not be created repeatedly), and a use case step output file set folder named after the current use case-step number will be generated under it, and the generated data files and log files will be put into the use case step output file set folder. Among them, the success log file is named "log.log", and the error log file is named "error.log".
结束当前用例步骤执行后,自动检查执行结果是否符合配置表格F-H的预期结果。如果执行结果为生成数据符合预期,则判断F-G列对应的数据文件中字段数据是否符合H列的期望值;如本身预期结果即为成功运行至结束,则检查“log.log”中的成功结束标识语句是否符合I列预期的成功日志信息;如本身预期结果即为报错退出,则检查“error.log”中的报错日志是否符合I列预期的报错日志信息。最后,符合预期则置J列为“Pass”,否则置为“Fail”。After the execution of the steps of the current use case is completed, it is automatically checked whether the execution results meet the expected results of the configuration form F-H. If the execution result is that the generated data meets expectations, then judge whether the field data in the data file corresponding to columns F-G meets the expected value of column H; if the expected result is successful operation to the end, then check the successful end flag in "log.log" Whether the statement conforms to the expected success log information in column I; if the expected result is an error exit, check whether the error log in "error.log" meets the expected error log information in column I. Finally, set the J column as "Pass" if it meets expectations, otherwise set it as "Fail".
步骤4、输出测试报告:运行结束后,在配置表格新建sheet页“TestReport”页,其中将展示总用例个数、本次执行的用例个数、用例执行率、测试用例通过率,通过用例号及未通过用例号明细等关键信息。Step 4. Output the test report: After the operation is completed, create a new sheet page "TestReport" page in the configuration form, which will display the total number of use cases, the number of use cases executed this time, the execution rate of the test cases, the passing rate of the test cases, and the number of the passed use cases And key information such as the details of the failed use case number.
步骤5、回归测试:若回归测试可直接使用上一轮的用例输入子模块,或用例输入子模块无需自动修改生成的,可在确保“TestCase”文件夹下存在符合用例步骤的各用例步骤输入文件集的情况下,通过将“BasicInfo”页的自动生成用例输入子模块选项置为“否”,并将“TestCaseInfo”页中对应的用例步骤的B列“是否执行”置为“是”,再启动自动化测试框架批处理脚本文件“Test.bat”批量运行即可进行回归测试。Step 5. Regression test: If the regression test can directly use the use case input submodule of the previous round, or the use case input submodule does not need to be automatically modified and generated, you can ensure that there are use case step inputs that meet the use case steps under the "TestCase" folder In the case of a file set, by setting the option of automatically generating the input submodule of the use case on the "BasicInfo" page to "No", and setting the "Whether to execute" in column B of the corresponding use case step on the "TestCaseInfo" page to "Yes", Then start the automated test framework batch script file "Test.bat" to run in batches to perform regression testing.
综上所述,本发明提供的一种自动化测试框架及方法,能够对于适用测试框架的每个用例步骤在提供的标准输入数据基础上改写后,依次执行自动化测试;对于复杂的不便自动改写输入数据的用例步骤,也可人工准备相应输入数据后,统一执行自动化测试;完成指定测试步骤后,通过对比预期结果与实际结果,展示每个用例步骤的通过情况;可生成测试报告,包含测试用例数、测试通过率等关键信息;对于测试失败的案例,后续可以使用该测试框架一键回归,为多轮测试提供极大便利。In summary, an automated testing framework and method provided by the present invention can perform automated testing sequentially after each use case step of the applicable testing framework is rewritten on the basis of the provided standard input data; for complicated and inconvenient automatic rewriting input The use case steps of the data can also be manually prepared for the corresponding input data, and then the automated test will be executed uniformly; after the specified test steps are completed, the passing status of each use case step will be displayed by comparing the expected results with the actual results; test reports can be generated, including test cases Key information such as data count and test pass rate; for test failure cases, the test framework can be used for one-click regression in the future, which provides great convenience for multiple rounds of testing.
尽管本发明的内容已经通过上述优选实施例作了详细介绍,但应当认识到上述的描述不应被认为是对本发明的限制。在本领域技术人员阅读了上述内容后,对于本发明的多种修改和替代都将是显而易见的。因此,本发明的保护范围应由所附的权利要求来限定。Although the content of the present invention has been described in detail through the above preferred embodiments, it should be understood that the above description should not be considered as limiting the present invention. Various modifications and alterations to the present invention will become apparent to those skilled in the art upon reading the above disclosure. Therefore, the protection scope of the present invention should be defined by the appended claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211700177.3ACN115952094B (en) | 2022-12-28 | 2022-12-28 | An automated testing framework and method |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211700177.3ACN115952094B (en) | 2022-12-28 | 2022-12-28 | An automated testing framework and method |
| Publication Number | Publication Date |
|---|---|
| CN115952094Atrue CN115952094A (en) | 2023-04-11 |
| CN115952094B CN115952094B (en) | 2025-08-05 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211700177.3AActiveCN115952094B (en) | 2022-12-28 | 2022-12-28 | An automated testing framework and method |
| Country | Link |
|---|---|
| CN (1) | CN115952094B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9268672B1 (en)* | 2014-05-27 | 2016-02-23 | Amazon Technologies, Inc. | Automated test case generation for applications |
| CN108287788A (en)* | 2017-12-26 | 2018-07-17 | 广东睿江云计算股份有限公司 | A kind of use-case step matching method based on test case, system |
| CN108984390A (en)* | 2018-06-04 | 2018-12-11 | 卡斯柯信号有限公司 | For the automatic test general framework of signal system off-line tools and its application |
| CN112181846A (en)* | 2020-10-20 | 2021-01-05 | 公安部交通管理科学研究所 | Automatic test platform and method for traffic signal control system messages |
| WO2022054101A1 (en)* | 2020-09-10 | 2022-03-17 | Tekvision Softtech & Accessibility Solutions Llp | Method and system for automated software accessibility testing |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9268672B1 (en)* | 2014-05-27 | 2016-02-23 | Amazon Technologies, Inc. | Automated test case generation for applications |
| CN108287788A (en)* | 2017-12-26 | 2018-07-17 | 广东睿江云计算股份有限公司 | A kind of use-case step matching method based on test case, system |
| CN108984390A (en)* | 2018-06-04 | 2018-12-11 | 卡斯柯信号有限公司 | For the automatic test general framework of signal system off-line tools and its application |
| WO2022054101A1 (en)* | 2020-09-10 | 2022-03-17 | Tekvision Softtech & Accessibility Solutions Llp | Method and system for automated software accessibility testing |
| CN112181846A (en)* | 2020-10-20 | 2021-01-05 | 公安部交通管理科学研究所 | Automatic test platform and method for traffic signal control system messages |
| Publication number | Publication date |
|---|---|
| CN115952094B (en) | 2025-08-05 |
| Publication | Publication Date | Title |
|---|---|---|
| CN100401264C (en) | Data-driven automated testing system and method | |
| CN106846203B (en) | An intelligent scoring method and system | |
| CN115599750A (en) | A smart substation virtual circuit checking method, system, equipment and storage medium | |
| CN112416715B (en) | Computer interlocking performance test system based on operation scene | |
| CN109656820A (en) | Intelligent automation test macro based on CBTC | |
| CN113408100B (en) | Virtual loop mirror image simulation transmission method based on intelligent maintenance platform | |
| CN109005079A (en) | A kind of detection method and device of electric automobile charging pile communication protocol | |
| CN114385649A (en) | A system and method for automatic updating of interlocking logic rule configuration files | |
| CN111858298B (en) | Software testing method based on 3V model | |
| CN109684204A (en) | A kind of http interface automatic test approach | |
| CN113067748A (en) | Broadband micro-power physical layer consistency test system in power consumption information acquisition system | |
| CN114661615B (en) | FPGA software testing method and device | |
| CN109815124B (en) | MBSE-based interlocking function defect analysis method and device and interlocking system | |
| CN115952094A (en) | An automated testing framework and method | |
| CN113050925B (en) | Block chain intelligent contract repairing method and device | |
| CN114661584A (en) | Testing device for software testing and using method | |
| CN108267968B (en) | Collaborative semi-physical simulation optical fiber data interaction security verification method | |
| CN112597747A (en) | Data table checking method and device, electronic equipment and storage medium | |
| CN109508204B (en) | Front-end code quality detection method and device | |
| CN110795142B (en) | Configuration file generation method and device | |
| CN116090380B (en) | Automatic method and device for verifying digital integrated circuit, storage medium and terminal | |
| CN117971692A (en) | Code submission method, electronic device, storage medium and program product | |
| CN117370202A (en) | Method, device, equipment and storage medium for testing full link of multiple bins | |
| CN110667654B (en) | Indoor test method and device for information consistency of CBTC system transponder | |
| CN114661592A (en) | Software testing method based on version iteration adaptive to rapid demand |
| 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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |