Automated testing method, system, electronic equipment and medium

By establishing the mapping relationship between test cases and the service version under test and the target test cases, the problems of low test case reuse rate and high maintenance cost in the existing automated testing methods are solved, and efficient test case reuse and fast verification are achieved.

CN114780430BActive Publication Date: 2025-02-07广域铭岛数字科技有限公司 +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210492713.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-07
Publication Date
2025-02-07
Estimated Expiration
2042-05-07

AI Technical Summary

Technical Problem

Existing automated testing methods lead to low reuse of test cases and high maintenance costs, especially when facing multiple service versions and versions under test, back-up tests.

Method used

By obtaining the service version under test, creating a corresponding test plan, establishing a mapping relationship between the test cases and the service version under test, determining the target test case of the target service version, and finally testing the target service version according to the target test case. , get the target test results.

Benefits of technology

It improves the reuse rate of test cases, reduces the maintenance cost of test cases, can flexibly deal with function backlash of service version under test, and achieves rapid verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114780430B_ABST
    Figure CN114780430B_ABST
Patent Text Reader

Abstract

The present invention is applicable to the field of testing technology, and provides an automated testing method, system, electronic device and medium, the method comprising: obtaining at least one tested service version, and creating a corresponding test plan according to each tested service version, the test plan including test cases; establishing a mapping relationship between the test cases and the corresponding tested service versions; obtaining a target tested service version, and determining a target test case of the target tested service version according to the mapping relationship between the test case and the corresponding tested service version, the tested service version including the target tested service version; testing the target tested service version according to the target test case to obtain a target test result; by adopting this method, the problems of low test case reuse rate and high maintenance cost caused by unreasonable automated testing methods in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing technology, and in particular to an automated testing method, system, electronic equipment and medium. Background Art

[0002] With the continuous development of software development iterations, software functions are becoming more and more abundant, and software architecture is becoming more and more complex. In order to ensure software quality as comprehensively as possible, automated testing technology has been widely used in all aspects of software testing. From functional testing to integration testing, automated testing can help project teams improve quality and efficiency, shorten testing time, and expand test coverage. In automated testing, the automated testing platform creates test plans, creates and provides management functions such as test cases, and uses test cases to test the services under test. However, with the continuous upgrade of the services under test, there will be more and more service versions under test, which will lead to a large number of tasks brought about by version compatibility and version rollback testing. At present, most of the use of add, delete and modify test cases to achieve version compatibility and version rollback testing, but this method will reduce the reuse rate of test cases and increase the maintenance cost of test cases. Summary of the invention

[0003] The present invention provides an automated testing method, system, electronic device and medium to solve the problems of low test case reuse rate and high maintenance cost caused by unreasonable automated testing methods in the prior art.

[0004] The automated testing method provided by the present invention comprises:

[0005] Obtain at least one tested service version, and create a corresponding test plan according to each of the tested service versions, wherein the test plan includes test cases;

[0006] Establish a mapping relationship between test cases and corresponding tested service versions;

[0007] Acquire a target tested service version, and determine a target test case of the target tested service version according to a mapping relationship between the test case and the corresponding tested service version, wherein the tested service version includes the target tested service version;

[0008] The target tested service version is tested according to the target test case to obtain a target test result.

[0009] Optionally, establishing a mapping relationship between a test case and a corresponding service version under test includes:

[0010] Testing the corresponding tested service version according to each of the test plans;

[0011] After the test plan is executed successfully, a snapshot of the test data in the step where the test plan is executed successfully is stored, and a mapping relationship between the test data in the step where the test plan is executed successfully and the corresponding service version under test is established, wherein the test data includes test cases, input data and output data.

[0012] Optionally, after establishing a mapping relationship between a test case and a corresponding service version under test, the step further includes:

[0013] Obtain a service version to be upgraded and created a corresponding test plan to be upgraded according to the service version to be upgraded, wherein the test plan to be upgraded includes test cases to be upgraded;

[0014] Receiving an upgrade request for the tested service version to be upgraded, and performing an upgrade process on the tested service version to be upgraded;

[0015] After the upgrade is successful, the mapping relationship between the test case and the corresponding service version under test is updated according to the service version to be upgraded and the test case to be upgraded. The updated mapping relationship between the test case and the corresponding service version under test includes the mapping relationship between the test case and the corresponding service version under test before the update.

[0016] Optionally, after the upgrade process is performed on the tested service version to be upgraded, the process further includes:

