New! View global litigation for patent families

CN103186467B - Method and apparatus for data correctness verification - Google Patents

Method and apparatus for data correctness verification Download PDF

Info

Publication number
CN103186467B
CN103186467B CN 201110462157 CN201110462157A CN103186467B CN 103186467 B CN103186467 B CN 103186467B CN 201110462157 CN201110462157 CN 201110462157 CN 201110462157 A CN201110462157 A CN 201110462157A CN 103186467 B CN103186467 B CN 103186467B
Authority
CN
Grant status
Grant
Patent type
Application number
CN 201110462157
Other languages
Chinese (zh)
Other versions
CN103186467A (en )
Inventor
赵荣
Original Assignee
北京新媒传信科技有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Grant date

Links

Abstract

本发明涉及数据测试技术领域,提供了一种数据正确性验证方法及装置。 The present invention relates to the technical field test data, there is provided a method and apparatus to verify the correctness of data. 该方法包括:在本地建立用于保存驱动数据的文档;将驱动数据导入至测试用表中;根据测试用表中驱动数据的列名对脚本进行参数化;设置迭代次数,根据迭代次数的设置,依次读取测试用表中每行的驱动数据替代参数来驱动测试脚本执行数据验证。 The method comprising: establishing a local drive for storing the document data; introduced into the test drive data table; to parameterize the script using the column names in the table based on the test data driven; setting the number of iterations is provided, in accordance with the number of iterations sequentially read test data substitution table driving parameters for each line to perform data validation test scripts drive. 本发明中将测试数据与脚本的分离,通过参数化的方式将数据文件中读取到的数据写入到脚本中,可以执行一次脚本实现多张报表数据的测试,大大降低了脚本的维护成本,可有效提高QTP验证web报表数据正确性的脚本利用率。 The present invention is isolated in the test write data and the script, the data file read by way of parametric data to the script, the script tests may be performed to achieve a plurality of report data, greatly reducing maintenance costs script can effectively improve the utilization of web QTP scripts to verify the correctness of the report data.

Description

数据正确性验证方法及装置 Method and apparatus for data correctness verification

技术领域 FIELD

[0001] 本发明涉及数据测试技术领域,特别涉及一种数据正确性验证方法及装置。 [0001] The present invention relates to a technical field test data, particularly to a method and an apparatus verifies the correctness of data.

背景技术 Background technique

[0002] 在网站测试或应用程序的功能测试当中,很多情况下测试步骤是不变的,变化的仅仅是测试数据。 [0002] In a functional test site testing or application of which, in many cases the test procedure is the same, changing only the test data. 比如说,为了测试网站是否支持国际化(internat1nalizat1n)需要进行一个正常登录成功的测试,测试时可能会使用英文的用户名;也可能会使用中文的用户名;甚至还会使用包含一些合法的特殊字符串的用户名。 For example, to test whether the site supports internationalization (internat1nalizat1n) requires a user name to log successful test normal, you may use English when tests; may also use Chinese user name; or even contains some legitimate use of special the user name string. 这三个测试用例的操作步骤都是一样,都是输入用户名和密码,然后点击登录按钮,唯一不同的就是测试数据(即用户名和其密码)。 These three steps are the same test cases are to enter a user name and password and click the login button, the only difference is that the test data (ie their username and password). 又比如,为了执行SQL注入或者脚本注入的安全性测试,需要设计一个针对用户提交评论的通用测试步骤,然而测试数据、即用户评论的内容(包括SQL注入语句或者脚本注入语句)是变化的。 As another example, in order to perform security testing SQL injection or script injection, it is necessary to design a submit comments general test steps for the user, however, test data, that user reviews of content (including SQL injection statement or script injection statement) is changed.

[0003] 原有的自动化测试的无框架阶段的最大的缺点就是脚本与数据混合在一起,每次数据变动需要同时修改脚本程序。 [0003] The biggest drawback of the original frameless stage of automated test scripts and data is mixed together, each time the data changes need to modify the script. 比如现有技术中,自动化测试中数据正确性验证的一般步骤是:使用数据遍历方法遍历表格文件(如网页表格等),把表格内容存入一个二维数组中;使用数据库连接组件GnADODB)连接后台数据库,使用数据结果集对象保存查询结果,也存入一个二维数组中;对两个二维数组进行一对一的遍历比较验证数据正确性。 For example the prior art, the general procedure automated test is to verify the correctness of the data: the data using the method of traversing traverse spreadsheet file (e.g., page tables, etc.), the table contents into a two-dimensional array; database connection assembly GnADODB) connected back-end database, using the result set of data objects stored query results, but also into a two-dimensional array; one of the two-dimensional array of data traversing relatively verify correctness.

[0004] 上述方法仅仅是针对一张表格的数据对比方案,其存在以下缺陷:当报表数量很多时需频繁地手工执行脚本,数据验证效率低;此外脚本与数据混合在一起,每次数据变动需要修改脚本文件,脚本使用率低、维护频繁、实现复杂,测试需付出大量的人力和时间成本。 [0004] The above-described method is only one table for a comparison of the data of the program, which has the following defects: When the number of reports to be hand very often frequent execution of the script, the data verification is low; in addition to the script data are mixed together, each data fluctuation need to modify the script, the script uses low, frequent maintenance, implementation complexity, testing will have to pay a lot of manpower and time costs.

发明内容 SUMMARY

[0005]( 一)要解决的技术问题 [0005] (a) To solve technical problems

[0006] 针对现有技术的上述缺陷,本发明为了解决现有技术中数据正确性验证效率低下的技术问题,提供了一种数据正确性验证方法及装置。 [0006] In view of the above drawbacks of the prior art, the present invention is to solve the prior art low data correctness verification process technical problems, there is provided a method and apparatus to verify the correctness of data.

[0007] ( 二)技术方案 [0007] (ii) Technical Solution

[0008] 为实现上述目的,本发明采用如下技术方案: [0008] To achieve the above object, the present invention adopts the following technical solution:

[0009] —方面,本发明提供一种数据正确性验证方法,所述方法包括步骤: [0009] - aspect, the present invention provides a data correctness verification, the method comprising the steps of:

[0010] SI,在本地建立用于保存驱动数据的文档; [0010] SI, the establishment of documentation for the drive to save data locally;

[0011] S2,将驱动数据导入至测试用表中; [0011] S2, the drive data is introduced into a test table;

[0012] S3,根据测试用表中驱动数据的列名对脚本进行参数化; [0012] S3, according to the test used to parameterize the script table column names driving data;

[0013] S4,设置迭代次数,根据迭代次数的设置,依次读取测试用表中每行的驱动数据替代参数来驱动测试脚本执行数据验证。 [0013] S4, setting the number of iterations, set in accordance with the number of iterations, successively reading the test data of each line of the drive parameter table alternative drive test script to perform data validation.

[0014] 优选地,步骤S2-S4中,使用QTP工具进行数据的操作。 [0014] Preferably, the step S2-S4, a QTP tool operation data.

[0015] 优选地,步骤SI中,所述驱动数据包括报表名称、报表查询开始日期、报表查询结束日期。 [0015] Preferably, the step SI, the driving data comprises a name of the report, the report query start date, end date for the report query.

[0016] 优选地,步骤S3中,通过获取报表名称的坐标值加固定数字来找到打开该报表的按钮,然后访问报表数据。 [0016] Preferably, in step S3, the name of the report by obtaining a coordinate value plus a fixed number to find the button to open the report, and report data access.

[0017] 优选地,步骤S4之后,当测试停止则将测试表中数据也随之清除。 [0017] Preferably, after the step S4, the test is stopped when the test sheet data will also will clear.

[0018] 优选地,步骤S4中,驱动测试脚本执行数据验证具体包括步骤: [0018] Preferably, the step S4, the drive test scripts perform data validation comprises the steps of:

[0019] S41,在脚本执行时首先创建以当前访问的报表名命名的数据文档,所述数据文档中分为系统导出数据保存区和数据库导出数据保存区两部分; [0019] S41, first create a report with the name of the currently accessed data files named in the script executes, the document data into the system to export data storage area and two parts database export data storage area;

[0020] S42,遍历网页报表,将获取的数据按行保存在所述数据文档的系统导出数据保存区中; [0020] S42, traverse page report, the data acquired by the data rows stored in the system file data storage area is derived;

[0021] S43,依据待验证报表名导出待查询条件,依据导出的待查询条件查询数据库,按行导出数据库数据,保存在所述数据文档的数据库导出数据保存区中; [0021] S43, according to a report to be verified to be exported query name, query the database based on the query to be exported, export database data rows, the data stored in the database document export data preservation area;

[0022] S44,对系统导出数据保存区和数据库导出数据保存区中单元格数据一一对比,一致则测试通过;不一致,则在产生的测试结果报告中输出错误信息。 [0022] S44, the system database and exporting data storage area in the data storage area derived cell data one comparisons, by testing the same; not, the error message is output in a test result report generated.

[0023] 优选地,步骤S43中,所述导出数据库数据的过程为: Process [0023] Preferably, in step S43,, the database data is derived:

[0024] 从数据库中导出数据,首先判断某个时间单一版本的统计项数据是否为空; [0024] export data from the database, the first time to determine whether a single version of the statistical data items is empty;

[0025] 若为空,则舍弃该时间-版本的数据导出过程,判断下一个时间-版本数据;若不为空,则按行查询数据; [0025] If it is empty, the time is discarded - derived version of the data process determines the next time - version data; if not empty, press line query data;

[0026] 若查询结果仅有一个数据,则该数据赋值给“上传用户数”统计项,其余单元格赋值为O ;否则将按行正常赋值。 [0026] If the query result is only one data, the data is assigned to "Upload users" statistical terms, the rest of the cell assignment is O; otherwise it will be a regular assignment row.

[0027] 另一方面,本发明还同时提供一种数据正确性验证装置,所述装置包括: [0027] another aspect, the present invention also provides a data correctness verification apparatus, said apparatus comprising:

[0028] 驱动数据保存模块,用于在本地建立用于保存驱动数据的文档; [0028] The drive data storage means for establishing documentation for the drive data is saved locally;

