CN117555786A - Method and device for testing target function and computer readable storage medium - Google Patents

Method and device for testing target function and computer readable storage medium Download PDF

Info

Publication number
CN117555786A
CN117555786A CN202311523150.6A CN202311523150A CN117555786A CN 117555786 A CN117555786 A CN 117555786A CN 202311523150 A CN202311523150 A CN 202311523150A CN 117555786 A CN117555786 A CN 117555786A
Authority
CN
China
Prior art keywords
test
corpus
matching
target function
target
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.)
Pending
Application number
CN202311523150.6A
Other languages
Chinese (zh)
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.)
Thalys Automobile Co ltd
Original Assignee
Thalys Automobile 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 Thalys Automobile Co ltd filed Critical Thalys Automobile Co ltd
Priority to CN202311523150.6A priority Critical patent/CN117555786A/en
Publication of CN117555786A publication Critical patent/CN117555786A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Abstract

The application relates to the technical field of testing, and discloses a method and a device for testing a target function and a computer readable storage medium, wherein the method comprises the following steps: acquiring a corpus to be tested corresponding to a target function, and determining a test corpus from the corpora to be tested according to the test requirement of the target function; generating a test case corresponding to the test corpus and a test expected value corresponding to the test case according to the target function and the test corpus; performing test operation based on the test cases to obtain test return values corresponding to the test cases; and performing matching operation on the test return value and the test expected value, and determining a test result of the target function according to the matching result. According to the method, the test corpus is determined from the corpus to be tested according to the test requirement of the target function, and even if the target function is changed, the test corpus required by the test can be automatically adapted without manually re-matching parameters or modifying codes, so that the maintenance difficulty of a tester is reduced, and the automation degree of the whole test process is improved.

Description