[0017] After the upgrade fails, when the tested service version to be upgraded is rolled back, the rolled back tested service version is obtained;

[0018] Determine the test case after rollback according to the tested service version after rollback and the mapping relationship between the test case and the corresponding tested service version;

[0019] The rolled-back test version is tested according to the rolled-back test case to obtain a rollback test result.

[0020] Optionally, creating a corresponding test plan according to the tested service version includes:

[0021] Obtaining a description data set of the tested service version, and extracting target semantic features of the description data set;

[0022] Perform defect prediction on the tested service version according to the target semantic feature to obtain target predicted defects;

[0023] The test cases in the test plan are generated according to a preset knowledge graph and the target predicted defects, wherein the preset knowledge graph includes a mapping relationship between defects and use cases.

[0024] Optionally, extracting target semantic features of the description data set includes:

[0025] Performing vectorization processing on the description data set to obtain a vector file;

[0026] The local semantic features and the global semantic features of the vector file are extracted, and the local semantic features and the global semantic features are fused to obtain target semantic features.

[0027] Optionally, performing defect prediction on the tested service according to the target semantic feature to obtain the target predicted defect includes:

[0028] Acquire a sample description data set and corresponding sample defect data, and extract sample semantic features of the sample description data set;

[0029] Obtaining the similarity between the target semantic feature and the sample semantic feature to obtain a target similarity;

[0030] Defect prediction is performed on the tested service version according to the target similarity and the sample defect data to obtain target predicted defects.

[0031] The present invention also provides an automated testing system, comprising:

[0032] A plan creation module, used to obtain at least one tested service version, and create a corresponding test plan according to each of the tested service versions, wherein the test plan includes test cases;

[0033] A relationship building module is used to establish a mapping relationship between test cases and corresponding tested service versions;

[0034] A target use case module is used to obtain a target tested service version, and determine a target test case of the target tested service version according to a mapping relationship between the test case and the corresponding tested service version, wherein the tested service version includes the target tested service version;

[0035] The target test module is used to test the target tested service version according to the target test case to obtain the target test result. The plan creation module, the relationship establishment module, the target case module and the target test module are connected.

[0036] The present invention also provides an electronic device, comprising: a processor and a memory;

[0037] The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the automated testing method.

[0038] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the automated testing method described above is implemented.

[0039] As described above, the present invention provides an automated testing method, system, electronic device and medium, which have the following beneficial effects: first, the service version under test is obtained, and a corresponding test plan is created according to each service version under test, and then a mapping relationship between the test case and the service version under test is established, and then the target test case of the target service version under test is determined according to the mapping relationship between the test case and the service version under test, and finally the target service version under test is tested according to the target test case to obtain the target test result; the problem of low test case reuse rate and high maintenance cost caused by unreasonable automated testing methods in the prior art is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 is a schematic flow chart of an automated testing method in an embodiment of the present invention;

[0042] Figure 2 is a flow chart of a method for creating a test plan in an embodiment of the present invention;

[0043] Figure 3 is a schematic diagram of the structure of an automated testing system in an embodiment of the present invention;

[0044] Figure 4 Schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0045] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0046] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0047] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.

[0048] Figure 1 It is a flowchart of an automated testing method provided in one embodiment of the present invention.

[0049] like Figure 1 As shown, the automated testing method includes steps S110-S140:

[0050] S110, obtaining at least one tested service version, and creating a corresponding test plan according to each tested service version, the test plan including test cases;

[0051] S120, establishing a mapping relationship between the test case and the corresponding tested service version;

[0052] S130, obtaining a target tested service version, and determining a target test case of the target tested service version according to a mapping relationship between a test case and a corresponding tested service version, wherein the tested service version includes the target tested service version;

[0053] S140, testing the target tested service version according to the target test case to obtain a target test result.

[0054] In one embodiment, the automated testing method is applied to an automated testing platform, which creates test plans, generates and provides management functions such as test cases, and tests the service under test according to the test plans and test cases; at the same time, the automated testing platform provides test case execution functions, combined with continuous integration tools such as Jenkins or gitlab for continuous operation; the automated testing platform will also continuously maintain test cases and test data according to the version iteration of the service under test.

