CN109739758B - Test case conversion method and device - Google Patents

Test case conversion method and device Download PDF

Info

Publication number
CN109739758B
CN109739758B CN201811622085.1A CN201811622085A CN109739758B CN 109739758 B CN109739758 B CN 109739758B CN 201811622085 A CN201811622085 A CN 201811622085A CN 109739758 B CN109739758 B CN 109739758B
Authority
CN
China
Prior art keywords
language
test case
elements
converting
conversion
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.)
Active
Application number
CN201811622085.1A
Other languages
Chinese (zh)
Other versions
CN109739758A (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 Testin Information Technology Co Ltd
Original Assignee
Beijing Testin Information 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 Testin Information Technology Co Ltd filed Critical Beijing Testin Information Technology Co Ltd
Priority to CN201811622085.1A priority Critical patent/CN109739758B/en
Publication of CN109739758A publication Critical patent/CN109739758A/en
Application granted granted Critical
Publication of CN109739758B publication Critical patent/CN109739758B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Telephone Function (AREA)

Abstract

The invention discloses a test case conversion method, which comprises the following steps: acquiring a first test case to be converted, wherein the first test case is compiled based on a first language; converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages; and generating a second test case based on the elements of the second language. By adopting the embodiment of the invention, the test cases of different languages can be converted more conveniently.

Description

Test case conversion method and device
Technical Field
The invention relates to the field of terminals, in particular to a test case conversion method and device.
Background
With the development of communication technology, new communication services are continuously generated, each communication service needs support of a corresponding system, in order to improve the running quality of the system and increase the functions of the system, the system needs to be automatically tested before the system is applied, the automatic testing is to run system software or application program software under preset conditions and evaluate the running result, and the automatic testing program is usually realized by a test case compiled based on a script language.
However, most of the automatic testers can only write test cases based on the table language, the script language cannot be written, the cost of the automatic testers who can write the script language is high, the conversion between different script languages is troublesome, and the complexity of the automatic test is increased.
Therefore, a test case transformation method is needed to make the test case transformation more convenient and faster.
Disclosure of Invention
The embodiment of the invention provides a test case conversion method, which aims to solve the problem that test cases of different languages are not convenient to convert.
In order to solve the technical problem, the invention is realized as follows:
in a first aspect, a method for test case transformation is provided, where the method includes:
acquiring a first test case to be converted, wherein the first test case is compiled based on a first language;
converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages;
and generating a second test case based on the elements of the second language.
In a second aspect, there is provided an apparatus comprising:
the first test case obtaining module is used for obtaining a first test case to be converted, and the first test case is compiled based on a first language;
the element conversion module is used for converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages;
and the second test case generating module is used for generating a second test case based on the elements of the second language.
In a third aspect, a terminal device is provided, the terminal device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the method according to the first aspect.
In the embodiment of the invention, a first test case to be converted is obtained, and the first test case is compiled based on a first language; converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages; generating a second test case based on the elements of the second language; the conversion between the test cases of different languages can be more convenient.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flowchart illustrating a test case transformation method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a test case transformation method according to another embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a test case converting apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal device according to another embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow diagram of a test case conversion method according to an embodiment of the present invention, and referring to fig. 1, the method specifically includes the following steps:
102, obtaining a first test case to be converted, wherein the first test case is written based on a first language.
Specifically, in the automatic test, the programming languages of different test cases are different, and the test case programmed in one language can be converted into the test case programmed in another language according to the requirement.
And 104, converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages.
Specifically, different languages are written according to different writing rules when the test cases are written in different languages, so that the elements in the different languages of the different test cases need to be converted based on the conversion rules, a plurality of different elements in the first language can be extracted from the first test case, and the plurality of different elements in the first language are correspondingly converted into a plurality of different elements in the second language based on the conversion rules between the elements in the first language and the elements in the second language.
And 106, generating a second test case based on the elements of the second language.
Specifically, based on the converted elements in the second language, the second test case may be generated according to the writing rule of the second language.
For the embodiment corresponding to fig. 1, a first test case to be converted is obtained, and the first test case is written based on a first language; converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages; generating a second test case based on the elements of the second language; the conversion between the test cases of different languages can be more convenient.
Optionally, in another embodiment of the present invention, the test case conversion method further includes:
a second language is determined as a conversion target language, and conversion rules between elements of the first language and the second language are determined.
Based on the method, the second language is determined, and the conversion rule between the elements of the first language and the second language is determined, so that the elements of the first language can be converted into the elements of the second language according to the first language, the second language and the conversion rule between the elements of the first language and the second language, the second test case is generated, and the conversion between the test cases of different languages is more convenient.
Optionally, in another embodiment of the present invention, the test case conversion method further includes:
determining a first language selection instruction input by a user, and taking a language carried by the first language selection instruction as a second language of a conversion target language.
Specifically, the user may select the drop-down box from a target language of the test setup interface, and select a second language as the conversion target language among a plurality of languages according to the test requirement.
Based on this, when the second language is determined, the language carried by the first language selection instruction is used as the second language, so that the determination of the second language can be more purposeful and better conforms to the will of the user.
Optionally, in another embodiment of the present invention, the test case conversion method further includes:
determining a second language selection instruction input by a user, and taking a first language carried by the second language selection instruction as a writing language of the first test case; or,
and determining the writing language of the first test case as a first language based on the content of the first test case.
Specifically, the user may select the first language as the language to be converted according to the test requirement from the drop-down box for the language to be converted in the test setting interface among a plurality of languages, and the terminal may directly determine the first language according to the content of the first test case without user input.
Therefore, when the first language is determined, the first language can be determined through the second language selection instruction input by the user and can also be determined through the content of the first test case, and the diversity of the first language determination is increased.
Optionally, in another embodiment of the present invention, the test case conversion method further includes:
and determining the writing language of the first test case based on the file suffix name of the first test case.
Specifically, the terminal may determine the first language according to the file suffix name of the first test case, for example, if the file suffix name of the first test case is.js, the first language is JavaScript, and the file suffix name of the first test case is.cpp, the first language is C + + language.
Based on this, when the first language is determined, the first language is specifically determined through the file suffix name of the first test case, and a user does not need to input a language selection instruction, so that the determination of the first language is more convenient.
Optionally, in another embodiment of the present invention, one of the first language and the second language is a table language, and the other is a script language.
Specifically, the table language includes a writing language which can be a comma-separated value file or an Excel file, and the scripting language can be JavaScript, Python, Ruby, and the like. Elements of the tabular language may be converted to elements of the scripting language, or elements of the scripting language may be converted to elements of the tabular language.
Based on the method, when the first language is the table language and the second language is the script language, a tester can compile a first test case by using the simple first language and generate a complex second test case compiled by the second language through a conversion rule, so that the compiling time of the tester is saved; when the first language is a script language and the second language is a table language, the complex second test case can be converted into the simple first test case in time under the condition that testers leave jobs or under other conditions, and the execution of a test task cannot be influenced.
Optionally, in another embodiment of the present invention, the test case conversion method further includes:
converting the function elements in the first test case into function elements in the second language;
converting the title element in the first test case into a function annotation element of the second language;
converting the operation step elements in the first test case into function operation step elements in the second language;
and converting the expected result elements in the first test case into function operation result elements in the second language.
Specifically, when the first language is a table language and the second language is a script language, the elements of the first language may include a function element, a header element, an operation step element, and an expected result element, and the elements of the second language may include a function element, a function comment element, a function execution step element, and a function execution result element, so that various different elements in the first test case may be correspondingly converted into different elements of the second language.
Therefore, various elements in the first test case are correspondingly converted into elements of the second language, so that the consistency of the second test case and the first test case can be improved.
Optionally, in another embodiment of the present invention, the first language and the second language are two different scripting languages.
Specifically, in addition to the interconversion between the elements of the table language and the elements of the scripting language, the interconversion between the elements of different scripting languages is also possible, for example, the interconversion between the elements of JavaScript and Python.
Therefore, the problem that a test case written by one scripting language cannot be understood by testers only using other scripting languages can be solved by converting one scripting language into another scripting language.
Fig. 2 is a schematic flow diagram of a test case conversion method according to an embodiment of the present invention, and referring to fig. 2, the method specifically includes the following steps:
step 202, obtaining a first test case to be converted, wherein the first test case is compiled based on a first language;
step 204, determining the writing language of the first test case as a first language based on the file suffix name of the first test case;
step 206, determining a first language selection instruction input by a user, taking a language carried by the first language selection instruction as a second language of a conversion target language, and determining a conversion rule between elements of the first language and the second language;
208, converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages;
and 210, generating a second test case based on the elements of the second language.
For the embodiment corresponding to fig. 2, a first test case to be converted is obtained; determining the writing language of the first test case as a first language based on the file suffix name of the first test case; determining a language carried by the first selection instruction as a second language, determining a conversion rule between elements of the first language and the second language, and converting the elements of the first language into the elements of the second language based on the conversion rule; and generating a second test case based on the elements of the second language. The determination of the first language can be more convenient, the consistency of the second test case and the first test case can be improved, and the conversion between the test cases can be more convenient.
Figure BDA0001927114230000071
TABLE 1
Table 1 shows an Excel test case provided in an embodiment of the present invention, and a test case written in python language can be generated according to the Excel test case.
Specifically, the elements in the Excel test case may include a function with a function number, a function name, a title, an operation type, operation content, operation data and an expected result, the elements in the test case written in the python language may include a python class, a python function, a function annotation, an operation step and an operation result, the content of the Excel test case is analyzed, and one Excel test case corresponds to one python test class;
first, a python file is created: when the table name of Excel is read, creating a python file, wherein the class name of python corresponds to the table name of Excel;
second, create a python function and determine the function name: reading the contents in the Excel table sequentially from left to right and from top to bottom, and creating a python function if the function number is not null when reading the function number of a certain row and a first column, wherein the function name of the second column of the row corresponds to the function name of the python function.
Third, creating a function annotation: the title of the third column of this row corresponds to the function annotation of the python function.
Step four, a creating operation step: and combining the operation type of the fourth column of the row, the operation content of the fifth column and the operation data creation operation step of the sixth column.
If the function number of the first column of a certain row is empty, which indicates that no new function needs to be created, the operation steps can be directly created in combination with the contents of the fourth, fifth and sixth columns of the row.
And step five, creating a running result: the python function is run to get a run result and the expected result of the seventh column of this row is compared to the run result of the python function.
Thus, a test case written in the python language is generated.
As shown in table 1, the element in the Excel test case in table 1 is converted into the element in the test case written in python language, which may be:
def Setup(self):self.driver.get(“https://www.baidu.com”)
title=self.driver.title
assert Equal (title, u 'hundredth, you know')
As illustrated by the Setup function in table 1, it should be noted that the general test class includes testcase and testdown functions in addition to the Setup function, Setup is an initialization function, testcase is each specific test function, and testdown is a function of the test completion processing site.
For the embodiment corresponding to table 1, obtaining an Excel test case to be converted, wherein the Excel test case is compiled based on an Excel language; converting the elements in the Excel test case into elements in python language based on a conversion rule between the elements in the Excel language and the python language; generating a python test case based on the elements of the python language; the conversion from the test case of the Excel language to the test case of the python language can be more convenient.
Figure BDA0001927114230000091
TABLE 2
Table 2 shows an Excel test case provided in another embodiment of the present invention, where the login function is tested under the initial conditions: opening a login page, then inputting a user name and a password, clicking a login button, judging whether a pop-up box exists or not and the content is 'login success', if login is carried out by using the correct user name and the correct password, popping up 'login success' after clicking the login button, and if login is carried out by using the wrong user name, popping up 'user name error' after clicking the login button.
Fig. 3 is a schematic structural diagram of a test case device according to an embodiment of the present invention, and referring to fig. 3, the device may specifically include: a first test case obtaining module 302, an element converting module 304, and a second test case generating module 306, wherein:
a first test case obtaining module 302, configured to obtain a first test case to be converted, where the first test case is written based on a first language;
an element conversion module 304, configured to convert the elements in the first test case into elements in a second language based on conversion rules between elements in different languages;
and a second test case generating module 306, configured to generate a second test case based on the element in the second language.
For the embodiment corresponding to fig. 3, a first test case to be converted is obtained, and the first test case is written based on a first language; converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages; generating a second test case based on the elements of the second language; the conversion between the test cases of different languages can be more convenient.
Optionally, the apparatus further comprises:
and the second language and conversion rule determining module is used for determining a second language which is a conversion target language and determining a conversion rule between elements of the first language and the second language.
Optionally, the second language and conversion rule determining module includes:
and the second language determining submodule is used for determining a first language selection instruction input by a user and taking the language carried by the first language selection instruction as a second language of the conversion target language.
Optionally, the apparatus further comprises:
the first language determination module is used for determining a second language selection instruction input by a user and taking a first language carried by the second language selection instruction as a writing language of the first test case; or determining the writing language of the first test case as the first language based on the content of the first test case.
Optionally, the first language determination module includes:
and the first language determination submodule is used for determining the writing language of the first test case based on the file suffix name of the first test case.
Optionally, one of the first language and the second language is a table language, and the other is a script language.
Optionally, the element conversion module includes:
the element conversion submodule is used for converting the function elements in the first test case into the function elements in the second language;
converting the title element in the first test case into a function annotation element of the second language;
converting the operation step elements in the first test case into function operation step elements in the second language;
and converting the expected result elements in the first test case into function operation result elements in the second language.
Optionally, the first language and the second language are two different scripting languages.
The device provided by the embodiment of the present invention can implement each process implemented by the mobile terminal in the method embodiments of fig. 1 to fig. 2, and is not described herein again to avoid repetition.
Figure 4 is a schematic diagram of a hardware configuration of a mobile terminal implementing various embodiments of the present invention,
the mobile terminal 400 includes, but is not limited to: radio frequency unit 401, network module 402, audio output unit 403, input unit 404, sensor 405, display unit 406, user input unit 407, interface unit 408, memory 409, processor 410, and power supply 411. Those skilled in the art will appreciate that the mobile terminal architecture shown in fig. 4 is not intended to be limiting of mobile terminals, and that a mobile terminal may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. In the embodiment of the present invention, the mobile terminal includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.
The radio frequency unit 401 is configured to obtain a first test case to be converted, where the first test case is written based on a first language;
a processor 410, configured to convert the elements in the first test case into elements in a second language based on conversion rules between elements in different languages;
and generating a second test case based on the elements of the second language.
The method comprises the steps that a first test case to be converted is obtained, and the first test case is compiled based on a first language; converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages; generating a second test case based on the elements of the second language; the conversion between the test cases of different languages can be more convenient.
It should be understood that, in the embodiment of the present invention, the radio frequency unit 401 may be used for receiving and sending signals during a message sending and receiving process or a call process, and specifically, receives downlink data from a base station and then processes the received downlink data to the processor 410; in addition, the uplink data is transmitted to the base station. Typically, radio unit 401 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. Further, the radio unit 401 can also communicate with a network and other devices through a wireless communication system.
The mobile terminal provides the user with wireless broadband internet access through the network module 402, such as helping the user send and receive e-mails, browse web pages, and access streaming media.
The audio output unit 403 may convert audio data received by the radio frequency unit 401 or the network module 402 or stored in the memory 409 into an audio signal and output as sound. Also, the audio output unit 403 may also provide audio output related to a specific function performed by the mobile terminal 400 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 403 includes a speaker, a buzzer, a receiver, and the like.
The input unit 404 is used to receive audio or video signals. The input Unit 404 may include a Graphics Processing Unit (GPU) 4041 and a microphone 4042, and the Graphics processor 4041 processes image data of a still picture or video obtained by an image capturing apparatus (such as a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 406. The image frames processed by the graphic processor 4041 may be stored in the memory 409 (or other storage medium) or transmitted via the radio frequency unit 401 or the network module 402. The microphone 4042 may receive sound, and may be capable of processing such sound into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 401 in case of the phone call mode.
The mobile terminal 400 also includes at least one sensor 405, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor that can adjust the brightness of the display panel 4061 according to the brightness of ambient light, and a proximity sensor that can turn off the display panel 4061 and/or the backlight when the mobile terminal 400 is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors 405 may also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be described in detail herein.
The display unit 406 is used to display information input by the user or information provided to the user. The Display unit 406 may include a Display panel 4061, and the Display panel 4061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 407 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the mobile terminal. Specifically, the user input unit 407 includes a touch panel 4071 and other input devices 4072. Touch panel 4071, also referred to as a touch screen, may collect touch operations by a user on or near it (e.g., operations by a user on or near touch panel 4071 using a finger, a stylus, or any suitable object or attachment). The touch panel 4071 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 410, receives a command from the processor 410, and executes the command. In addition, the touch panel 4071 can be implemented by using various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 4071, the user input unit 407 may include other input devices 4072. Specifically, the other input devices 4072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, and a joystick, which are not described herein again.
Further, the touch panel 4071 can be overlaid on the display panel 4061, and when the touch panel 4071 detects a touch operation thereon or nearby, the touch operation is transmitted to the processor 410 to determine the type of the touch event, and then the processor 410 provides a corresponding visual output on the display panel 4061 according to the type of the touch event. Although in fig. 4, the touch panel 4071 and the display panel 4061 are two separate components to implement the input and output functions of the mobile terminal, in some embodiments, the touch panel 4071 and the display panel 4061 may be integrated to implement the input and output functions of the mobile terminal, which is not limited herein.
The interface unit 408 is an interface through which an external device is connected to the mobile terminal 400. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 408 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the mobile terminal 400 or may be used to transmit data between the mobile terminal 400 and external devices.
The memory 409 may be used to store software programs as well as various data. The memory 409 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 409 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 410 is a control center of the mobile terminal, connects various parts of the entire mobile terminal using various interfaces and lines, and performs various functions of the mobile terminal and processes data by operating or executing software programs and/or modules stored in the memory 409 and calling data stored in the memory 409, thereby integrally monitoring the mobile terminal. Processor 410 may include one or more processing units; preferably, the processor 410 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 410.
The mobile terminal 400 may further include a power supply 411 (e.g., a battery) for supplying power to various components, and preferably, the power supply 411 may be logically connected to the processor 410 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system.
In addition, the mobile terminal 400 includes some functional modules that are not shown, and thus, are not described in detail herein.
Preferably, an embodiment of the present invention further provides a mobile terminal, which includes a processor 410, a memory 409, and a computer program that is stored in the memory 409 and can be run on the processor 410, and when being executed by the processor 410, the computer program implements each process of the test case conversion method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the test case conversion method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (7)

1. A test case conversion method is characterized by comprising the following steps:
acquiring a first test case to be converted, wherein the first test case is compiled based on a first language;
converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages;
generating a second test case based on the elements of the second language;
before converting the elements in the first test case to elements in a second language, the method further comprises:
determining a second language as a conversion target language, and determining a conversion rule between elements of the first language and the second language;
one of the first language and the second language is a table language, and the other language is a script language;
when the first language is a table language and the second language is a script language, a tester writes a first test case by using the simple first language and generates a complex second test case written by the second language by converting rules, so that the writing time of the tester is saved; when the first language is a script language and the second language is a table language, the complex second test case is converted into a simple first test case in time under the condition that a tester leaves the job or other conditions, and the performance of a test task is not influenced;
converting the elements in the first test case into elements in a second language, including:
converting the function elements in the first test case into function elements in the second language;
converting the title element in the first test case into a function annotation element of the second language;
converting the operation step elements in the first test case into function operation step elements in the second language;
and converting the expected result elements in the first test case into function operation result elements in the second language.
2. The method of claim 1, wherein determining the second language as the conversion target language comprises:
determining a first language selection instruction input by a user, and taking a language carried by the first language selection instruction as a second language of a conversion target language.
3. The method according to claim 1, wherein before determining the second language as the conversion target language, the method comprises:
determining a second language selection instruction input by a user, and taking a first language carried by the second language selection instruction as a writing language of the first test case; or,
and determining the writing language of the first test case as a first language based on the content of the first test case.
4. The method of claim 3, wherein determining the authoring language for the first test case based on the contents of the first test case comprises:
and determining the writing language of the first test case based on the file suffix name of the first test case.
5. A test case converting apparatus, comprising:
the first test case obtaining module is used for obtaining a first test case to be converted, and the first test case is compiled based on a first language;
the element conversion module is used for converting the elements in the first test case into elements in a second language based on conversion rules among elements in different languages;
the second test case generation module is used for generating a second test case based on the elements of the second language;
a second language and conversion rule determination module for determining a second language as a conversion target language and determining a conversion rule between elements of the first language and the second language;
one of the first language and the second language is a table language, and the other language is a script language;
when the first language is a table language and the second language is a script language, a tester writes a first test case by using the simple first language and generates a complex second test case written by the second language by converting rules, so that the writing time of the tester is saved; when the first language is a script language and the second language is a table language, the complex second test case is converted into a simple first test case in time under the condition that a tester leaves the job or other conditions, and the performance of a test task is not influenced;
the element conversion module comprises:
the element conversion submodule is used for converting the function elements in the first test case into the function elements in the second language;
converting the title element in the first test case into a function annotation element of the second language;
converting the operation step elements in the first test case into function operation step elements in the second language;
and converting the expected result elements in the first test case into function operation result elements in the second language.
6. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, carries out the steps of the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN201811622085.1A 2018-12-28 2018-12-28 Test case conversion method and device Active CN109739758B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811622085.1A CN109739758B (en) 2018-12-28 2018-12-28 Test case conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811622085.1A CN109739758B (en) 2018-12-28 2018-12-28 Test case conversion method and device

Publications (2)

Publication Number Publication Date
CN109739758A CN109739758A (en) 2019-05-10
CN109739758B true CN109739758B (en) 2022-02-01

Family

ID=66361750

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811622085.1A Active CN109739758B (en) 2018-12-28 2018-12-28 Test case conversion method and device

Country Status (1)

Country Link
CN (1) CN109739758B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111209210A (en) * 2020-01-15 2020-05-29 北京明略软件系统有限公司 Method and device for generating test case, electronic equipment and storage medium
CN111488274B (en) * 2020-03-27 2023-10-24 杭州海兴电力科技股份有限公司 Test case construction method, test equipment and storage medium
CN114385488A (en) * 2021-12-17 2022-04-22 杭州趣链科技有限公司 Block chain testing method, device, equipment and storage medium
CN115963810A (en) * 2023-01-03 2023-04-14 重庆长安汽车股份有限公司 Automatic test method, device, equipment and medium based on remote control vehicle

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156655A (en) * 2011-05-05 2011-08-17 北京大学深圳研究生院 Senior language code generation method and generator
CN102479152A (en) * 2010-11-26 2012-05-30 腾讯科技(深圳)有限公司 Method and device for obtaining tool automatic test results on basis of Android platform
CN106126411A (en) * 2016-06-13 2016-11-16 广州酷狗计算机科技有限公司 A kind of method and apparatus that tested program code is tested
CN107943683A (en) * 2017-10-30 2018-04-20 北京奇虎科技有限公司 A kind of test script generation method, device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130191814A1 (en) * 2010-07-27 2013-07-25 Hitachi, Ltd. Test scenario generation method, test scenario generation system, and test scenario generation program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479152A (en) * 2010-11-26 2012-05-30 腾讯科技(深圳)有限公司 Method and device for obtaining tool automatic test results on basis of Android platform
CN102156655A (en) * 2011-05-05 2011-08-17 北京大学深圳研究生院 Senior language code generation method and generator
CN106126411A (en) * 2016-06-13 2016-11-16 广州酷狗计算机科技有限公司 A kind of method and apparatus that tested program code is tested
CN107943683A (en) * 2017-10-30 2018-04-20 北京奇虎科技有限公司 A kind of test script generation method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109739758A (en) 2019-05-10

Similar Documents

Publication Publication Date Title
CN109739758B (en) Test case conversion method and device
CN109947650B (en) Script step processing method, device and system
WO2021136159A1 (en) Screenshot method and electronic device
CN109240577B (en) Screen capturing method and terminal
WO2021083091A1 (en) Screenshot capturing method and terminal device
CN108536509B (en) Application body-splitting method and mobile terminal
CN111475080B (en) Misoperation prompting method and electronic equipment
CN112423087A (en) Video interaction information display method and terminal equipment
CN110096203B (en) Screenshot method and mobile terminal
CN109901761B (en) Content display method and mobile terminal
CN110069407B (en) Function test method and device for application program
CN110990679A (en) Information searching method and electronic equipment
CN109491670A (en) A kind of page display method and terminal device
CN113407169B (en) Software development method and device
CN109857659B (en) Control operation method and device
CN109829707B (en) Interface display method and terminal equipment
CN111309390A (en) Method for acquiring configuration information and electronic equipment
CN109871324B (en) Control operation method and device
CN109857646A (en) A kind of automated testing method and device
CN111310165B (en) Account switching or registering method and electronic equipment
CN111147750B (en) Object display method, electronic device, and medium
CN109634508B (en) User information loading method and device
CN111443819A (en) Control method and electronic device
CN111443968A (en) Screenshot method and electronic equipment
CN110717133A (en) Page updating method and device, terminal equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210721

Address after: 100016 no.4301, No.52 Jiuxianqiao hospital, Chaoyang District, Beijing

Applicant after: BEIJING TESTIN INFORMATION TECHNOLOGY Co.,Ltd.

Address before: Room 2016, building 2, No.8, Fenghuang Third Road, Zhongxin Guangzhou Knowledge City, Guangzhou 510260, Guangdong Province

Applicant before: GUANGZHOU TESTIN INFORMATION TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant