Test case execution method, device and terminal

By automating the parsing and execution of test cases, the accuracy and efficiency issues caused by manual testing errors in the billing system are resolved, resulting in improved accuracy and efficiency of test results. It also supports modular design and high reusability for various test objects.

CN114328167BActive Publication Date: 2025-11-21CHINA MOBILE GRP GUANGDONG CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011069053.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-30
Publication Date
2025-11-21
Estimated Expiration
2040-09-30

AI Technical Summary

Technical Problem

The testing process of existing billing systems relies on manual operation, which is prone to errors that lead to inaccurate test results, resulting in high testing costs and low efficiency.

Method used

By reading the target test cases and parsing files, the target execution unit and connection information are obtained, and the test is automatically connected and executed to receive the test results and determine whether the test has passed.

Benefits of technology

It improves the accuracy and efficiency of test results, supports multiple test objects, features modular design and high reusability, and is an automated testing framework implemented in Python.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328167B_ABST
    Figure CN114328167B_ABST
Patent Text Reader

Abstract

The application discloses a test case execution method and device and a terminal. The method comprises the following steps: reading a target test case and a target analysis file corresponding to the target test case; analyzing the target analysis file to obtain a target execution unit and target connection information according to a script type of the target test case and a host identifier in the target analysis file; connecting the target execution unit based on the target connection information, and executing a test on the target test case through the connected target execution unit; receiving a test execution result of the target test case sent by the target execution unit; and determining that the test passes in the case that the test execution result is consistent with a preset test execution result, thereby realizing automatic test on a test case file, ensuring the accuracy of the test execution result, and improving the test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of automation testing technology, and in particular to a test case execution method and device and a terminal. BACKGROUND

[0002] In a mobile communication system, a charging system provides charging functions for mobile communication services and is an important component of a BOSS system, generally including four modules, namely, a Convergence Billing Engine (CBE), an Account Balance Management (ABM), a BILL, and a HSC, as follows.

[0003] The services involved in the CBE mainly include voice, General Packet Radio Service (GPRS), Wireless Local Area Network (WLAN), and online / offline pricing of short messages, wherein the online pricing follows a DCC message processing flow, and the offline pricing follows a call sheet processing flow.

[0004] The main services involved in the ABM include account settlement, signal control, and free resource donation, wherein the account settlement and signal control are resident programs, and the free resource donation is a timed program.

[0005] The services involved in the BILL mainly include monthly collection of rent, recharging, and account settlement, wherein the monthly collection of rent is a resident program, the recharging is a real-time socket interface, and the account settlement is a timed program.

[0006] The services involved in the HSC mainly include subscription relationship synchronization and three-party data synchronization, and are real-time was interfaces.

[0007] In addition, in the charging system, according to different implementation modes of charging services, the charging system can be divided into real-time interface type, file interface type, resident program type, and timed program type.

[0008] For the foregoing charging system, when acceptance testing of the charging services involved is performed, a test personnel realizes the testing by means of manual testing, and when the charging services change, the test personnel needs to repeatedly manually execute test cases for regression testing.

[0009] For example, taking testing of a pre-paid monthly collection of rent service as an example, the test case name is: 58 yuan 4G Fly package pre-paid user monthly collection of rent success.

[0010] The preconditions are: (1) a pre-paid user, (2) the user subscribes to a 58 yuan 4G Fly package, (3) the user balance is >= 58 yuan, and (4) the user monthly collection date is today.

[0011] Execution step: pull up the monthly settlement rent collection procedure to collect rent.

[0012] Expected result: (1) monthly settlement success, monthly settlement status is "monthly settlement success", and monthly settlement date is changed to the next month today, (2) user balance is deducted by 58 yuan.

[0013] Among them, "precondition" needs the tester to pre-set the brand, product, balance and monthly settlement date of the user in the database, "execution step" needs the tester to pull up the monthly settlement procedure on the BILL host, and "test execution result and expected result comparison" needs the tester to query the monthly settlement status, monthly settlement date, balance and expected result in the database for comparison.