[0029] 驱动数据导入模块,用于将驱动数据导入至测试用表中; [0029] The driving data import module, is introduced into the drive data for the test table;

[0030] 脚本参数化模块,用于根据测试用例从对应的测试用表中取出驱动数据对脚本进行参数化; [0030] module script parameters, parameters for test case script from the test corresponding table data extracted according to the driving;

[0031] 迭代验证模块,用于设置迭代次数,根据迭代次数的设置,按行依次读取表中数据来驱动测试脚本执行数据验证。 [0031] The iterative verification module, for setting a number of iterations, according to the set number of iterations, according to a data table row sequentially read to verify data driven test script execution.

[0032] 优选地,所述迭代验证模块通过脚本执行模块驱动测试脚本执行数据验证,所述脚本执行模块包括: [0032] Preferably, the iterative test script verification module driven by the data validation script execution module executes the script execution module comprises:

[0033] 数据文档创建模块,用于在脚本执行时首先创建以当前访问的报表名命名的数据文档,所述数据文档中分为系统导出数据保存区和数据库导出数据保存区两部分; [0033] data document creation module to create the first to report the name of the currently accessed data files named in the script executes, the document data into the system to export data storage area and two parts database export data storage area;

[0034] 系统数据导出模块,用于遍历网页报表,将获取的数据按行保存在所述数据文档的系统导出数据保存区中; [0034] System data deriving means for traversing web pages reporting the data acquired by the data line holds export stored in the system area of ​​the document data;

[0035] 数据库数据导出模块,用于依据待验证报表名导出待查询条件,依据导出的待查询条件,按行导出数据库数据,保存在所述数据文档的数据库导出数据保存区中; [0035] The data export module database, based on the condition to be verified for deriving report name to be queried, in rows export database query based on the data to be exported, the document data stored in the database of the data storage area is derived;

[0036] 数据验证模块,对系统导出数据保存区和数据库导出数据保存区中单元格数据一一对比,一致则测试通过;不一致,则在产生的测试结果报告中输出错误信息。 [0036] The data verification module, the system database and exporting data storage area in the data storage area derived cell data one comparisons, by testing the same; not, the error message is output in a test result report generated.

[0037](三)有益效果 [0037] (c) beneficial effect

[0038] 本发明的方案中,将测试数据与脚本的分离,通过参数化的方式将数据文件中读取到的数据写入到脚本中,可以执行一次脚本实现多张报表数据的测试,大大降低了脚本的维护成本,可有效提高QTP验证web报表数据正确性的脚本利用率。 Write [0038] embodiment of the present invention, the separation of test data and the script, reads the parameter of the way of the data file to the data to the script, the script tests may be performed to achieve a plurality of report data, greatly reducing the maintenance costs of the script, which can effectively improve the accuracy of reporting data validation web QTP scripts utilization.

附图说明 BRIEF DESCRIPTION

[0039] 图1为本发明的数据正确性验证方法的流程示意图; Data correctness verification method of [0039] Figure 1 is a schematic flow diagram of the invention;

[0040] 图2为本发明的数据处理方式示意图; [0040] Figure 2 a schematic view of the data processing of the present invention;

[0041] 图3为统计项数据的导出过程示意图; [0041] FIG. 3 is a data item derived statistical process schematic;

[0042]图4为本发明的数据正确性验证装置的模块示意图。 Data of the present invention [0042] Fig 4 a schematic view of the correctness verification module device.

具体实施方式 detailed description

[0043] 下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明的一部分实施例,而不是全部的实施例。 [0043] below in conjunction with the present invention in the accompanying drawings, technical solutions of embodiments of the present invention are clearly and completely described, obviously, the described embodiments are part of the embodiments of the present invention, but not all embodiments example. 基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。 Based on the embodiments of the present invention, all other embodiments of ordinary skill in the art without creative efforts shall fall within the scope of the present invention.

[0044] 在本发明的方法中,主要实现了测试数据与脚本的分离,可以执行一次脚本实现多张报表数据的测试。 [0044] In the method of the present invention, the main achievement of the separation of test data and the script, the script tests may be performed to achieve a plurality of report data. 本发明的方法将数据整理至本地文件,从数据文件中读取数据,然后通过参数化的方式将数据文件中读取到的数据写入到脚本中。 The method of the present invention will write data to a local file sorting read data from the data file, and then read by the parameters of the data file to the embodiment of the data to the script. 这样,仅执行一次测试即可实现同类报表的测试;并且本方案将驱动数据独立为外部数据文件,大大降低了脚本的维护成本。 Thus, the test can be performed only once to achieve similar test reports; and this program will drive independent data to an external data file, greatly reducing maintenance costs of the script. 具体地,参见图1,本发明的方法包括步骤: In particular, methods of the invention Referring to Figure 1 comprising the steps of:

[0045] 1、在本地建立用于保存驱动数据的文档(优选地采用Excel文档保存);所述驱动数据包括报表名称(以innertext表示)、报表查询开始日期(以startday表示)、报表查询结束日期(以endday表示)等; [0045] 1, for the establishment of the document data stored in the local drive (Excel document is preferably used to save); driving said data including report names (represented in innerText), report query start date (indicated by the startday), the end of the report query date (in endday shown) and the like;

[0046] 2、将驱动数据导入至测试用表中;如使用ImportSheet方法导入驱动数据至QTP中的Data Table数据表中,QTP (quicktest Profess1nal)是一种自动测试工具;ImportSheet 方法的使用格式为:ImportSheet" D:\***.xls",1,2,含义为将D 盘下***.xls文件中的第一个sheet表数据导入至QTP中Data Table的第二个数据表(本实施例中将该表命名为Act1n表)中; [0046] 2, the drive data is introduced into a test table; as introduced in the drive data to the QTP Data Table Data table used ImportSheet method, QTP (quicktest Profess1nal) is an automated testing tool; method of using the format ImportSheet : ImportSheet "D:. \ *** xls", 1,2, meaning the D drive *** a first data import sheet table xls file into the data table QTP second data table (. the embodiment of the present embodiment is named table Act1n table);

[0047] 3、根据测试用表中驱动数据的列名对脚本进行参数化; [0047] 3. A parametric test script using the table column names driving data;

[0048] 例如,进行飞信数据平台的关闭操作统计时,使用BrowseH"飞信数据平台").WebElement (;/关闭操作统计").GetROProperty (" x" )+90语句,通过获取报表名称的坐标值加固定数字来找到打开该报表的按钮,然后访问报表数据,当前语句指定了具体的报表名称"关闭操作统计",因此对该对象属性进行参数化。 [0048] For example, when data platform fetion closing operation statistics, using BrowseH "flying platform-data") .WebElement (; / closing operation count ") .GetROProperty (" x ") +90 statement, by obtaining the coordinates of the report name value plus a fixed number to find the button to open the report and then access the report data, current statement specifies the specific name of the report "closed operating statistics," so to parameterize the object properties.

[0049] 参数化时,首先要用到QTP的描述性编程,便于对对象属性参数化,即上述语句可以写为:Browser ("飞信数据平台").WebElement (" html tag: =P"," innertext:=关闭操作统计").GetROProperty (" x" )+90 ; [0049] The parameter of the first to use the QTP descriptive programming, object properties facilitates parameterization, i.e. above statement can be written as: Browser ( "fetion data platform") .WebElement ( "html tag: = P", "innertext: = closing operation count") .GetROProperty ( "x") +90;

[0050] 然后修改语句为Browser ("飞信数据平台").WebElement ( " htmltag: =P " , " innertext: = " &datatable.Value ( " innertext " ,2)).GetROProperty (" x " )+90,其中,datatable.Value (" innertext ",2)为参数化部分,理解为从Data Table视图的第二个表(即Act1n表)中取出列名为innertext下的数据。 [0050] and then modify the statement Browser ( "fetion data platform") .WebElement ( "htmltag: = P", "innertext: =" & datatable.Value ( "innertext", 2)) GetROProperty ( "x") +90. wherein, datatable.Value ( "innertext", 2) the parameters of the part, understood that the data in the column named innertext removed (i.e. Act1n table) from the second table in the data table view. 由于DataTable下的Act1n表中保存内容是用于参数化的驱动数据的具体内容(报表名、开始、结束日期等),此处取出的innertext数据即“关闭操作统计”,使用datatable.vlaue ( " innertext ",2)取出数据后赋值给webelement控件的innertext属性,那么innertext属性便被参数化而有了具体值,随后可以指导QTP通过参数化的具体属性值找到待测试报表。 Since Act1n DataTable table stored in the specific content is the content (the report name, start, end date, etc.) for parameter data driver, the retrieved data innerText herein as "closing operation Statistics", used datatable.vlaue ( " innertext ", 2) after removing the data assigned to innertext property webelement control, then innertext property will be parameterized and has a specific value, then QTP guide can be found by the report to be tested parameters of specific property values. 完成一项属性的参数化后,重复上述步骤对其他属性进行参数化; After completion of an attribute parameter, repeating the above steps for the other parameters of the attributes;

[0051] 4、设置迭代次数,根据迭代次数的设置,按行依次读取表中数据来驱动测试脚本执行数据验证。 [0051] 4, set number of iterations, according to the set number of iterations, successively reads the rows in the data table to perform data validation drive test script.