Method and device for testing target function and computer readable storage medium
Technical Field
The present invention relates to the field of testing technologies, and in particular, to a method and an apparatus for testing a target function, and a computer readable storage medium.
Background
At present, different test cases need to be configured for testing different functions. If the test function is changed, the test case needs to be reconfigured, the place needing to be changed is more, a large number of codes are involved in the change, and the automatic test requirements of different functions cannot be met.
Disclosure of Invention
In view of the above problems, the present application provides a method, an apparatus, and a computer readable storage medium for testing a target function, where corresponding test cases are generated for different functions, so as to meet the requirements of automatic testing of different functions.
According to an aspect of the embodiments of the present application, there is provided a method for testing a target function, the method including: acquiring a corpus to be tested corresponding to a target function, and determining a test corpus from the corpus to be tested according to the test requirement of the target function; generating a test case corresponding to the test corpus and a test expected value corresponding to the test case according to the target function and the test corpus; performing test operation based on the test case to obtain a test return value corresponding to the test case; and carrying out matching operation on the test return value and the test expected value, and determining a test result of the target function according to the matching result.
In an optional manner, the determining, according to the test requirement of the target function, a test corpus from the corpora to be tested, further includes: detecting whether the test requirement is a multi-purpose test requirement; if not, taking the static corpus in the corpus to be tested as the test corpus; if yes, taking the dynamic corpus in the corpus to be tested as the test corpus; the dynamic corpus is obtained according to a plurality of static word combinations.
In an alternative manner, the matching operation is performed between the test return value and the test expected value, and the method further includes: traversing all parameters in the test return value, and taking the traversed parameters as target parameters; and carrying out matching operation on the target parameter and the parameter in the test expected value to obtain a matching result of the target parameter so as to obtain a matching result of the test return value and the test expected value.
In an alternative manner, the number of test cases is a plurality; the matching operation of the test return value with the test expected value further includes: traversing a plurality of test cases, and taking the traversed test cases as target test cases; and matching the target test return value corresponding to the target test case with the target test expected value to obtain a matching result corresponding to the target test case so as to obtain matching results corresponding to a plurality of test cases.
In an alternative manner, the number of test cases is a plurality; the method for determining the test result of the target function according to the matching result further comprises the following steps: if the matching result represents that the matching of the test return value corresponding to any test case and the test expected value fails, determining that the test result of the target function represents that the test fails; and if the matching result represents that the test return value corresponding to each test case is successfully matched with the test expected value, determining that the test result of the target function represents that the test is successful.
In an alternative manner, the test method further comprises: and if the test result represents the test failure, outputting a test case with failed matching and a matching failure field corresponding to the test case with failed matching.
In an optional manner, the performing a test operation based on the test case to obtain a test return value corresponding to the test case further includes: acquiring a test function corresponding to the test corpus; and generating a test return value corresponding to the test case according to the test case and the test function.
According to another aspect of the embodiments of the present application, there is provided a test apparatus for a target function, the test apparatus including: the acquisition module is used for acquiring the corpus to be tested corresponding to the target function and determining the test corpus from the corpus to be tested according to the test requirement of the target function; the generation module is used for generating a test case corresponding to the test corpus and a test expected value corresponding to the test case according to the target function and the test corpus; the test module is used for carrying out test operation based on the test case to obtain a test return value corresponding to the test case; and the matching module is used for carrying out matching operation on the test return value and the test expected value, and determining the test result of the target function according to the matching result.
According to an aspect of an embodiment of the present application, there is provided an electronic device including: a controller; and a memory for storing one or more programs which, when executed by the controller, perform the test method described above.
According to an aspect of the embodiments of the present application, there is also provided a computer-readable storage medium having stored thereon computer-readable instructions, which when executed by a processor of a computer, cause the computer to perform the above-described test method.
According to an aspect of embodiments of the present application, there is also provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the test method described above.
According to the embodiment of the application, the corpus to be tested corresponding to the target function is obtained, and the test corpus is determined from the corpus to be tested according to the test requirement of the target function, so that the corpus required by the test can be automatically adapted without manually re-matching or modifying codes even if the target function changes, and the maintenance difficulty of a tester is reduced. In addition, according to the target function and the test corpus, the test case and the test expected value corresponding to the test case can be rapidly generated, and the test expected value and the test return value are matched, so that the whole automatic test process can rapidly output the test result of the target function according to the matching result of the test expected value and the test return value, and the automation degree of the function test is improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present application, and may be implemented according to the content of the specification, so that the technical means of the embodiments of the present application can be more clearly understood, and the following detailed description of the present application will be presented in order to make the foregoing and other objects, features and advantages of the embodiments of the present application more understandable.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application. It is apparent that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
Fig. 1 is a flow chart illustrating a method for testing a target function according to an exemplary embodiment of the present application.
Fig. 2 is a flow chart of another method of testing a target function, shown based on the exemplary embodiment shown in fig. 1.
Fig. 3 is a schematic structural view of a test device for a target function according to an exemplary embodiment of the present application.
Fig. 4 is a schematic diagram of a computer system of an electronic device according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
Reference to "a plurality" in this application means two or more than two. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., a and/or B may represent: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
In the existing function test process, if the test function changes, the test case needs to be reconfigured, the places needing to be changed are more, a large number of codes are changed, and the automatic test requirements of different functions cannot be met.
For this purpose, an aspect of the present application provides a method for testing a target function. Referring specifically to fig. 1, fig. 1 is a flow chart illustrating a method for testing a target function according to an exemplary embodiment of the present application. The test method at least comprises S110 to S140, and is described in detail as follows:
s110: obtaining the corpus to be tested corresponding to the target function, and determining the test corpus from the corpus to be tested according to the test requirement of the target function.
Each function corresponds to a corresponding corpus to be tested, and different functions correspond to different corpora to be tested, wherein the corpora to be tested comprise different types of corpora to be tested. According to different test requirements, the corpus meeting the test requirements in the corpora to be tested can be used as the test corpus.
Illustratively, the target function is to open XX windows, and the corresponding corpora to be tested include position corpora, time corpora, action corpora and the like. If the test requirement is only that the window at the appointed position is opened by the test, the position corpus in the corpus to be tested is used as the test corpus.
S120: and generating a test case corresponding to the test corpus and a test expected value corresponding to the test case according to the target function and the test corpus.
And combining the words and sentences corresponding to the target function with the test corpus to obtain a plurality of test cases, and generating corresponding expected codes according to the test cases, namely test expected values in the embodiment.
Illustratively, the target function is to open the XX window, its test corpus is a location corpus, including: the generated test cases are a front left window, a rear left window, a front right window and a rear right window, and the test expected values corresponding to the test cases are generated.
S130: and performing test operation based on the test case to obtain a test return value corresponding to the test case.
And inputting the test case into the called preset test method to return a test return value corresponding to the test case. Wherein the number of test returns is the same as the number of test cases.
S140: and performing matching operation on the test return value and the test expected value, and determining a test result of the target function according to the matching result.
Whether the matching is successful or not is positively correlated with the test result, for example, the test return value is successfully matched with the test expected value, and the test result of the target function is the test success; and if the test return value fails to match with the test expected value, the test result of the target function is the test failure.
According to the embodiment, the corpus to be tested corresponding to the target function is obtained, and the test corpus is determined from the corpus to be tested according to the test requirement of the target function, so that the corpus to be tested can be automatically adapted without manually re-matching or modifying codes even if the target function changes, and the maintenance difficulty of a tester is reduced. In addition, according to the target function and the test corpus, the test case and the test expected value corresponding to the test case can be rapidly generated, and the test expected value and the test return value are matched, so that the whole automatic test process can rapidly output the test result of the target function according to the matching result of the test expected value and the test return value, and the automation degree of the function test is improved.
In another exemplary embodiment of the present application, how to determine the test corpus from the corpora to be tested according to the test requirement of the target function is described in detail, that is, S110 further includes S1101 to S1103, which is described in detail as follows:
s1101: whether the test requirement is a multi-purpose test requirement is detected.
Illustratively, the target function is to open an XX window, the test requirement of which is a multi-purpose test requirement, including a test requirement to open a window in a certain position, e.g., a test requirement to open a front left window. Also included are test requirements for opening the window to a desired state, for example, a 50% height window.
Correspondingly, a single-intention basic method and a multi-intention basic method are configured on a code layer, and different basic methods are called according to a detection result so as to obtain a test corpus. In the basic calling process, parameters of the configuration file are read to realize different test requirements, for example, a file for defining an output result, whether to test by adopting basic corpus, whether to test by adopting generalized corpus, whether to test by adopting slot corpus (wherein the slot corpus belongs to dynamic corpus, and the test corpus generated in real time in the test process), whether to uniformly output all the test results to the same file/separately output the test results to different files, and the size of data volume of test output can be set.
S1102: if not, taking the static corpus in the corpus to be tested as the test corpus.
The static corpus is preset and can be directly used as the corpus of the test corpus.
For example, if the target function is to open the XX window and the test intention is only to open the test requirement of a certain position window, that is, the test requirement is not a multi-intention test requirement, the position corpus (the position corpus belongs to the static corpus) is directly used as the test corpus.
S1103: if yes, taking the dynamic corpus in the corpus to be tested as the test corpus; the dynamic corpus is obtained according to the combination of a plurality of static words.
The dynamic corpus can be the corpus obtained by combining a plurality of static words in real time in the test process.
If the test requirement is detected to be a multi-purpose test requirement, static words are selected in real time according to the disagreement graph, and the selected static words are combined to obtain a test corpus.
According to the embodiment, different corpus is selected as the test corpus according to different test requirements of the target function, and the test corpus suitable for the test requirements is better provided so as to ensure the accuracy of the test corpus.
In another exemplary embodiment of the present application, how to perform the matching operation between the test return value and the test expected value is described in detail, that is, S140 further includes S1401 to S1402, which are described in detail as follows:
s1401: traversing all parameters in the test return value, and taking the traversed parameters as target parameters.
According to the embodiment, the matching operation of all the parameters in the test return value is ensured to be carried out without omission in a mode of traversing the parameters in the test return value, so that the matching result is more accurate.
S1402: and performing matching operation on the target parameter and the parameter in the test expected value to obtain a matching result of the target parameter so as to obtain a matching result of the test return value and the test expected value.
Illustratively, the code data corresponding to the test return value is as follows:
and carrying out matching operation on each row of codes and the codes of the corresponding row in the test expected values, and determining the matching result of the test return value and the test expected value according to the matching result of each row of codes. The code data corresponding to the test expected value is as follows:
the embodiment provides a way to perform matching operation on the test return value and the test expected value, and by performing matching operation on each parameter in the test return value and the corresponding parameter in the test return value, all parameters in the test return value are subjected to matching operation without omission, so that the matching result of the test return value and the test expected value is more accurate.
In another exemplary embodiment of the present application, how to perform the matching operation between the test return value and the test expected value is described in detail, and referring specifically to fig. 2, fig. 2 is a schematic flow chart of another method for testing the target function according to the exemplary embodiment shown in fig. 1. Wherein the number of the test cases is a plurality of; the test method further includes S210 to S220 in S140 shown in fig. 1, and is described in detail as follows:
s210: traversing a plurality of test cases, and taking the traversed test cases as target test cases.
According to the embodiment, through the mode of traversing the test cases, corresponding matching operation is carried out on each test case without omission.
S220: and matching the target test return value corresponding to the target test case with the target test expected value to obtain a matching result corresponding to the target test case so as to obtain matching results corresponding to a plurality of test cases.
The method includes traversing to a second test case, performing matching operation on a corresponding test return value and a test expected value to obtain a matching result corresponding to the second test case, and analogically obtaining the matching results corresponding to all the test cases.
The embodiment ensures that corresponding matching operation is performed on each test case in a missing way by traversing each test case, thereby accurately obtaining a matching result corresponding to each test case.
In another exemplary embodiment of the present application, how to determine the test result of the target function according to the matching result is described in detail, that is, S140 further includes S1403 to S1404; the number of test cases is plural, and the details are as follows:
s1403: if the matching result represents that the matching of the test return value corresponding to any test case and the test expected value fails, determining that the test result of the target function represents the test failure.
Illustratively, the matching results corresponding to the first test case and the second test case are all characterized as successful in matching, but the matching result corresponding to the third test case is characterized as failed in matching, so that the test result of the target function is characterized as failed.
S1404: if the matching result represents that the test return value corresponding to each test case is successfully matched with the test expected value, determining that the test result of the target function represents that the test is successful.
For example, the method includes matching results of three test cases altogether, and if the matching results of the three test cases are all characterized as successful, determining that the test result of the target function is characterized as successful.
The embodiment further illustrates the relation between the matching results of each test case and the test results of the target function, and if all the matching results represent successful matching, the test results of the target function are determined to represent successful testing.
In another exemplary embodiment of the present application, based on any one of the above-mentioned test methods, the test method of the present embodiment further includes S150, which is described in detail below:
s150: if the test result represents the test failure, outputting a test case with failed matching and a matching failure field corresponding to the test case with failed matching.
Illustratively, test cases: the code data of the test return value corresponding to the main driving window opening is as follows:
and carrying out matching operation on each row of codes and the codes of the corresponding row in the test expected values, and determining the matching result of the test return value and the test expected value according to the matching result of each row of codes. The code data corresponding to the test expected value is as follows:
therefore, the matching failure of the function results in the failure of the matching between the test return value and the test expected value corresponding to the test case, and the following information is output:
in some embodiments, an excel file recording a test result corresponding to each test case is also output, through the excel file, a tester can quickly know that a test result corresponding to the test case of "opening a main driving window" is failed, a field which is failed in the test is function (i.e., a matching failure field in the embodiment), a specific record function field test is expected to be open, and an actual return value is close.
After all the test cases of the target function are tested, the test results are output to the excel file together, and the test results corresponding to each test case can be output to the excel file in sequence.
In another exemplary embodiment of the present application, S130 in any one of the above test methods further includes S1301 to S1302, which are described in detail below:
s1301: and obtaining a test function corresponding to the test corpus.
S1302: and generating a test return value corresponding to the test case according to the test case and the test function.
Illustratively, the target function is to open the window at the specified position, i.e. open the XX window, and write a function code of window_position_open to correspond to opening the window at the specified position; meanwhile, writing a corresponding testCase, and calling a certain upper layer method functional nA, in the functional nA, acquiring corpus of all window positions by calling a window position method, such as functional windows position, and replacing XX to form a corpus list, such as: [ open main drive window, open auxiliary drive window … ].
After the corpus list is obtained, a functionBase basic calling method (namely a test function in the embodiment) is called, corresponding test cases are generated according to the corpus list, and the test cases are input into the functionBase basic calling method to obtain a test return value corresponding to each test case.
And finding out a test expected value corresponding to each test case according to the function window_position_open, and comparing the test expected value with an interface return value (namely a test return value in the embodiment) obtained in the functional base basic calling method.
According to the embodiment, the same test function is called to calculate the test return values corresponding to all the test cases, and the test function configuration is not required to be carried out for each test case or different test functions are called, so that the difficulty of case maintenance of testers is reduced.
In another aspect, the present application further provides a device for testing a target function, as shown in fig. 3, and fig. 3 is a schematic structural diagram of the device for testing a target function according to an exemplary embodiment of the present application. The test apparatus 300 includes:
the obtaining module 310 is configured to obtain a corpus to be tested corresponding to the target function, and determine a test corpus from the corpora to be tested according to a test requirement of the target function.
The generating module 330 is configured to generate a test case corresponding to the test corpus and a test expected value corresponding to the test case according to the target function and the test corpus.
And the test module 350 is configured to perform a test operation based on the test case, and obtain a test return value corresponding to the test case.
And the matching module 370 is used for performing matching operation on the test return value and the test expected value, and determining the test result of the target function according to the matching result.
In an alternative manner, the acquisition module 310 further includes:
the detection unit is used for detecting whether the test requirement is a multi-purpose test requirement or not.
And the single-intention test requirement unit is used for taking the static corpus in the corpus to be tested as the test corpus if the single-intention test requirement unit is not used for testing the static corpus.
The multi-intention test demand unit is used for taking the dynamic corpus in the corpus to be tested as the test corpus if the test demand unit is the test demand unit; the dynamic corpus is obtained according to the combination of a plurality of static words.
In an alternative manner, the matching module 370 further comprises:
the first traversing unit is used for traversing all parameters in the test return value and taking the traversed parameters as target parameters.
The first matching unit is used for performing matching operation on the target parameter and the parameter in the test expected value to obtain a matching result of the target parameter so as to obtain a matching result of the test return value and the test expected value.
In an alternative, the number of test cases is a plurality; the matching module 370 further includes:
the second traversing unit is used for traversing the plurality of test cases and taking the traversed test cases as target test cases.
And the second matching unit is used for performing matching operation on the target test return value corresponding to the target test case and the target test expected value to obtain a matching result corresponding to the target test case so as to obtain matching results corresponding to a plurality of test cases.
In an alternative, the number of test cases is a plurality; the matching module 370 further includes:
and the matching failure unit is used for determining that the test result of the target function represents the test failure if the matching result represents that the test return value corresponding to any test case fails to match the test expected value.
And the matching success unit is used for determining that the test result representation test of the target function is successful if the matching result represents that the test return value corresponding to each test case is successfully matched with the test expected value.
In an alternative, the test apparatus 300 further comprises:
and the test failure module is used for outputting a test case with failed matching and a matching failure field corresponding to the test case with failed matching if the test result represents the test failure.
In an alternative approach, the test module 350 further includes:
and the test function acquisition unit is used for acquiring a test function corresponding to the test corpus.
And the test return value generating unit is used for generating a test return value corresponding to the test case according to the test case and the test function.
According to the test device, the corpus to be tested corresponding to the target function is obtained, and the test corpus is determined from the corpus to be tested according to the test requirement of the target function, so that the corpus to be tested can be automatically adapted without manually re-matching or modifying codes even if the target function changes, and the maintenance difficulty of a tester is reduced. In addition, according to the target function and the test corpus, the test case and the test expected value corresponding to the test case can be rapidly generated, and the test expected value and the test return value are matched, so that the whole automatic test process can rapidly output the test result of the target function according to the matching result of the test expected value and the test return value, and the automation degree of the function test is improved.
It should be noted that, the test device provided in the foregoing embodiment and the test method provided in the foregoing embodiment belong to the same concept, and the specific manner in which each module and unit perform the operation has been described in detail in the method embodiment, which is not repeated here.
Another aspect of the present application also provides an electronic device, including: a controller; and a memory for storing one or more programs which, when executed by the controller, perform the test method described above.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a computer system of an electronic device according to an exemplary embodiment of the present application, which illustrates a schematic structural diagram of a computer system suitable for implementing the electronic device according to the embodiments of the present application.
It should be noted that, the computer system 400 of the electronic device shown in fig. 4 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 4, the computer system 400 includes a central processing unit (Central Processing Unit, CPU) 401 that can perform various appropriate actions and processes, such as performing the methods in the above-described embodiments, according to a program stored in a Read-Only Memory (ROM) 402 or a program loaded from a storage section 408 into a random access Memory (Random Access Memory, RAM) 403. In the RAM 403, various programs and data required for the system operation are also stored. The CPU 401, ROM 402, and RAM 403 are connected to each other by a bus 404. An Input/Output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output portion 407 including a Cathode Ray Tube (CRT), a liquid crystal display (Liquid Crystal Display, LCD), and the like, a speaker, and the like; a storage section 408 including a hard disk or the like; and a communication section 409 including a network interface card such as a LAN (Local Area Network ) card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. The drive 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed on the drive 410 as needed, so that a computer program read therefrom is installed into the storage section 408 as needed.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 409 and/or installed from the removable medium 411. When executed by a Central Processing Unit (CPU) 401, performs the various functions defined in the system of the present application.
It should be noted that, the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium may be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (ErasableProgrammable Read Only Memory, EPROM), flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with a computer-readable computer program embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Where each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by means of software, or may be implemented by means of hardware, and the described units may also be provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
Another aspect of the present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of testing as before. The computer-readable storage medium may be included in the electronic device described in the above embodiment or may exist alone without being incorporated in the electronic device.
Another aspect of the present application also provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the test methods provided in the respective embodiments described above.
According to an aspect of the embodiments of the present application, there is also provided a computer system including a central processing unit (Central Processing Unit, CPU) which can perform various appropriate actions and processes, such as performing the method in the above embodiments, according to a program stored in a Read-Only Memory (ROM) or a program loaded from a storage section into a random access Memory (Random Access Memory, RAM). In the RAM, various programs and data required for the system operation are also stored. The CPU, ROM and RAM are connected to each other by a bus. An Input/Output (I/O) interface is also connected to the bus.
The following components are connected to the I/O interface: an input section including a keyboard, a mouse, etc.; an output section including a Cathode Ray Tube (CRT), a liquid crystal display (Liquid Crystal Display, LCD), and the like, and a speaker, and the like; a storage section including a hard disk or the like; and a communication section including a network interface card such as a LAN (Local Area Network ) card, a modem, or the like. The communication section performs communication processing via a network such as the internet. The drives are also connected to the I/O interfaces as needed. Removable media such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, and the like are mounted on the drive as needed so that a computer program read therefrom is mounted into the storage section as needed.
The foregoing is merely a preferred exemplary embodiment of the present application and is not intended to limit the embodiments of the present application, and those skilled in the art may make various changes and modifications according to the main concept and spirit of the present application, so that the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for testing a target function, the method comprising:
acquiring a corpus to be tested corresponding to a target function, and determining a test corpus from the corpus to be tested according to the test requirement of the target function;
generating a test case corresponding to the test corpus and a test expected value corresponding to the test case according to the target function and the test corpus;
performing test operation based on the test case to obtain a test return value corresponding to the test case;
and carrying out matching operation on the test return value and the test expected value, and determining a test result of the target function according to the matching result.
2. The test method according to claim 1, wherein the determining the test corpus from the test corpora to be tested according to the test requirement of the target function further includes:
detecting whether the test requirement is a multi-purpose test requirement;
if not, taking the static corpus in the corpus to be tested as the test corpus;
if yes, taking the dynamic corpus in the corpus to be tested as the test corpus; the dynamic corpus is obtained according to a plurality of static word combinations.
3. The test method of claim 1, wherein matching the test return value to the test expected value further comprises:
traversing all parameters in the test return value, and taking the traversed parameters as target parameters;
and carrying out matching operation on the target parameter and the parameter in the test expected value to obtain a matching result of the target parameter so as to obtain a matching result of the test return value and the test expected value.
4. The test method of claim 1, wherein the number of test cases is a plurality; the matching operation of the test return value with the test expected value further includes:
traversing a plurality of test cases, and taking the traversed test cases as target test cases;
and matching the target test return value corresponding to the target test case with the target test expected value to obtain a matching result corresponding to the target test case so as to obtain matching results corresponding to a plurality of test cases.
5. The test method of claim 1, wherein the number of test cases is a plurality; the method for determining the test result of the target function according to the matching result further comprises the following steps:
if the matching result represents that the matching of the test return value corresponding to any test case and the test expected value fails, determining that the test result of the target function represents that the test fails;
and if the matching result represents that the test return value corresponding to each test case is successfully matched with the test expected value, determining that the test result of the target function represents that the test is successful.
6. The test method of claim 5, further comprising:
and if the test result represents the test failure, outputting a test case with failed matching and a matching failure field corresponding to the test case with failed matching.
7. The test method according to any one of claims 1 to 6, wherein the performing a test operation based on the test case to obtain a test return value corresponding to the test case, further comprises:
acquiring a test function corresponding to the test corpus;
and generating a test return value corresponding to the test case according to the test case and the test function.
8. A test device for a target function, the test device comprising:
the acquisition module is used for acquiring the corpus to be tested corresponding to the target function and determining the test corpus from the corpus to be tested according to the test requirement of the target function;
the generation module is used for generating a test case corresponding to the test corpus and a test expected value corresponding to the test case according to the target function and the test corpus;
the test module is used for carrying out test operation based on the test case to obtain a test return value corresponding to the test case;
and the matching module is used for carrying out matching operation on the test return value and the test expected value, and determining the test result of the target function according to the matching result.
9. An electronic device, comprising:
a controller;
a memory for storing one or more programs that, when executed by the controller, cause the controller to implement the test method of any of claims 1-7.
10. A computer readable storage medium having stored thereon computer readable instructions which, when executed by a processor of a computer, cause the computer to perform the test method of any of claims 1 to 7.
CN202311523150.6A 2023-11-14 2023-11-14 Method and device for testing target function and computer readable storage medium Pending CN117555786A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311523150.6A CN117555786A (en) 2023-11-14 2023-11-14 Method and device for testing target function and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311523150.6A CN117555786A (en) 2023-11-14 2023-11-14 Method and device for testing target function and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN117555786A true CN117555786A (en) 2024-02-13