[0014] However, in the foregoing test process, manual operation of the database or the application program host may exist misoperation, resulting in inaccurate test execution result, high test cost and low test efficiency. SUMMARY

[0015] Embodiments of the present application provide a test case execution method, device and terminal, which can ensure the accuracy of the test execution result and has high test efficiency.

[0016] To solve the above problems, the present application is implemented as follows:

[0017] In a first aspect, the embodiments of the present application provide a test case execution method, comprising: reading a target test case and a target analysis file corresponding to the target test case; analyzing the target analysis file to obtain a target execution unit and target connection information according to a script type of the target test case and a host identifier in the target analysis file; connecting the target execution unit based on the target connection information, and executing a test on the target test case through the connected target execution unit; receiving a test execution result of the target test case sent by the target execution unit; and determining that the test passes in a case where the test execution result is consistent with a preset test execution result.

[0018] In a second aspect, the embodiments of the present application further provide an execution device of a test case, comprising: a reading module configured to read a target test case and a target analysis file corresponding to the target test case; an analysis module configured to analyze the target analysis file to obtain a target execution unit and target connection information according to a script type of the target test case and a host identifier in the target analysis file; a testing module configured to connect the target execution unit based on the target connection information, and perform a test on the target test case through the connected target execution unit; a receiving module configured to receive a test execution result of the target test case sent by the target execution unit; and a result determining module configured to determine that the test passes in a case where the test execution result is consistent with a preset test execution result.

[0019] In a third aspect, the embodiments of the present application further provide a terminal, comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, and the program or instruction is executed by the processor to implement the steps of the test case execution method according to the first aspect.

[0020] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, when the instructions in the storage medium are executed by the processor in the terminal, the terminal can execute the steps of the test case execution method according to the first aspect.

[0021] The above at least one technical solution adopted by the embodiments of the present application can achieve the following beneficial effects:

[0022] In the embodiments of the present application, the target test case and the target analysis file are read, the target analysis file is analyzed to obtain a target execution unit and target connection information according to a script type of the target test case and a host identifier in the target analysis file, the target execution unit is connected based on the target connection information, the target test case is tested through the connected target execution unit, the test execution result of the target test case sent by the target execution unit is received, and the test passes in a case where the test execution result is consistent with a preset test execution result, thereby realizing the automatic test on the test case file, ensuring the accuracy of the test execution result, and improving the test efficiency.

[0023] The above description is only a summary of the technical solutions of the application, in order to more clearly understand the technical means of the present application, the embodiments of the present application can be implemented according to the content of the description, and in order to make the above and other purposes, characteristics and advantages of the present application more obvious and easy to understand, the following specific embodiments of the present application are described. BRIEF DESCRIPTION OF DRAWINGS

[0024] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0025] Figure 1 This is a flowchart illustrating a method for executing test cases according to an exemplary embodiment.

[0026] Figure 2 This is a schematic diagram of the flow framework of a test case execution method provided according to an exemplary embodiment.

[0027] Figure 3 This is a schematic diagram illustrating the parsing results of a target test case provided according to an exemplary embodiment.

[0028] Figure 4 This is a block diagram of an execution apparatus for a test case provided according to an exemplary embodiment.

[0029] Figure 5 This is a block diagram of a terminal provided according to an exemplary embodiment. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0031] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0032] like Figure 1 The diagram shown is a flowchart illustrating a test case execution method 100 provided in an exemplary embodiment of this application. This method can be applied to a terminal, and specifically can be executed by hardware and / or software installed in the terminal. The method includes at least the following steps.

[0033] S110, Design target test cases and save them.

