CN102567193A - Method and system for converting test case to automated testing script - Google Patents

Method and system for converting test case to automated testing script Download PDF

Info

Publication number
CN102567193A
CN102567193A CN2010105939484A CN201010593948A CN102567193A CN 102567193 A CN102567193 A CN 102567193A CN 2010105939484 A CN2010105939484 A CN 2010105939484A CN 201010593948 A CN201010593948 A CN 201010593948A CN 102567193 A CN102567193 A CN 102567193A
Authority
CN
China
Prior art keywords
code
test case
script
test
test script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2010105939484A
Other languages
Chinese (zh)
Other versions
CN102567193B (en
Inventor
李阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Feinno Communication Technology Co Ltd
Original Assignee
Beijing Feinno Communication Technology Co Ltd
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
Application filed by Beijing Feinno Communication Technology Co Ltd filed Critical Beijing Feinno Communication Technology Co Ltd
Priority to CN201010593948.4A priority Critical patent/CN102567193B/en
Publication of CN102567193A publication Critical patent/CN102567193A/en
Application granted granted Critical
Publication of CN102567193B publication Critical patent/CN102567193B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for converting a test case to an automated testing script, which includes the steps: S1, reading the test case written by a user, and naming operation commands in the test case with keywords and keywords in a code mapping table; S2, searching corresponding testing script codes from the keywords and the code mapping table according to keywords in the test case, and generating the automated testing script; and S3, verifying code integrity of the automated testing script, so that the codes of the automated testing script accord with automated testing tool code standards. By the aid of the method, the test case can be automatically converted to the automated testing script, automated testing efficiency is improved, and resource consumption and maintenance complexity are reduced.

Description

Test case is converted into the method and system of automatic test script
Technical field
The present invention relates to the automatization testing technique field, particularly a kind of test case is converted into the method and system of automatic test script.
Background technology
In the automatic test field, the exploitation of automatic test script generally has two kinds of methods, and a kind of is through once test of manual operation, uses the recording function of automated test tool simultaneously, gets off the operation note of being carried out, and generates test script.The script playback success ratio that this technology generates is lower, and later maintenance is also relatively more difficult.Second method is to write test frame, and the fundamental operation that test is needed provides interface to supply to call, and the tester is according to the use-case operational requirements, the automatic test script of hand-coding calling interface, and this method requires very high to tester's code level.
In the automatic test, the tester has write after the use-case at present, also needs the script developer to write an automatic test script to this use-case separately, uses the automated test tool Run Script to test then.When test case after changing, also need write this test script again, resource cost is bigger.Safeguard more complicated between test case and the test script.
Summary of the invention
The technical matters that (one) will solve
The technical matters that the present invention will solve is: how test case automatically is converted into automatic test script, to reduce the maintenance between resource consumption and test case and the test script.
(2) technical scheme
For solving the problems of the technologies described above, the invention provides the method that a kind of test case is converted into automatic test script, may further comprise the steps:
S1: read the test case that the user writes, the operational order in the said test case is with key word name in key word and the code mapping table;
S2: in key word and code mapping table, search corresponding test script code according to the key word in the test case, and generate automatic test script;
S3: verify the code integrity of said automatic test script, make the code of automatic test script meet the code of automated test tool code specification.
Wherein, said step S3 specifically comprises:
S3.1: add test case information, comprising: test case title and ID;
S3.2: the skin at said automatic test script adds exception handling code;
S3.3: whether the automatic test script after the verification step S3.2 has grammer and writes mistake, if checking is not passed through, then makes amendment, if pass through, then generates final automatic test script.
Wherein, said step exception handling code is the try-catch code.
Wherein, also comprise before the said step S1:
Connect the test case management instrument, store the test case that the user writes in the said test case management instrument.
The present invention also provides a kind of test case to be converted into the system of automatic test script, comprising:
The test case acquisition module is used to read the test case that the user writes, and the operational order in the said test case is with key word name in key word and the code mapping table;
The test script generation module is used in key word and code mapping table, searching corresponding test script code according to the key word of test case, and generates automatic test script;
The integrity verification module is used to verify the code integrity of said automatic test script, makes the code of automatic test script meet the code of automated test tool code specification.
Wherein, said integrity verification module comprises:
Test case information is added module, is used to add test case information, comprising: test case title and ID;
Exception handling code adds module, is used for adding exception handling code at the skin of said automatic test script;
The mistake authentication module is used to verify whether the automatic test script after the exception handling code interpolation resume module has grammer and write mistake, if checking is not passed through, then makes amendment, if pass through, then generates final automatic test script.
(3) beneficial effect
The present invention has realized the automatic conversion of test case to automatic test script through the mapping relations in key word and the code mapping table, has improved the efficient of automatic test, has reduced resource consumption and has safeguarded complexity.
Description of drawings
Fig. 1 is the method flow diagram that a kind of test case of the embodiment of the invention is converted into automatic test script;
Fig. 2 is the corresponding relation figure that is storing key word and scripted code in Fig. 1 method in key word and the code mapping table;
Fig. 3 is the system architecture synoptic diagram that a kind of test case of the embodiment of the invention is converted into automatic test script.
Embodiment
Below in conjunction with accompanying drawing and embodiment, specific embodiments of the invention describes in further detail.Following examples are used to explain the present invention, but are not used for limiting scope of the present invention.
Method and system of the present invention can connect the test case management instrument; The read test use-case; According to the key word in the test case; Automatically generate the script operation code that relevant with it automated test tool is discerned, then script is carried out integrity verification and fills up, guarantee the correct and integrality of code.The code that generates can directly offer the automated test tool operation.Concrete steps are as shown in Figure 1, comprising:
Step 101: read the test case that the user writes, can connect the test case management instrument, write the test case management instrument of test case and read from storing the user.Operational order in the test case is with key word name in key word and the code mapping table.Storing the corresponding relation of key word and scripted code in key word and the code mapping table, as shown in Figure 2, show several key words and corresponding scripted code, the arrow left side is a key word, the right is corresponding scripted code.
Step S102: in key word and code mapping table, search corresponding test script code according to the key word in the test case, and generate automatic test script.The concrete form of this automatic test script relies on automated test tool; Common automated test tool is like Quicktest Professional (QTP) and IBM Rational Functional Tester (RFT) etc., and the script acquiescence in the present embodiment is the java code that generates to this automated test tool of RFT.As: operation->login user A, as shown in Figure 2, generation script code then:
LoginForm?login=new?LoginForm(ProcessA);
login.LoginByUserName(UserA.getName);
Wherein, " login " is key word, and user A thereafter can replace parameter ProcessA and the UserA in the scripted code automatically.
As: checking->user A logins and successfully gets access to data, generation script code then:
Assert(UserA.Online&&UserA.Info)。
Wherein, " logining successfully " and " getting access to data " is key word, and user A can replace the parameter UserA in the scripted code automatically.
Step S103: verify the code integrity of said automatic test script, make the code of automatic test script meet the code of automated test tool code specification.Integrity checking mainly is the context maintenance to user's operation, and the concrete steps of checking integrality are:
(1) add test case information, comprising: test case title and ID etc., as:
TestCase?case=new?TestCase(CaseName,CaseID)。
There is different meetings to add different information according to actual testing scheme.Mainly add corresponding information, for example: if having when sending the message operation, whether land code before the inspection, if not then on can adding automatically according to the operation code of front and back order dependent.
(2) skin at said automatic test script adds exception handling code, and exception handling code commonly used is the try-catch code.
(3) whether verification step (2) automatic test script afterwards has grammer and writes mistake, if checking is not passed through, then makes amendment, if pass through, then generates final automatic test script, promptly meets the scripted code of automated test tool code specification.Automated test tool is accomplished automatic test after reading this script.
Use method of the present invention, even work as test case after changing, the tester only needs according to the key word standard, and test case of free hand modification gets final product.During test, reforming unit reads use-case again and generates new test script, supplies the operation automatic test.
The present invention also provides a kind of test case to be converted into the system of automatic test script; Its structural representation is as shown in Figure 3; Comprise: the test case acquisition module; Be used to read the test case that the user writes, concrete read test use-case from the test case management instrument, the operational order in the said test case is with key word name in key word and the code mapping table; The test script generation module is used in key word and code mapping table, searching corresponding test script code according to the key word of test case, and generates automatic test script; The integrity verification module is used to verify the code integrity of said automatic test script, makes the code of automatic test script meet the code of automated test tool code specification.
Wherein, said integrity verification module comprises: test case information is added module, is used to add test case information, comprising: test case title and ID; Exception handling code adds module, is used for adding exception handling code at the skin of said automatic test script; The mistake authentication module is used to verify whether the automatic test script after the exception handling code interpolation resume module has grammer and write mistake, if checking is not passed through, then makes amendment, if pass through, then generates final automatic test script.
Above embodiment only is used to explain the present invention; And be not limitation of the present invention; The those of ordinary skill in relevant technologies field under the situation that does not break away from the spirit and scope of the present invention, can also be made various variations and modification; Therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.

Claims (6)

1. a test case is converted into the method for automatic test script, it is characterized in that, may further comprise the steps:
S1: read the test case that the user writes, the operational order in the said test case is with key word name in key word and the code mapping table;
S2: in key word and code mapping table, search corresponding test script code according to the key word in the test case, and generate automatic test script;
S3: verify the code integrity of said automatic test script, make the code of automatic test script meet the code of automated test tool code specification.
2. test case as claimed in claim 1 is converted into the method for automatic test script, it is characterized in that, said step S3 specifically comprises:
S3.1: add test case information, comprising: test case title and ID;
S3.2: the skin at said automatic test script adds exception handling code;
S3.3: whether the automatic test script after the verification step S3.2 has grammer and writes mistake, if checking is not passed through, then makes amendment, if pass through, then generates final automatic test script.
3. test case as claimed in claim 2 is converted into the method for automatic test script, it is characterized in that, said step exception handling code is the try-catch code.
4. be converted into the method for automatic test script like each described test case in the claim 1~3, it is characterized in that, also comprise before the said step S1:
Connect the test case management instrument, store the test case that the user writes in the said test case management instrument.
5. a test case is converted into the system of automatic test script, it is characterized in that, comprising:
The test case acquisition module is used to read the test case that the user writes, and the operational order in the said test case is with key word name in key word and the code mapping table;
The test script generation module is used in key word and code mapping table, searching corresponding test script code according to the key word of test case, and generates automatic test script;
The integrity verification module is used to verify the code integrity of said automatic test script, makes the code of automatic test script meet the code of automated test tool code specification.
6. test case as claimed in claim 5 is converted into the system of automatic test script, it is characterized in that, said integrity verification module comprises:
Test case information is added module, is used to add test case information, comprising: test case title and ID;
Exception handling code adds module, is used for adding exception handling code at the skin of said automatic test script;
The mistake authentication module is used to verify whether the automatic test script after the exception handling code interpolation resume module has grammer and write mistake, if checking is not passed through, then makes amendment, if pass through, then generates final automatic test script.
CN201010593948.4A 2010-12-09 2010-12-09 Method and system for converting test case to automated testing script Active CN102567193B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010593948.4A CN102567193B (en) 2010-12-09 2010-12-09 Method and system for converting test case to automated testing script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010593948.4A CN102567193B (en) 2010-12-09 2010-12-09 Method and system for converting test case to automated testing script

Publications (2)

Publication Number Publication Date
CN102567193A true CN102567193A (en) 2012-07-11
CN102567193B CN102567193B (en) 2015-02-11

Family

ID=46412661

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010593948.4A Active CN102567193B (en) 2010-12-09 2010-12-09 Method and system for converting test case to automated testing script

Country Status (1)

Country Link
CN (1) CN102567193B (en)

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103353857A (en) * 2013-05-31 2013-10-16 国家电网公司 Communication test method of integrated monitoring unit in substation
CN104615536A (en) * 2015-01-29 2015-05-13 北京搜狗科技发展有限公司 Test case control method and electronic device
CN105373478A (en) * 2015-12-14 2016-03-02 广州华多网络科技有限公司 Automatic test method and system
CN106341684A (en) * 2016-09-05 2017-01-18 Tcl集团股份有限公司 Method and system for automatically generating Android TV test script
CN106598869A (en) * 2016-12-26 2017-04-26 北京京东金融科技控股有限公司 Method and device for realizing automatic software testing and electronic equipment
CN107016189A (en) * 2017-04-05 2017-08-04 广东浪潮大数据研究有限公司 It is a kind of that the method asserted and be automatically inserted into RTL is realized based on perl
CN107526685A (en) * 2017-09-11 2017-12-29 杭州迪普科技股份有限公司 A kind of method and device of test command row
CN107703773A (en) * 2017-07-27 2018-02-16 北京长城华冠汽车科技股份有限公司 A kind of method for testing software and device based on hardware-in-loop simulation system
CN108255702A (en) * 2017-09-21 2018-07-06 平安科技(深圳)有限公司 A kind of test case creation method, apparatus, equipment and storage medium
CN108268373A (en) * 2017-09-21 2018-07-10 平安科技(深圳)有限公司 Automatic test cases management method, device, equipment and storage medium
CN108459953A (en) * 2017-02-22 2018-08-28 北京京东尚科信息技术有限公司 test method and device
CN108459957A (en) * 2017-11-29 2018-08-28 平安科技(深圳)有限公司 Test method, device, equipment and the storage medium of fund system test case
CN109086199A (en) * 2018-06-22 2018-12-25 网宿科技股份有限公司 A kind of automation generates the method for test script, terminal and can storage medium
CN109308254A (en) * 2017-07-28 2019-02-05 阿里巴巴集团控股有限公司 A kind of test method, device and test equipment
CN109542780A (en) * 2018-11-13 2019-03-29 东软集团股份有限公司 Test method, test equipment and the storage medium of natural language processing application
CN109656543A (en) * 2018-12-21 2019-04-19 苏州绿控传动科技股份有限公司 A kind of real time workshop method based on document keyword replacement
CN109766271A (en) * 2018-12-22 2019-05-17 中国平安人寿保险股份有限公司 Automated testing method, device, electronic equipment and storage medium are applied in mixing
CN109815127A (en) * 2018-12-21 2019-05-28 浙江数链科技有限公司 Automatized script conversion method, device, computer equipment and storage medium
CN112286814A (en) * 2020-10-30 2021-01-29 上海纳恩汽车技术有限公司 Automatic generation system and method of test case script
CN112527655A (en) * 2020-12-16 2021-03-19 平安银行股份有限公司 Software version quality abnormity detection method and device, electronic equipment and storage medium
CN113392031A (en) * 2021-07-30 2021-09-14 重庆长安新能源汽车科技有限公司 Method for automatically generating test script for test case based on Doors system
CN117724988A (en) * 2024-02-18 2024-03-19 杭州玳数科技有限公司 UI component Library Testing method based on Testing Library, storage medium and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1841328A (en) * 2005-04-02 2006-10-04 华为技术有限公司 Automaton method for script language
CN101706753A (en) * 2009-12-11 2010-05-12 武汉虹信通信技术有限责任公司 Unit testing framework and method based on Perl

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1841328A (en) * 2005-04-02 2006-10-04 华为技术有限公司 Automaton method for script language
CN101706753A (en) * 2009-12-11 2010-05-12 武汉虹信通信技术有限责任公司 Unit testing framework and method based on Perl

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
侯勇: "关键字驱动自动化测试系统的研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
冯玉才等: "关键字驱动自动化测试的原理与实现", 《计算机应用》 *
王君等: "关键字驱动测试框架的研究与实现", 《计算机工程与设计》 *

Cited By (29)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103353857B (en) * 2013-05-31 2016-04-20 国家电网公司 The communication test method of a kind of transformer station comprehensive monitoring unit
CN103353857A (en) * 2013-05-31 2013-10-16 国家电网公司 Communication test method of integrated monitoring unit in substation
CN104615536A (en) * 2015-01-29 2015-05-13 北京搜狗科技发展有限公司 Test case control method and electronic device
CN105373478B (en) * 2015-12-14 2018-06-08 广州华多网络科技有限公司 Automated testing method and system
CN105373478A (en) * 2015-12-14 2016-03-02 广州华多网络科技有限公司 Automatic test method and system
CN106341684A (en) * 2016-09-05 2017-01-18 Tcl集团股份有限公司 Method and system for automatically generating Android TV test script
CN106598869A (en) * 2016-12-26 2017-04-26 北京京东金融科技控股有限公司 Method and device for realizing automatic software testing and electronic equipment
CN108459953A (en) * 2017-02-22 2018-08-28 北京京东尚科信息技术有限公司 test method and device
CN107016189A (en) * 2017-04-05 2017-08-04 广东浪潮大数据研究有限公司 It is a kind of that the method asserted and be automatically inserted into RTL is realized based on perl
CN107703773A (en) * 2017-07-27 2018-02-16 北京长城华冠汽车科技股份有限公司 A kind of method for testing software and device based on hardware-in-loop simulation system
CN109308254B (en) * 2017-07-28 2022-06-03 阿里巴巴集团控股有限公司 Test method, test device and test equipment
CN109308254A (en) * 2017-07-28 2019-02-05 阿里巴巴集团控股有限公司 A kind of test method, device and test equipment
CN107526685A (en) * 2017-09-11 2017-12-29 杭州迪普科技股份有限公司 A kind of method and device of test command row
CN108255702A (en) * 2017-09-21 2018-07-06 平安科技(深圳)有限公司 A kind of test case creation method, apparatus, equipment and storage medium
CN108268373A (en) * 2017-09-21 2018-07-10 平安科技(深圳)有限公司 Automatic test cases management method, device, equipment and storage medium
WO2019056726A1 (en) * 2017-09-21 2019-03-28 平安科技(深圳)有限公司 Test case creation method and device, equipment, and storage medium
CN108459957A (en) * 2017-11-29 2018-08-28 平安科技(深圳)有限公司 Test method, device, equipment and the storage medium of fund system test case
CN109086199A (en) * 2018-06-22 2018-12-25 网宿科技股份有限公司 A kind of automation generates the method for test script, terminal and can storage medium
CN109542780B (en) * 2018-11-13 2022-02-15 东软集团股份有限公司 Test method, test device and storage medium for natural language processing application
CN109542780A (en) * 2018-11-13 2019-03-29 东软集团股份有限公司 Test method, test equipment and the storage medium of natural language processing application
CN109656543A (en) * 2018-12-21 2019-04-19 苏州绿控传动科技股份有限公司 A kind of real time workshop method based on document keyword replacement
CN109815127A (en) * 2018-12-21 2019-05-28 浙江数链科技有限公司 Automatized script conversion method, device, computer equipment and storage medium
CN109656543B (en) * 2018-12-21 2022-03-29 苏州绿控传动科技股份有限公司 Automatic code generation method based on file keyword replacement
CN109766271A (en) * 2018-12-22 2019-05-17 中国平安人寿保险股份有限公司 Automated testing method, device, electronic equipment and storage medium are applied in mixing
CN109766271B (en) * 2018-12-22 2022-03-11 中国平安人寿保险股份有限公司 Hybrid application automatic testing method and device, electronic equipment and storage medium
CN112286814A (en) * 2020-10-30 2021-01-29 上海纳恩汽车技术有限公司 Automatic generation system and method of test case script
CN112527655A (en) * 2020-12-16 2021-03-19 平安银行股份有限公司 Software version quality abnormity detection method and device, electronic equipment and storage medium
CN113392031A (en) * 2021-07-30 2021-09-14 重庆长安新能源汽车科技有限公司 Method for automatically generating test script for test case based on Doors system
CN117724988A (en) * 2024-02-18 2024-03-19 杭州玳数科技有限公司 UI component Library Testing method based on Testing Library, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN102567193B (en) 2015-02-11

Similar Documents

Publication Publication Date Title
CN102567193B (en) Method and system for converting test case to automated testing script
CN101339534B (en) Software test apparatus and test method
CN102831052B (en) Test exemple automation generating apparatus and method
CN109086199B (en) Method, terminal and storage medium for automatically generating test script
CN103186460B (en) A kind of method, Apparatus and system of generating test use case script
CN105912473B (en) Mobile APP automatically testing platform and test method based on BDD
CN102306122A (en) Automated testing method and equipment
CN103164328B (en) The regression testing method of a kind of business function, Apparatus and system
CN103019726A (en) Management method and device of software system service rules
CN101996131A (en) Automatic test method and automatic test platform for graphic user interface (GUI) based on x extensive makeup language (XML) packaging key word
CN104298595A (en) Automatic testing method and testing system
CN103425574A (en) Method and device for testing applications
CN102375778A (en) Method and system for automatically testing digital signal processor (DSP)
CN109933521A (en) Automated testing method, device, computer equipment and storage medium based on BDD
CN102567201A (en) Method for automatically recovering cross-model GUI (graphic user interface) test scripts
US20110093097A1 (en) Device information setting apparatus and device information setting method
CN104375934A (en) Method for testing reliability of Android mobile phone software
CN115080398A (en) Automatic interface test system and method
CN104657274A (en) Method and device for testing software interface
CN107479866B (en) Method for realizing application data and functions of open terminal based on reconstruction technology
CN112346987A (en) Test case generation and conversion method and system based on Xmind
CN112181854A (en) Method, device, equipment and storage medium for generating flow automation script
CN103150281B (en) The integrated approach of bus bar module, device and verification method and device
CN101634965A (en) Method for testing Linux kernel-grade unit
CN108804257A (en) SOT state of termination detection method, device, terminal and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP02 Change in the address of a patent holder

Address after: Room 810, 8 / F, 34 Haidian Street, Haidian District, Beijing 100080

Patentee after: BEIJING D-MEDIA COMMUNICATION TECHNOLOGY Co.,Ltd.

Address before: 100089 Beijing city Haidian District wanquanzhuang Road No. 28 Wanliu new building A block 5 layer

Patentee before: BEIJING D-MEDIA COMMUNICATION TECHNOLOGY Co.,Ltd.

CP02 Change in the address of a patent holder