Family

ID=89819957

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311523150.6A Pending CN117555786A (en) 2023-11-14 2023-11-14 Method and device for testing target function and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN117555786A (en)

Similar Documents

Publication Publication Date Title
US8676723B2 (en) Automated test system based on three-dimensional application software framework and a method thereof
US8549478B2 (en) Graphical user interface input element identification
US20070022407A1 (en) Automated software testing and validation system
CN109522228B (en) Interface automation test data construction method, device, platform and storage medium
US20050204241A1 (en) Method and device for analyzing software error
CN109783346B (en) Keyword-driven automatic testing method and device and terminal equipment
CN112181854A (en) Method, device, equipment and storage medium for generating flow automation script
US20190138432A1 (en) Test case standardization and automatic test script generation
CN113791605B (en) Test method, device, equipment and storage medium
CN116126740B (en) Model in-loop test method and device, computer equipment and storage medium
US10372849B2 (en) Performing and communicating sheet metal simulations employing a combination of factors
CN117555786A (en) Method and device for testing target function and computer readable storage medium
Flemström et al. Exploring test overlap in system integration: An industrial case study
CN108304330A (en) Method for extracting content, device and computer equipment
CN115145808A (en) Automatic testing method for airborne embedded software
CN113986753A (en) Interface test method, device, equipment and storage medium
KR102176133B1 (en) Method and apparatus for automatically creating test cases for software
CN111190986B (en) Map data comparison method and device
CN114091391A (en) Chip verification method, device, equipment and storage medium
CN113238940A (en) Interface test result comparison method, device, equipment and storage medium
CN113627611A (en) Model training method and device, electronic equipment and storage medium
CN112561331A (en) Visual experimental analysis evaluation index construction method
CN111767222A (en) Data model verification method and device, electronic equipment and storage medium
CN114338846A (en) Message testing method and device
Tidstam et al. Development of industrial visualization tools for validation of vehicle configuration rules

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