[0034] In one implementation, refer to Figure 2The user interaction interface can be written by the Tkinter module of Python for the tester to design and execute the test case. When designing the target test case, one target test case can include test case identification, test case name, preconditions, execution steps, test execution result comparison with preset execution result, etc. It can be understood that the "test case identification" is used for uniquely identifying the test case, which can be a number, a letter, etc. The "preconditions", "execution steps", and "test execution result comparison with preset test execution result" can include multiple data, each data containing the fields of "step description", "script type", "script data", "test execution result", "preset execution result", etc. Optionally, the fields can be extended as needed.

[0035] The "script type" field can be database operation (DBOper_Oracle, DBOper_Timesten), application host operation (linuxOper_BILL), sending interface request (socketReq_BILL, dccReq_CBE, wasReq_HSC), etc. In the embodiment, the field value of "script type" is associated with the "target host identification" in the target analysis file, so as to distinguish different script execution units (i.e. target execution units).

[0036] The "script data" field is used to input the script corresponding to the script type. For example, if it is a database operation, an sql statement is input, if it is an application host operation, a linux instruction is input, if it is a sending interface request, a request packet is input, etc.

[0037] The "test execution result" field is used to input a variable name as a key of a dictionary in the program, and the value corresponding to the key is used to save the test execution result. The dictionary value is used to compare with the field value of "preset test execution result" in the subsequent test case. Optionally, the "test execution result" field can be used to input multiple variables separated by commas.

[0038] The "preset execution result" field is used to input a constant value, which is used to compare with the dictionary value of the aforementioned "test execution result" to judge whether the execution result of the test case is passed.

[0039] For example, the "prepaid user monthly settlement rent collection success" test case is designed as shown in Table 1.

[0040] In addition, after the design of the test case is completed, the designed test case can be converted into an XML format for saving by using the xml module of Python, and the XML file name is the "test case identifier" in the test case. When saving, it can be checked whether the XML file name already exists. If the repeated file name already exists, the user is prompted to modify the "test case identifier", so as to ensure that the XML test case file is unique, thereby accurately distinguishing different test cases.

[0041] For example, referring to Table 1, the XML test case file format can be as follows.

[0042] File name: testCase_1.xml

[0043] File content:

[0044] <test case identifier> testCase_1 < / test case identifier>

[0045] <test case name> 58 yuan 4G Fly package user monthly settlement rent success < / test case name>

[0046] <initial condition>

[0047] Table 1

[0048]

[0049] <step description id = prepaid user subscribes 58 yuan 4G Fly package>

[0050] <!-- "script type" tag is used to distinguish different script execution units -->

[0051] <Script type> DBOper_Oracle < / script type>

[0052] <Script data> insert into cm_subs_product values(***)where subsid = ";" < / script data>

[0053] <test execution result>< / test execution result>

[0054] <expected result>< / expected result>

[0055] < / step description>

[0056] <step description id = user balance is not less than 58 yuan>

[0057] <Script type> DBOper_Timesten < / script type>

[0058] <ScriptData>update abm_acct_balance set amt='6000' where acctid="";< / ScriptData>

[0059] <testExecResult>< / testExecResult>

[0060] <expectedResult>< / expectedResult>

[0061] < / stepDesc>

[0062] <stepDesc id="userMonthEnd is today">

[0063] <ScriptType>DBOper_Timesten< / ScriptType>

[0064] <ScriptData>update abm_bill_day set next_billday=trunc(sysdate) where acctid="";< / ScriptData>

[0065] <testExecResult>< / testExecResult>

[0066] <expectedResult>< / expectedResult>

[0067] < / stepDesc>

[0068] < / preCond

[0069] <execStep>

[0070] <stepDesc id="pull up rent collection program">

[0071] <ScriptType>linuxOper_BILL< / ScriptType>

[0072] <ScriptData>rentProc'subsid'>rent.log 2>&1< / ScriptData>

[0073] <testExecResult>< / testExecResult>

[0074] <expectedResult>< / expectedResult>

[0075] < / stepDesc>

[0076] < / execStep>

[0077] <testExecResult vs expectedResult>

[0078] <stepDesc id="query month end status and month end date">