[0052] 由于运行测试时QTP将导入驱动数据至Data Table视图中的Global表或Act1n表,因此需要对数据表的迭代次数进行设置。 [0052] Since the drive data to the QTP import view Global Data Table Act1n table or tables run the test, the number of iterations is required to set data table. 迭代次数用于控制脚本的执行次数,是与数据行数对应的;QTP关于迭代次数有三种设置:仅执行一次、执行所有数据行、指定循环执行的行数。 For controlling the number of iterations performed script, with rows corresponding to the number of data; the number of iterations on the QTP has three settings: performed only once, perform all the data lines, the number of lines designated loop is executed. 如设置为仅执行一行时,则脚本仅读取第一行的参数化数据;如设置为执行所有数据行,则QTP将依据读取到的数据行的行数确定脚本的循环执行次数。 As set to perform only one line, the script data read parameters only the first row; if arranged to perform all the data lines, the number of lines based on the QTP read data to determine the number of rows of script execution cycle. Global为全局表,可通过File- > Settings- > Run设置迭代方式。 Global global table, by File-> Settings-> Run disposed in an iterative manner. Act1n为局部表,可通过TestFlow- >右键具体Act1n-> Act1n Call Properties设置迭代次数。 Act1n is a partial table, by TestFlow-> DETAILED right Act1n-> Act1n Call Properties set number of iterations. 其中,程序执行次数是通过Global设置的次数乘以Act1n中设置的次数控制的,例如Global执行3行数据,Act1n执行4行数据,那么脚本就需要执行3*4 = 12次;本发明的实施例中将数据导入至Act1n表,因此只需设置Act1n的迭代次数。 Wherein the number of execution times Act1n procedure is controlled by a set number of times multiplied by Global provided, e.g. 3 performs Global data line, the data line 4 Act1n performed, the script will require 3 * 4 = 12 times; embodiment of the present invention. Example Act1n to import data table, so that only a set number of iterations Act1n. 设置完迭代次数后,测试将根据迭代次数的设置,按行依次读取Data Table中数据来驱动测试脚本执行。 After setting the number of iterations, according to the test set number of iterations, by sequentially reading the data row to Data Table drive test script execution. 当脚本运行起来,导入参数化数据后,QTP将读取Data Table中的第一行数据,根据已经设置的迭代次数,脚本执行完当前一次迭代后将自动跳转至下一行数据,开始新一轮脚本的运行,直至执行完所有迭代。 When running the script, the data import parameters, the QTP first line of data read in the Data Table, based on the number of iterations has been set, the next line of script data will automatically jump Ends the current iteration to start a new one wheel script until you have to perform all iterations. 测试停止则Data Table中数据也随之清除。 Stop the test data in Table Data also will be cleared.

[0053] 本方案可提高QTP验证web报表数据正确性的脚本利用率,对于相同业务逻辑、操作步骤的报表而言,仅执行一次测试即可实现同类报表的测试;并且本方案将驱动数据独立为外部数据文件,大大降低了脚本的维护成本。 [0053] The present embodiment can improve the web report data correctness verification QTP script utilization, for the same business logic, report operational steps, the test can be performed only once to achieve the same test report; the drive data and the program independently external data files, greatly reducing maintenance costs of the script.

[0054] 更进一步地,在本发明的方法中,脚本执行时对于数据验证的处理方式参见图2,包括步骤: [0054] Still further, in the method of the present invention, the script executes the data verification processing mode 2, comprising the steps of:

[0055] 1、在脚本执行时首先创建以当前访问的报表名命名的Excel文档,文档中sheet表分两部分,一部分为系统导出数据;一部分为数据库导出数据。 [0055] 1, first created when the script is executed Excel document to report the name of the currently accessed named document sheet table are two kinds of export data for the system; as part of the database export data.

[0056] 2、访问系统报表时,通过getcelldata(i,j)的方法遍历webtable,然后在本地excel文档-系统数据的sheet表中由第二行(数据库sheet表的第一行额外保存了统计项ID)开始保存数据(目的是与数据库导出数据行对应)。 [0056] 2, access the system reports webtable traversed by getcelldata (i, j) of the method, and excel document locally - by the statistics stored (the first row of the database table additional second sheet table row system data sheet item ID) starts saving data (object database is derived corresponding to the data row).

[0057] 3、由数据库中导出数据保存至同一excel-数据库sheet表中,首先依据待验证报表名导出统计项ID及名称,然后查询该报表下各版本的上报项个数,由此计算得出报表样式,依据导出的统计项ID、名称、日期、版本、上报项等信息为查询条件,按行导出数据库数据,并保存至excel文档数据库sheet表中; [0057] 3, derived from data stored in the database to the same excel- sheet database table, first export statistics item ID and name to be verified according to the report name, then query the number of items reported under each version of the report, which calculated a report style, for the query, export database data by row basis of information statistical item ID, name, date, version, and other items reported export, and save the document database to excel sheet table;

[0058] 统计项数据的导出过程如图3,由数据库中导出数据首先判断某个时间单一版本的统计项数据是否为空;如为空,则舍弃该时间-版本的数据导出过程(即从excel中删除该时间-版本),判断下一个时间-版本数据;不为空,则按行(以时间-版本-上报项为查询条件)查询数据,若查询结果仅有一个数据(即上传用户数统计项),则该数据赋值给“上传用户数”统计项,其余单元格赋值为O ;否则将按行正常赋值。 [0058] deriving statistical process item data 3, the data derived from the database is first time to determine whether a single version of the statistical data item is empty; if blank, the time is discarded - version data export process (i.e., from excel remove the time - later), determines a next time - version data; is not empty, press line (time - version - reported as query term) data query, if the query result is only one data (i.e., users upload statistics item), then the data is assigned to "Upload users" statistical terms, the rest of the cell assignment is O; otherwise it will be a regular assignment row.

[0059] 4、对两个sheet表中单元格数据--对比,一致则测试通过;不一致,则在QTP产生的测试结果报告中输出错误信息;在保存系统数据的sheet表中该出错数据的单元格内容显示错误数据信息,并将字体置为红色突出显示以便查看。 [0059] 4, to two cells in the table data sheet - Comparative consistent test passes; inconsistent, then the test results are reported in QTP outputs error information generated; the erroneous data stored in the system data table sheet cell content display data error message, and the font set to be highlighted in red to see.

[0060] 本领域普通技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,包括上述实施例方法的各步骤,而所述的存储介质可以是:R0M/RAM、磁碟、光盘等。 [0060] Those of ordinary skill in the art will be appreciated, to achieve the above embodiments of the method that all or part of the steps may be relevant hardware instructed by a program, the program may be stored in a computer readable storage medium, when the program is executed, comprising the steps of a method of the above-described embodiments, and the storage medium may be: R0M / RAM, magnetic disk, optical disk. 因此,与本发明的方法相对应的,本发明还同时包括一种数据正确性验证装置,该装置通常以与方法各步骤相对应的功能模块的形式表示;如图4所示,所述装置包括: Thus, the method of the present invention corresponds to, the present invention also comprise one data correctness verification apparatus, generally in the form of apparatus and method steps corresponding to each of the functional modules representation; shown, the apparatus in FIG. 4 include:

[0061] 驱动数据保存模块1,用于在本地建立用于保存驱动数据的文档; [0061] 1 drive data storage module, used for establishing the document data stored in the local drive;

[0062] 驱动数据导入模块2,用于将驱动数据导入至测试用表中; [0062] The driving data import module 2, is introduced into the drive data for the test table;

[0063] 脚本参数化模块3,用于根据测试用例从对应的测试用表中取出驱动数据对脚本进行参数化; [0063] 3 script parameter module configured to parameterize the script data according to the test case extracted from the corresponding driving test table;

[0064] 迭代验证模块4,用于设置迭代次数,根据迭代次数的设置,按行依次读取表中数据来驱动测试脚本执行数据验证。 [0064] 4 iterations authentication module, for setting a number of iterations, according to the set number of iterations, according to a data table row sequentially read to verify data driven test script execution.

[0065] 更进一步地,所述迭代验证模块通过脚本执行模块驱动测试脚本执行数据验证,所述脚本执行模块包括: [0065] Furthermore, the drive module iterative verification test scripts perform data validation module executed by a script, the script execution module comprises:

[0066] 数据文档创建模块,用于在脚本执行时首先创建以当前访问的报表名命名的数据文档,所述数据文档中分为系统导出数据保存区和数据库导出数据保存区两部分; [0066] data document creation module to create the first to report the name of the currently accessed data files named in the script executes, the document data into the system to export data storage area and two parts database export data storage area;

[0067] 系统数据导出模块,用于遍历网页报表,将获取的数据按行保存在所述数据文档的系统导出数据保存区中; [0067] System data deriving means for traversing web pages reporting the data acquired by the data line holds export stored in the system area of ​​the document data;

[0068] 数据库数据导出模块,用于依据待验证报表名导出待查询条件,依据导出的待查询条件,按行导出数据库数据,保存在所述数据文档的数据库导出数据保存区中; [0068] Data export module database, based on the condition to be verified for deriving report name to be queried, in rows export database query based on the data to be exported, the document data stored in the database of the data storage area is derived;

[0069] 数据验证模块,对系统导出数据保存区和数据库导出数据保存区中单元格数据一一对比,一致则测试通过;不一致,则在产生的测试结果报告中输出错误信息。 [0069] The data verification module, the system database and exporting data storage area in the data storage area derived cell data one comparisons, by testing the same; not, the error message is output in a test result report generated.

[0070] 以上实施方式仅用于说明本发明,而并非对本发明的限制,有关技术领域的普通技术人员,在不脱离本发明的精神和范围的情况下,还可以做出各种变化和变型,因此所有等同的技术方案也属于本发明的范畴,本发明的专利保护范围应由权利要求限定。 [0070] The above embodiments are merely illustrative of the present invention, and are not restrictive of the invention, relating to ordinary skill in the art, without departing from the spirit and scope of the present invention, can make various changes and modifications , all equivalent technical solutions also within the scope of the present invention, the scope of the present invention patent is defined by the appended claims.