[0055] In one embodiment, the service information under test includes but is not limited to the software framework of the service under test, the application scenario of the service under test, the functions that need to be tested in the service version under test, the functions that need to be implemented by the service under test, the version data of the service under test, and the program under test; the service under test includes software. A test plan can be created and test cases can be obtained based on the service information under test based on the automated testing platform, wherein the test plan includes but is not limited to test objectives, test outlines, test scope, key issues, quality objectives, resource requirements, personnel organization, test strategy, release submission, test progress and task personnel arrangement, test start / completion / delay / continue standards, risk analysis, test cases, and test case execution process.

[0056] In one embodiment, the test objectives include a brief description of the objectives that the tested service needs to achieve through testing. The test summary includes a summary of the software to be tested, an explanation of terms, and references to relevant documents. The test scope includes the scope and priority of the test software to be tested contained in the test plan, the parts that need to be tested, the parts that do not need to be tested, the parts that cannot be tested, or the parts that are postponed. The key issues include listing all the main functions and test priorities of the software to be tested, and the key issues should be able to correspond to and check each other with the test case design. The quality objectives include formulating product quality objectives and software testing objectives for the test software. Resource requirements include the hardware and software, test tools, necessary technical resources, training, documents, etc. required for testing. Personnel organization includes the personnel required for testing and their respective roles and responsibilities. The test strategy includes formulating the overall test strategy, the test technologies and methods used. Release submission includes the software products, test cases, test data and related documents that need to be delivered after the test release is carried out according to the test plan. The test progress and task personnel arrangement include the task allocation of testers and the order of task execution. Risk analysis includes the need to consider possible risks and solutions in the test plan.

[0057] In one embodiment, the method for creating a test plan in step S110 is shown in Figure 2 , Figure 2 It is a flowchart of a method for creating a test plan in one embodiment of the present invention.

[0058] like Figure 2 As shown, the method for creating a test plan may include the following steps S210-S230:

[0059] S210, obtaining a description data set of the tested service version, and extracting target semantic features of the description data set;

[0060] S220, predicting defects on the tested service version according to the target semantic features, and obtaining target predicted defects;

[0061] S230 generates test cases in the test plan according to a preset knowledge graph and target predicted defects, wherein the preset knowledge graph includes a mapping relationship between defects and test cases.

[0062] By predicting defects for the service version under test and generating test cases based on the target predicted defects, there is no need to adopt the traditional case coverage-based design standard to obtain test cases, thereby achieving the goal of reducing testing costs, shortening testing cycles and improving testing efficiency.

[0063] In one embodiment, the implementation method of step S210 for extracting the target semantic features of the description data set includes: splitting the description data set using a preset splitting rule to obtain a split file; vectorizing the split file to obtain a vector file; extracting the local semantic features and global semantic features of the vector file, and fusing the local semantic features with the global semantic features to obtain the target semantic features. Specifically, after obtaining the description data set, an abstract syntax tree is processed on it; then the description data set is split using a preset splitting rule, and the preset splitting rule includes a string splitting algorithm, such as a string splitting algorithm based on the camel case rule; after obtaining the split file, it is subjected to morphological restoration and stop word removal; and the split file after the morphological restoration and stop word removal is vectorized. Specifically, an existing word vector model (for example, word2vec) can be used to vectorize it to obtain a vector file.

[0064] In one embodiment, a method for extracting local semantic features: inputting a vector file into a convolutional neural network and outputting a local feature matrix; a method for extracting global semantic features includes: inputting a vector file into a bidirectional gated recurrent unit network, obtaining the output of a forward gated recurrent unit and the output of a reverse gated recurrent unit, and then splicing the output of the forward gated recurrent unit and the output of the reverse gated recurrent unit to obtain a global semantic feature. Then, the local semantic features and the global semantic features are fused through an attention mechanism to obtain a target semantic feature. Specifically, local weights and global weights are set according to the attention mechanism; local features are obtained by multiplying local weights and local semantic features; global features are obtained by multiplying global weights and global semantic features, and target semantic features are obtained according to local features and global features. Among them, the sum of local weights and global weights is 1. By extracting the global semantic features of the vector file, contextual analysis of the description data set is realized, and the global features are contextual semantic features, and the test cases generated on this basis are more reasonable.

[0065] In one embodiment, step S220 predicts defects for the tested service version according to the target semantic features, and the implementation method for obtaining the target predicted defects includes obtaining a sample description data set and corresponding sample defect data, and extracting sample semantic features of the sample description data set; obtaining the similarity between the target semantic features and the sample semantic features to obtain the target similarity; predicting defects for the tested service version according to the target similarity and the sample defect data to obtain the target predicted defects. Among them, the sample description data set is a sample description data set of several versions of several services, and the types and numbers of services and versions can be determined according to actual conditions. The implementation method for extracting sample semantic features from the sample description data set can refer to the method for extracting target semantic features, which will not be repeated here. The similarity between the target semantic feature and the sample semantic feature can be obtained by the distance between the target semantic feature and the sample semantic feature, such as the Euclidean distance; it can also be obtained by the cosine similarity between the target semantic feature and the sample semantic feature.

[0066] In order to improve the efficiency of obtaining target similarity, the sample description data set can be classified first. Specifically, a clustering algorithm is used to classify the sample description data set to obtain several description data categories. The implementation method of using a clustering algorithm to classify the sample description data set to obtain several description data categories includes obtaining sample defect data of the sample description data set, classifying the sample defect data using a clustering algorithm, and obtaining classification results, and the classification results include several description data categories; the clustering algorithm includes but is not limited to K-means, and the clustering parameters can be determined according to the number of sample description data obtained. For example, when the clustering algorithm is the K-means clustering algorithm, the larger the data volume of the sample description data set, the larger the value of the clustering parameter K. After obtaining several description data categories, the target description data category of the tested service version can be determined according to the tested service version and the classification results; then only the similarity between the target semantic features and the sample semantic features under the target description data category is obtained, so as to achieve the purpose of improving the efficiency of obtaining similarity.

[0067] In one embodiment, before generating test cases according to the preset knowledge graph and target predicted defects in step S230, it is also necessary to construct a preset knowledge graph, that is, a mapping relationship between defects and use cases; specifically, the test cases used by the sample defect data can be obtained, and a mapping relationship between defects and use cases can be established based on the correspondence between the sample defect data and the test cases. Generating test cases according to the preset knowledge graph and target predicted defects is to generate test cases based on the mapping relationship between defects and use cases and the predicted defect data. By predicting program defects and generating test cases based on the predicted defects, the purpose of reducing testing costs, shortening testing cycles and improving testing efficiency is achieved.

[0068] In one embodiment, the implementation method of step S120 for establishing a mapping relationship between test cases and corresponding service versions under test includes testing the corresponding service version under test according to each test plan; after the test plan is executed, a snapshot of the test data in the step where the test plan is executed is stored, and a mapping relationship between the test data in the step where the test plan is executed and the corresponding service version under test is established, wherein the test data includes test cases, input data, and output data.

[0069] In one embodiment, after establishing the mapping relationship between the test data in the test plan execution pass step and the corresponding service version under test, it also includes: obtaining the target service version under test, and determining the target test data of the target service version under test according to the mapping relationship between the test data and the corresponding service version under test, the target test data includes a target test case, target input data and target output data; testing the target service version under test according to the snapshot of the target test case to obtain the target test result; using the target output data to verify the target test result, if the target test result is consistent with the target output data, the test passes; if the target test result is inconsistent with the target output data, the test fails. Among them, the target test result is the output data of the test process of the target version under test. For basic services, when there are multiple versions providing services to the outside, there is no need to rely on the current test case. By storing the snapshot of the test data in the test pass step, there is no need to prepare the test cases and test data sets of each version of the service, and the historical snapshot can be directly replayed to achieve decoupling from the use case; this process greatly improves the reuse rate of test cases and reduces the maintenance cost of test cases.

[0070] In one embodiment, after the step of establishing the mapping relationship between the test case and the corresponding service version under test, the step also includes: obtaining the service version under test to be upgraded, and creating a corresponding test plan to be upgraded according to the service version under test to be upgraded, the test plan to be upgraded includes the test case to be upgraded; receiving an upgrade request for the service version under test to be upgraded, and performing an upgrade process on the service version under test to be upgraded; after the upgrade is successful, updating the mapping relationship between the test case and the corresponding service version under test according to the service version under test to be upgraded and the test case to be upgraded, the updated mapping relationship between the test case and the corresponding service version under test includes the mapping relationship between the test case and the corresponding service version under test before the update. According to the tested service version to be upgraded and the test case to be upgraded, the mapping relationship between the test case and the corresponding tested service version is updated, including adding the mapping relationship between the tested service version to be upgraded and the test case to be upgraded after the successful upgrade on the basis of the mapping relationship between the tested service version to be upgraded and the corresponding tested service version, so as to obtain the mapping relationship between the updated test case and the corresponding tested service version; in the upgrade process, not only the mapping relationship between the tested service version to be upgraded and the corresponding tested service version (the mapping relationship between the tested service version to be upgraded and the corresponding tested service version) is retained, but also the mapping relationship between the tested service version to be upgraded and the test case to be upgraded after the successful upgrade is added on this basis, so as to obtain the mapping relationship between the updated test case and the corresponding tested service version. The mapping relationship between the updated test case and the corresponding tested service version includes the mapping relationship between multiple tested service versions and the corresponding test case, so that when the tested service needs to be backward compatible with multiple historical versions, the snapshot corresponding to the tested service historical version of the system can be used through the automation platform for rapid verification, without having to maintain the tested service historical version of the test case, which improves the reuse rate of the automation case and reduces the maintenance cost of the test case.

[0071] In one embodiment, after the step of upgrading the version of the service under test to be upgraded, it also includes: after the upgrade fails, when the version of the service under test to be upgraded rolls back, obtaining the rolled back version of the service under test; determining the rolled back test case according to the mapping relationship between the rolled back version of the service under test and the test case and the corresponding version of the service under test; testing the rolled back test version according to the rolled back test case to obtain the rollback test result; thereby realizing the rapid testing of the target service under test, so that the test plan and the corresponding test case can flexibly respond to the functional rollback of the service under test version, and can use the output data in the test data to quickly verify the rolled back service under test.

[0072] In one embodiment, before the version of the tested service is released, the system will run the test plan completely. The version is eligible for release only when all test cases under the test plan are executed and passed. The platform will take a snapshot of the last executed test case and associated data and correspond it to the version of the tested service. The automated testing platform ensures that each version upgrade of the tested service has a snapshot of the test case and associated data corresponding to the version. Even if the test case and associated data on the platform change during the version upgrade process, it will not affect the backtracking of the historical version, thereby decoupling the test case from the tested service version to achieve flexible application.

[0073] This embodiment provides an automated testing method, which first obtains the service version under test, creates a corresponding test plan according to each service version under test, then establishes a mapping relationship between test cases and service versions under test, and then determines the target test case of the target service version under test according to the mapping relationship between the test case and the service version under test, and finally tests the target service version under test according to the target test case to obtain the target test result; when a certain version of the service under test needs to be tested, it only needs to obtain the service version under test, and then the corresponding test case can be obtained according to the mapping relationship between the service version under test and the test case, and then the service under test is tested according to the test case to obtain the target test result. The test results are obtained and verified according to the test data, which solves the problems of low test case reuse rate and high maintenance cost caused by unreasonable automated testing methods in the prior art; the test plan and the corresponding test cases can flexibly respond to the function rollback of the tested service version, and the tested service can be quickly verified after the rollback; after the version is changed downward, the use case maintenance cost is basically zero, thereby reducing the maintenance cost; for basic services, when there are multiple versions providing automated testing services to the outside world, there is no need to rely on the current test cases, and historical snapshots can be directly replayed to achieve the purpose of decoupling from the test cases, thereby improving the efficiency of automated testing.

[0074] Based on the same inventive concept as the automated testing method, this embodiment also provides an automated testing system. In this embodiment, the automated testing system executes the automated testing method described in any of the above embodiments, and the specific functions and technical effects can be referred to the above embodiments, which will not be repeated here.

[0075] Figure 3 This is a schematic diagram of the structure of the automated testing system provided by the present invention.

[0076] like Figure 3 As shown, the automated testing system includes: 31 a plan building module, 32 a relationship building module, 33 a target use case module and 34 a target testing module.

[0077] The plan creation module is used to obtain at least one tested service version and create a corresponding test plan according to each tested service version, wherein the test plan includes test cases;

[0078] A relationship building module is used to establish a mapping relationship between test cases and corresponding tested service versions;

[0079] A target use case module is used to obtain a target tested service version and determine a target test case of the target tested service version according to a mapping relationship between a test case and a corresponding tested service version, wherein the tested service version includes the target tested service version;

[0080] The target test module is used to test the target tested service version according to the target test case and obtain the target test result. The plan creation module, the relationship establishment module, the target use case module and the target test module are connected.

[0081] In some exemplary embodiments, the relationship building module includes:

[0082] The test unit is used to test the corresponding service version under test according to each test plan;

[0083] The relationship establishment unit is used to store a snapshot of the test data in the steps where the test plan is executed successfully, and to establish a mapping relationship between the test data in the steps where the test plan is executed successfully and the corresponding service version under test. The test data includes test cases, input data, and output data.

[0084] In some exemplary embodiments, the above-mentioned automated testing system further includes:

[0085] The upgrade plan establishment module is used to obtain the service version to be upgraded and tested, and create a corresponding upgrade test plan according to the service version to be upgraded and tested, and the upgrade test plan includes the upgrade test cases;

[0086] An upgrade module is used to receive an upgrade request for the tested service version to be upgraded, and perform upgrade processing on the tested service version to be upgraded;

[0087] The relationship update module is used to update the mapping relationship between the test cases and the corresponding service versions under test according to the service versions under test to be upgraded and the test cases to be upgraded after the upgrade is successful. The updated mapping relationship between the test cases and the corresponding service versions under test includes the mapping relationship between the test cases and the corresponding service versions under test before the update.

[0088] In some exemplary embodiments, the automated testing system comprises:

[0089] The version acquisition module is used to obtain the rolled-back version of the service under test after an upgrade fails and the version of the service under test to be upgraded is rolled back;

[0090] A rollback case module is used to determine the test case after rollback according to the tested service version after rollback and the mapping relationship between the test case and the corresponding tested service version;

[0091] The rollback test module is used to test the rolled-back test version according to the rolled-back test cases to obtain the rollback test results.

[0092] In some exemplary embodiments, the plan creation module includes:

[0093] A feature extraction unit is used to obtain a description data set of the tested service version and extract target semantic features of the description data set;

[0094] A prediction unit, used to predict defects of the tested service version according to target semantic features and obtain target predicted defects;

[0095] The use case generation unit is used to generate test cases in the test plan according to a preset knowledge graph and target prediction defects. The preset knowledge graph includes a mapping relationship between defects and use cases.

[0096] In some exemplary embodiments, the use case generating unit includes:

[0097] A vectorization subunit is used to vectorize the description data set to obtain a vector file;

[0098] The feature fusion subunit is used to extract the local semantic features and the global semantic features of the vector file, and fuse the local semantic features with the global semantic features to obtain the target semantic features.

[0099] In some exemplary embodiments, the prediction unit includes:

[0100] A feature extraction subunit, used to obtain a sample description data set and corresponding sample defect data, and extract sample semantic features of the sample description data set;

[0101] A similarity unit is used to obtain the similarity between the target semantic feature and the sample semantic feature to obtain the target similarity;

[0102] The prediction subunit is used to predict defects for the tested service version based on the target similarity and sample defect data, and obtain target predicted defects.

[0103] This embodiment further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any one of the methods in this embodiment is implemented.

[0104] In one embodiment, see Figure 4This embodiment also provides an electronic device 400, including a memory 401, a processor 402, and a computer program stored in the memory and executable on the processor, wherein the processor 402 implements the steps of the method described in any of the above embodiments when executing the computer program.

[0105] The computer-readable storage medium in this embodiment can be understood by ordinary technicians in this field: all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

[0106] The electronic device provided in this embodiment includes a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store computer programs, the communication interface is used to communicate, and the processor and the transceiver are used to run the computer program so that the electronic device executes each step of the above method.

[0107] In this embodiment, the memory may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0108] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0109] In the above embodiments, the description refers to "this embodiment", "an embodiment", "another embodiment", "in some exemplary embodiments" or "other embodiments" to indicate that the specific features, structures or characteristics described in conjunction with the embodiments are included in at least some embodiments, but not necessarily all embodiments. Multiple occurrences of "this embodiment", "an embodiment", "another embodiment" do not necessarily all refer to the same embodiment.

[0110] In the above-described embodiments, although the invention has been described in conjunction with specific embodiments of the invention, many substitutions, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art based on the foregoing description. For example, other storage structures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed. Embodiments of the invention are intended to encompass all such substitutions, modifications, and variations that fall within the broad scope of the appended claims.

[0111] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0112] The present invention can be used in many general or special computing system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like.

[0113] The present invention may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0114] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. An automated testing method, characterized in that: include: Obtain at least one tested service version, and create a corresponding test plan according to each of the tested service versions, wherein the test plan includes test cases; Establish a mapping relationship between test cases and corresponding tested service versions; Acquire a target tested service version, and determine a target test case of the target tested service version according to a mapping relationship between the test case and the corresponding tested service version, wherein the tested service version includes the target tested service version; Testing the target tested service version according to the target test case to obtain a target test result; The creating of the corresponding test plan according to the tested service version includes: obtaining a description data set of the tested service version, extracting target semantic features of the description data set; performing defect prediction on the tested service version according to the target semantic features, and obtaining target predicted defects; generating test cases in the test plan according to a preset knowledge graph and the target predicted defects, wherein the preset knowledge graph includes a mapping relationship between defects and use cases; The defect prediction of the tested service version according to the target semantic features and obtaining the target predicted defects include: obtaining a sample description data set and corresponding sample defect data, and extracting sample semantic features of the sample description data set; obtaining the similarity between the target semantic features and the sample semantic features to obtain a target similarity; and defect prediction of the tested service version according to the target similarity and the sample defect data to obtain a target predicted defect.

2. The automated testing method according to claim 1, characterized in that: The establishment of a mapping relationship between a test case and a corresponding service version under test includes: Testing the corresponding tested service version according to each of the test plans; After the test plan is executed successfully, a snapshot of the test data in the step where the test plan is executed successfully is stored, and a mapping relationship between the test data in the step where the test plan is executed successfully and the corresponding service version under test is established, wherein the test data includes test cases, input data and output data.

3. The automated testing method according to claim 1, characterized in that: After establishing the mapping relationship between the test case and the corresponding service version under test, the following steps are also included: Obtain a service version to be upgraded and created a corresponding test plan to be upgraded according to the service version to be upgraded, wherein the test plan to be upgraded includes test cases to be upgraded; Receiving an upgrade request for the tested service version to be upgraded, and performing an upgrade process on the tested service version to be upgraded; After the upgrade is successful, the mapping relationship between the test case and the corresponding service version under test is updated according to the service version to be upgraded and the test case to be upgraded. The updated mapping relationship between the test case and the corresponding service version under test includes the mapping relationship between the test case and the corresponding service version under test before the update.

4. The automated testing method according to claim 3, characterized in that: After the upgrade process of the tested service version to be upgraded is performed, the following step is further included: After the upgrade fails, when the tested service version to be upgraded is rolled back, the rolled back tested service version is obtained; Determine the test case after rollback according to the tested service version after rollback and the mapping relationship between the test case and the corresponding tested service version; The rolled-back service version is tested according to the rolled-back test case to obtain a rollback test result.

5. The automated testing method according to claim 1, characterized in that: The extracting target semantic features of the description data set comprises: Performing vectorization processing on the description data set to obtain a vector file; The local semantic features and the global semantic features of the vector file are extracted, and the local semantic features and the global semantic features are fused to obtain target semantic features.

6. An automated testing system, characterized in that: include: A plan creation module, used to obtain at least one tested service version, and create a corresponding test plan according to each of the tested service versions, wherein the test plan includes test cases; A relationship building module is used to establish a mapping relationship between test cases and corresponding tested service versions; A target use case module is used to obtain a target tested service version, and determine a target test case of the target tested service version according to a mapping relationship between the test case and the corresponding tested service version, wherein the tested service version includes the target tested service version; A target test module, used to test the target tested service version according to the target test case to obtain a target test result, wherein the plan creation module, the relationship establishment module, the target case module and the target test module are connected; The plan creation module includes: a feature extraction unit, which is used to obtain a description data set of the tested service version and extract target semantic features of the description data set; a prediction unit, which is used to predict defects of the tested service version according to the target semantic features and obtain target predicted defects; a use case generation unit, which is used to generate test cases in the test plan according to a preset knowledge graph and the target predicted defects, wherein the preset knowledge graph includes a mapping relationship between defects and use cases; The prediction unit includes: a feature extraction subunit, used to obtain a sample description data set and corresponding sample defect data, and extract sample semantic features of the sample description data set; a similarity unit, used to obtain the similarity between the target semantic feature and the sample semantic feature to obtain a target similarity; a prediction subunit, used to perform defect prediction on the tested service version according to the target similarity and the sample defect data to obtain a target predicted defect.

7. An electronic device, characterized in that: including a processor, a memory and a communication bus; The communication bus is used to connect the processor and the memory; The processor is configured to execute the computer program stored in the memory to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is used to make the computer execute the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Application program testing method and device, electronic equipment and storage medium

    CN109614311A

  • Accurate test method based on historical test case mining

    CN111597121A