[0079] <script type="DBOper_Timesten">

[0080] <script data="select status,next_billday from abm_bill_day where acctid="";< / script data>

[0081] <!-- "Test Execution Result" variables are used to hold the test execution result, which will be compared with "Expected Result" in the Compare step. There can be multiple variables, separated by commas -->

[0082] <Test Execution Result>billStatus_Actual,billDay_Actual< / Test Execution Result>

[0083] <Expected Result>< / Expected Result>

[0084] < / Step Description>

[0085] <Step Description id="Query User Balance">

[0086] <script type="DBOper_Timesten">

[0087] <script data="select amt from abm_acct_balance where acctid="";< / script data>

[0088] <Test Execution Result>amt_Actual< / Test Execution Result>

[0089] <Expected Result>< / Expected Result>

[0090] < / Step Description>

[0091] <Step Description id="Compare Bill Status with Expected Result">

[0092] <script type="Compare">

[0093] <script data="">< / script data>

[0094] <Test Execution Result>billStatus_Actual< / Test Execution Result>

[0095] <Expected Result>1 (Monthly Bill Success)< / Expected Result>

[0096] < / Step Description>

[0097] <step description id="bill day and expected result comparison">

[0098] <script type="Compare">

[0099] <script data="">

[0100] <test execution result>billDay_Actual< / test execution result>

[0101] <expected result>next month's today< / expected result>

[0102] < / step description>

[0103] <step description id="user balance and expected result comparison">

[0104] <script type="Compare">

[0105] <script data="">

[0106] <test execution result>amt_Actual< / test execution result>

[0107] <expected result>2 yuan< / expected result>

[0108] < / step description>

[0109] < / test execution result and expected result comparison>

[0110] S120, configure target analysis file.

[0111] The target analysis file can include at least one of open database connectivity (ODBC) data source connection information, application program host connection information, and interface service host connection information. It can be understood that ODBC is a database access interface standard that provides a unified interface for heterogeneous database access and can be used to access various types of databases.

[0112] In an implementation manner, the ODBC data source connection information, the application program host connection information, and the interface service host connection information can each include a target host identifier, and the target host identifier corresponds to a script type in the target test case.

[0113] For example, the ODBC data source connection information includes a target host identifier, a connection mode, a driver, a database instance, a username, and a password, wherein the target host identifier corresponds to the "script type" in the test case, and the connection mode can be fixed as odbc.

[0114] The application program host connection information includes target host identification, connection mode, address, username, and password, wherein the host identification corresponds to "script type" in the test case, and the connection mode can be fixed as ssh.

[0115] The interface service host connection information includes target host identification, connection mode, service address IP, and port, wherein the host identification corresponds to "script type" in the test case, and the port can be empty.

[0116] For example, the target analysis file can be as follows.

[0117] DBOper_Oracle|odbc|Oracle in OraClinet11g_home1|10.252.45.220:1521 / ORADB|user1|password1

[0118] DBOper_Timesten|odbc|TimesTen Data Manager|10.252.45.65:53389 / TTDB|user2|password2

[0119] linuxOper_BILL|ssh|10.252.45.65|user3|password3

[0120] socketReq_BILL|socket|10.252.45.65|6941

[0121] dccReq_CBE|dcc|10.252.45.181|2734

[0122] wasReq_HSC|was|http: / / 10.252.45.198 / nginterface4net / services / GDProdServ?wsdl|

[0123] Among them, the 1st and 2nd lines are ODBC data source connection information, the 3rd line is application program host connection information, and the 4th, 5th and 6th lines are interface service host connection information.

[0124] S130, reading a target test case and a target analysis file corresponding to the target test case.

[0125] In an implementation, corresponding to S110, the target test case can be saved in XML form. In this case, the terminal can save the field values corresponding to the preset script type, script data, test execution result, and preset test result in each execution step to a global variable, and construct a global dictionary using the field value corresponding to the test execution result as a key, the global dictionary being used to save the test execution result of the target test case.

[0126] It can be understood that the specific implementation of the target test case and the target analysis file can refer to the detailed description of the foregoing S110 and S120, and will not be described here again.

[0127] S140, according to the script type of the target test case and the host identifier in the target analysis file, the target analysis file is parsed to obtain a target execution unit and target connection information.

[0128] In an implementation, the implementation process of S120 can include: detecting the target host identifier in the target analysis file; in the case where the target host identifier matches the script type in the execution step, reading the target execution unit (such as a database, an application program host, an interface service host, etc.) corresponding to the target host identifier and the target connection information (such as a connection method, an address, a test case name, a username, a password, etc.) corresponding to the target execution unit from the target analysis file. For details, please refer to Figure 3 .

[0129] It should be noted that the target connection information is used to connect the target execution unit for testing the target test case text in subsequent execution of the target test case.

[0130] S150, based on the target connection information and the target execution unit, the target test case is executed through the connected target execution unit.

[0131] S160, receiving the test execution result of the target test case sent by the target execution unit.

[0132] In an implementation, after the target execution unit and the target connection information are parsed, the corresponding execution module can be called according to the connection method in the target connection information to connect the target execution unit and execute the script, and then the test execution result returned by the target execution unit is received and saved to the dictionary value corresponding to the "test execution result". Figure 3 The target execution unit includes at least one of the Oracle database, the timesten database, the application program host, and the interface service host shown in the figure.

[0133] S170, in the case where the test execution result is consistent with the preset test result, determining that the test passes.

[0134] In one implementation, the test execution result can be directly read from the dictionary value and compared with the preset execution result to determine whether the test passes.

[0135] In another implementation, to further ensure the accuracy of the test execution result, before comparing the test execution result with the preset test execution result, it can be determined whether the script type obtained by parsing is a predetermined value (such as Compare), and if so, S150 is executed; otherwise, it is determined that the test case execution fails.

[0136] It should be noted that for a plurality of test execution results corresponding to the target test case, in the case where a predetermined proportion of the test execution results are consistent with the preset test result, it is determined that the test passes; wherein each execution step in the target test case corresponds to one test execution result.

[0137] During the execution of the target test case, each execution step can be executed in sequence according to the execution steps included in the target test case, and each execution step corresponds to one test execution result. If one or a certain proportion of the test execution results are inconsistent with the preset test execution result, it is determined that the test fails. Alternatively, if all test steps of the target test case are executed and all test steps pass, it is determined that the test case passes.

[0138] In one implementation, after completing the test of the target test case, the test execution result can be displayed through a user interaction interface, such as test execution result, test pass, and test fail.

[0139] In the execution method of the test case given in the embodiment, the target test case and the target analysis file corresponding to the target test case are read; the target analysis file is parsed to obtain a target execution unit and target connection information according to the script type of the target test case and the host identifier in the target analysis file; the target execution unit is connected based on the target connection information, and the target test case is tested through the connected target execution unit; the test execution result of the target test case sent by the target execution unit is received; and in the case where the test execution result is consistent with the preset test execution result, it is determined that the test passes, thereby realizing automatic testing of the test case file, ensuring the accuracy of the test execution result, and improving the test efficiency.

[0140] In addition, the embodiment has the following technical effects:

[0141] (1) The supported test object range covers the Oracle database, Timesten / fastore memory database, application program host, interface service host and the like involved in the charging system, and fully supports the automatic test of the charging service.

[0142] (2) The modular design is adopted, and only a small amount of modification is needed for the charging service test case or target analysis file, so that the test can be used for other service scene test, and the reusability is high.

[0143] (3) The Python is adopted to realize the automatic test framework, and the XML format is adopted to store the test case, so that the expansibility and migration are strong.

[0144] As Figure 4 shown, an execution device 400 of a test case provided by an example embodiment of the present application includes a data reading module 410 configured to read a target test case and a target analysis file corresponding to the target test case; an analysis module 420 configured to analyze the target analysis file to obtain a target execution unit and target connection information according to a script type of the target test case and a host identifier in the target analysis file; a test module 430 configured to connect the target execution unit based on the target connection information, and perform a test on the target test case through the connected target execution unit; a receiving module 440 configured to receive a test execution result of the target test case sent by the target execution unit; and a result determination module 450 configured to determine that the test passes in a case where the test execution result is consistent with a preset test execution result.

[0145] Regarding the execution device 400 of the test case in the embodiment, the specific manner in which each module performs an operation has been described in detail in the embodiment related to the method, and will not be described in detail here.

[0146] Please refer to Figure 5 , a block diagram of a terminal 500 provided according to an example embodiment, which can at least include a processor 510 and a memory 520 configured to store processor-executable instructions. The processor 510 is configured to execute the instructions to implement all or part of the steps of the test case execution method in the above-described embodiments.

[0147] The processor 510 and the memory 520 are directly or indirectly electrically connected to each other to realize the transmission or interaction of data. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines.

[0148] The processor 510 is configured to read / write data or programs stored in the memory and perform corresponding functions.

[0149] The memory 520 is configured to store programs or data, such as storing instructions executable by the processor 510. The memory 520 can be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electric Erasable Programmable Read-Only Memory (EEPROM) and the like.

[0150] Further, as a possible implementation, the terminal 500 can further include a power component, a multimedia component, an audio component, an input / output (I / O) interface, a sensor component and a communication component and the like.

[0151] The power component provides power to the various components of the terminal 500. The power component can include a power management system, one or more power sources, and other components associated with generating, managing and distributing power for the terminal 500.

[0152] The multimedia component includes a screen providing an output interface between the terminal 500 and the user. In some embodiments, the screen can include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes the touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or a sliding action, but also detect duration and pressure related to the touching or sliding action. In some embodiments, the multimedia component includes a front camera and / or a rear camera. The front camera and / or the rear camera can receive external multimedia data when the terminal 500 is in an operation mode, such as a shooting mode or a video mode. Each of the front and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0153] The audio component is configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) that receives an external audio signal when the terminal 500 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 520 or transmitted via the communication component. In some embodiments, the audio component further includes a speaker for outputting audio signals.

[0154] The I / O interface provides an interface between the processing component and peripheral interface modules, which can be a keypad, a click wheel, buttons, and the like. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0155] The sensor component includes one or more sensors for providing status assessments of various aspects of the terminal 500. For example, the sensor component can detect an open / closed position of the terminal 500, relative positioning of components, such as a display and a keypad of the terminal 500, a change in position of the terminal 500 or a component of the terminal 500, presence or absence of user contact with the terminal 500, orientation or acceleration / deceleration / g-force and temperature changes of the terminal 500. The sensor component can include a proximity sensor configured to detect presence of nearby objects without any physical touch. The sensor component can further include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0156] The communication component is configured to facilitate wired or wireless communication between the terminal 500 and other devices. The terminal 500 can access a wireless network based on a communication standard, such as WiFi, a cellular network standard (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an example embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an example embodiment, the communication component further includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) techniques, infrared data association (IrDA) techniques, ultra-wideband (UWB) techniques, Bluetooth (BT) techniques, and other techniques.

[0157] In example embodiments, the terminal 500 can be implemented with one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic elements to perform the above-described methods.

[0158] It should be understood that Figure 5 The illustrated structure of the terminal 500 is merely a schematic diagram of the structure of the terminal 500, and the terminal 500 can further include more or less components than those shown in Figure 5 or have a different configuration from that shown in Figure 5 The components shown in the above-described embodiments can be implemented in hardware, software, or a combination thereof. Figure 5

[0159] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as a memory including instructions, is also provided, which can be executed by a processor in a terminal to perform the above-described test case execution method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0160] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0161] It should be noted that the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusions, such that processes, methods, articles, or apparatuses that comprise a list of elements not only include those elements, but also include other elements not expressly listed, or inherent to such processes, methods, articles, or apparatuses. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0162] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0163] ​The above merely provides an example of the present application, and is not intended to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall fall into the scope of claims of the present application.

Claims

1. A method of execution of test cases, characterized in that, The method comprises the following steps: reading a target test case and a target analysis file corresponding to the target test case; analyzing the target analysis file according to a script type of the target test case and a host identifier in the target analysis file to obtain a target execution unit and target connection information; connecting the target execution unit based on the target connection information and executing the target test case through the connected target execution unit; receiving a test execution result of the target test case sent by the target execution unit; determining that the test passes in a case where the test execution result is consistent with a preset test execution result; reading a target test case, which comprises the following steps: reading each execution step of the target test case from a test case file in sequence through a Python xml module; saving field values corresponding to a preset script type, script data, test execution result and preset test result in each execution step to a global variable, and constructing a global dictionary with the field value corresponding to the test execution result as a key, the global dictionary being used to save the test execution result of the target test case; determining that the test passes in a case where the test execution result is consistent with a preset test execution result, which comprises the following steps: determining that the test passes in a case where a predetermined proportion of test execution results corresponding to the target test case are consistent with the preset test result, wherein the test execution results correspond to each execution step in the target test case one by one.

2. The method of claim 1, wherein, analyzing the target analysis file to obtain the target execution unit and target connection information according to the script type of the target test case and the host identifier in the target analysis file, which comprises the following steps: detecting a target host identifier in the target analysis file; reading a target execution unit corresponding to the target host identifier and target connection information corresponding to the target execution unit from the target analysis file in a case where the target host identifier matches the script type in the execution step.

3. The method of claim 1, wherein, Before reading the target test case and the target analysis file corresponding to the target test case, the method further comprises the following steps: configuring a target analysis file, the target analysis file comprising at least one of ODBC data source connection information, application program host connection information and interface service host connection information; wherein the ODBC data source connection information, the application program host connection information and the interface service host connection information each comprise a target host identifier, the target host identifier corresponding to a script type in the target test case.

4. The test case execution method of claim 3, wherein: the ODBC data source connection information further comprises at least one of a connection mode, a driver program, a database instance, a username and a password; the application program host connection information further comprises at least one of a connection mode, an address, a username and a password; the interface service host connection information further comprises at least one of a connection mode, a service address IP and a port.

5. The method of claim 1-4, wherein, The target execution unit includes at least one of an Oracle database, a timesten database, an application program host, and an interface service host.

6. An execution apparatus of a test case, characterized by, The method comprises the steps of: reading a target test case and a target analysis file corresponding to the target test case; analyzing the target analysis file according to a script type of the target test case and a host identifier in the target analysis file to obtain a target execution unit and target connection information; connecting the target execution unit based on the target connection information and performing test on the target test case through the connected target execution unit; receiving a test execution result of the target test case sent by the target execution unit; determining that the test is passed when the test execution result is consistent with a preset test execution result. In the reading of the target test case, the method comprises the steps of: reading each execution step of the target test case from the test case file in sequence through a Python xml module; saving field values corresponding to a preset script type, script data, test execution result and preset test result in each execution step to a global variable, and constructing a global dictionary with the field value corresponding to the test execution result as a key, the global dictionary being used to save the test execution result of the target test case; in the result determination, the method comprises the steps of: determining that the test is passed when a predetermined proportion of test execution results corresponding to the target test case are consistent with the preset test result, the test execution results corresponding to each execution step in the target test case.

7. A terminal, characterized by comprising: The device comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, and the program or instruction is executed by the processor to implement the steps of the test case according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, When the instruction in the storage medium is executed by the processor in the terminal, the terminal can execute the steps of the test case execution method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Test method and apparatus

    CN108459953A

  • Test method, device and equipment and storage medium

    CN109726107A

  • Universal testing system and method for telecommunication intelligent service

    CN1780236A