Claims (8)

  1. 1.一种数据正确性验证方法,其特征在于,所述方法包括步骤: SI,在本地建立用于保存驱动数据的文档; S2,将驱动数据导入至测试用表中; S3,根据测试用表中驱动数据的列名对脚本进行参数化; S4,设置迭代次数,根据迭代次数的设置,依次读取测试用表中每行的驱动数据替代参数来驱动测试脚本执行数据验证;其中,迭代次数有三种设置:仅执行一次、执行所有数据行、执行循环执行的行数; 步骤S4中,驱动测试脚本执行数据验证具体包括步骤: S41,在脚本执行时首先创建以当前访问的报表名命名的数据文档,所述数据文档中分为系统导出数据保存区和数据库导出数据保存区两部分; S42,遍历网页报表,将获取的数据按行保存在所述数据文档的系统导出数据保存区中; S43,依据待验证报表名导出待查询条件,依据导出的待查询条件查询数据 A data correctness verification method, wherein the method comprises the step of: SI, for the establishment of the document data stored in a local drive; S2, the drive data is introduced into a test table; S3, according to the test driving data table column names to parameterize the script; S4, setting the number of iterations, depending on the setting of the number of iterations, successively reading test data substitution table driving parameters for each line to perform data validation drive test script; wherein iteration the number has three settings: executed only once, perform all the data lines, the number of rows to perform loop is executed; step S4, the driving test script to perform data validation specifically includes the steps of: S41, when the script execution is first created in the report name is currently accessing naming document data, the document data is divided into two parts data storage area and system lead database export data storage area; S42, traversing page report, the data acquired by the data rows stored in the system file data storage area deriving ; S43, according to the report name to be verified to be exported query, the query data based on the query to be exported ,按行导出数据库数据,保存在所述数据文档的数据库导出数据保存区中; S44,对系统导出数据保存区和数据库导出数据保存区中单元格数据一一对比,一致则测试通过;不一致,则在产生的测试结果报告中输出错误信息。 In rows export database data, document data stored in the database of the data storage area is derived; S44, on the data storage area and system lead database export data storage area cell data in one comparisons, by testing the same; inconsistent, error message is output in the test results report generated.
  2. 2.根据权利要求1所述的方法,其特征在于,步骤S2-S4中,使用QTP工具进行数据的操作。 2. The method according to claim 1, wherein the step S2-S4, a QTP tool operation data.
  3. 3.根据权利要求1所述的方法,其特征在于,步骤SI中,所述驱动数据包括报表名称、报表查询开始日期、报表查询结束日期。 3. The method according to claim 1, wherein, in the step SI, the driving data comprises a name of the report, the report query start date, end date for the report query.
  4. 4.根据权利要求1所述的方法,其特征在于,步骤S3中,通过获取报表名称的坐标值加固定数字来找到打开该报表的按钮,然后访问报表数据。 4. The method according to claim 1, wherein, in step S3, the coordinate values ​​acquired by the report name plus a fixed number to find the button to open the report, and report data access.
  5. 5.根据权利要求1所述的方法,其特征在于,步骤S4之后,当测试停止则将测试表中数据也随之清除。 5. The method according to claim 1, wherein, after the step S4, the test is stopped when the test sheet data will also will clear.
  6. 6.根据权利要求1所述的方法,其特征在于,步骤S43中,所述导出数据库数据的过程为: 从数据库中导出数据,首先判断某个时间单一版本的统计项数据是否为空; 若为空,则舍弃该时间-版本的数据导出过程,判断下一个时间-版本数据;若不为空,则按行查询数据; 若查询结果仅有一个数据,则该数据赋值给“上传用户数”统计项,其余单元格赋值为O ;否则将按行正常赋值。 6. The method according to claim 1, characterized in that, in step S43, the process of deriving the data for the database: deriving data from the database, first determines whether a certain time a single version of the statistical data item is null; if is empty, then discard the time - version of the data export process, the next time a judge - version data; if it is empty, press the row of the query data; if there is only one data query results, the data assigned to the "Upload users "statistical terms, the rest of the cell assignment is O; otherwise it will be a regular assignment row.
  7. 7.根据权利要求1所述方法,其特征在于,步骤S44中,不一致时,输出错误信息具体操作为:在系统导出数据保存区中该出错数据对应的单元格内显示错误数据信息,并将字体置为红色突出显示。 7. The method according to claim 1, wherein step S44, inconsistent, particularly operable to output an error message: Export displays an error message data within the data storage area corresponding to the erroneous data cell, and font set is highlighted in red.
  8. 8.一种数据正确性验证装置,其特征在于,所述装置包括: 驱动数据保存模块,用于在本地建立用于保存驱动数据的文档; 驱动数据导入模块,用于将驱动数据导入至测试用表中; 脚本参数化模块,用于根据测试用例从对应的测试用表中取出驱动数据对脚本进行参数化; 迭代验证模块,用于设置迭代次数,根据迭代次数的设置,按行依次读取表中数据来驱动测试脚本执行数据验证;其中,迭代次数有三种设置:仅执行一次、执行所有数据行、执行循环执行的行数; 所述迭代验证模块通过脚本执行模块驱动测试脚本执行数据验证,所述脚本执行模块包括: 数据文档创建模块,用于在脚本执行时首先创建以当前访问的报表名命名的数据文档,所述数据文档中分为系统导出数据保存区和数据库导出数据保存区两部分; 系统数据导出模块,用于遍历网页报 A data correctness verification apparatus, wherein, said means comprising: a drive data storage module, used for establishing the document data stored in a local drive; driving data import module, is introduced into the drive data for the test module script parameters, for the corresponding test scripts from parameterizing extracted data table based on a drive test;; iterative verification module, configured to set the number of iterations, according to the set number of iterations, successively reading row in table take the table data driven test scripts to perform data validation; wherein the number of iterations has three settings: performed only once, perform all the data lines, the number of rows execution cycle performed; the iterative verification module drive test script execution script execution by the data module verification, the script execution module includes: a data document creation module to create the first to report the name of the currently accessed data files named in the script executes, the document data into the system to export data storage area and database export data retention two partial area; system data export module, configured to traverse the page message ,将获取的数据按行保存在所述数据文档的系统导出数据保存区中; 数据库数据导出模块,用于依据待验证报表名导出待查询条件,依据导出的待查询条件,按行导出数据库数据,保存在所述数据文档的数据库导出数据保存区中; 数据验证模块,对系统导出数据保存区和数据库导出数据保存区中单元格数据一一对比,一致则测试通过;不一致,则在产生的测试结果报告中输出错误信息。 , The acquired data rows stored in the system of the data file to export data storage area; database data export module for the report to be verified according to the name of the query to be exported, according to the query condition to be exported, the export database data by row , document data stored in the database of the data storage area is derived; data verification module, export the data storage area of ​​the eleven cell data comparison system lead data storage area and the database, then the test passes consistent; inconsistent, resulting in test results are reported in output an error message.
CN 201110462157 2011-12-31 2011-12-31 Method and apparatus for data correctness verification CN103186467B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110462157 CN103186467B (en) 2011-12-31 2011-12-31 Method and apparatus for data correctness verification

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110462157 CN103186467B (en) 2011-12-31 2011-12-31 Method and apparatus for data correctness verification

Publications (2)

Publication Number Publication Date
CN103186467A true CN103186467A (en) 2013-07-03
CN103186467B true CN103186467B (en) 2016-04-20

Family

ID=48677643

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110462157 CN103186467B (en) 2011-12-31 2011-12-31 Method and apparatus for data correctness verification

Country Status (1)

Country Link
CN (1) CN103186467B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103514093B (en) * 2013-09-23 2016-02-03 福建联迪商用设备有限公司 Embedded systems character testing method and apparatus
CN103698489B (en) * 2013-12-30 2015-07-29 力合科技(湖南)股份有限公司 Test data verification method and apparatus
CN104734912A (en) * 2015-02-13 2015-06-24 大唐联仪科技有限公司 Method and device for testing protocol conformance
CN104866422A (en) * 2015-05-20 2015-08-26 中国互联网络信息中心 Web Service automatic test system and method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5784553A (en) * 1996-01-16 1998-07-21 Parasoft Corporation Method and system for generating a computer program test suite using dynamic symbolic execution of JAVA programs
CN1877544A (en) * 2005-06-06 2006-12-13 华为技术有限公司 Keyword-driven automatic testing system and method
CN101118515A (en) * 2007-09-11 2008-02-06 腾讯科技(深圳)有限公司 Automatically testing method and apparatus for list
CN101303664A (en) * 2008-06-19 2008-11-12 腾讯科技(深圳)有限公司 Professional quick test device and method
CN102135938A (en) * 2011-03-21 2011-07-27 中国工商银行股份有限公司 Software product testing method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5784553A (en) * 1996-01-16 1998-07-21 Parasoft Corporation Method and system for generating a computer program test suite using dynamic symbolic execution of JAVA programs
CN1877544A (en) * 2005-06-06 2006-12-13 华为技术有限公司 Keyword-driven automatic testing system and method
CN101118515A (en) * 2007-09-11 2008-02-06 腾讯科技(深圳)有限公司 Automatically testing method and apparatus for list
CN101303664A (en) * 2008-06-19 2008-11-12 腾讯科技(深圳)有限公司 Professional quick test device and method
CN102135938A (en) * 2011-03-21 2011-07-27 中国工商银行股份有限公司 Software product testing method and system

Also Published As

Publication number Publication date Type
CN103186467A (en) 2013-07-03 application

Similar Documents

Publication Publication Date Title
Lloyd Practical Advtanages of Declarative Programming.
US20060117055A1 (en) Client-based web server application verification and testing system
US7139749B2 (en) Method, system, and program for performance tuning a database query
US20110246881A1 (en) Translating text to, merging, and optimizing graphical user interface tasks
US20050120001A1 (en) SQL structure analyzer
US7689467B1 (en) Arrangement for guiding user design of comprehensive product solution using on-the-fly data validation
US20120089562A1 (en) Methods and Apparatus for Integrated Management of Structured Data From Various Sources and Having Various Formats
Long et al. The workflow of data analysis using Stata
US8019795B2 (en) Data warehouse test automation framework
US20140075242A1 (en) Testing rest api applications
US20050204345A1 (en) Method and apparatus for monitoring computer software
US20040255275A1 (en) Method and system for generating an efficient test suite from a domain description with given constraints
US20100174678A1 (en) System and method for comparing digital data in spreadsheets or database tables
CN101118515A (en) Automatically testing method and apparatus for list
CN101135989A (en) Automatization test method and device for Web applied system
CN101308490A (en) Dynamic report generation method and platform
US20120150820A1 (en) System and method for testing data at a data warehouse
US20060020921A1 (en) Data cube script development and debugging systems and methodologies
CN101025686A (en) Automation test system and test script generating and operating method
CN1632747A (en) Software interface testing method
US20090228871A1 (en) Managing generation of security tests
US20070100809A1 (en) Mixed mode (mechanical process and english text) query building support for improving the process of building queries correctly
Pettichord Success with test automation
CN1776643A (en) Method and device for testing software product robustness
Bouajjani et al. Abstract regular tree model checking

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
C14 Grant of patent or utility model