Software testing guidelines, apparatus, media, and electronic devices

By establishing rule sets and lexical analysis, test suggestions and test cases are automatically provided, solving the problems of test omissions and high costs, and achieving efficient and comprehensive software testing.

CN114564400BActive Publication Date: 2025-10-31NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210197674.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-01
Publication Date
2025-10-31
Estimated Expiration
2042-03-01

AI Technical Summary

Technical Problem

In software testing, testers' limited experience and external factors can lead to missed tests and increased costs. Existing technologies rely on expert review, which reduces efficiency.

Method used

By pre-establishing a rule set, lexical analysis is performed to obtain symbol sequences, which are then matched with rule conditions to generate test suggestions. These suggestions are provided to testers, test cases are executed automatically, and the rule set is updated through machine learning.

Benefits of technology

Ensure comprehensive testing, reduce testing costs, improve testing efficiency, and reduce reliance on testing experts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114564400B_ABST
    Figure CN114564400B_ABST
Patent Text Reader

Abstract

This invention provides a guidance method for software testing, comprising: pre-establishing a rule set, which includes rule conditions and corresponding test suggestions; performing lexical analysis on the code file to be tested to obtain a symbol sequence carrying multiple words and their related information; matching the symbol sequence with the rule conditions, and obtaining corresponding test suggestions from the rule set based on the successfully matched rule conditions; and providing the test suggestions. Accordingly, this invention also provides a guidance device, medium, and equipment for software testing. Implementing this invention can effectively improve testing efficiency, enhance testing comprehensiveness, and reduce testing costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of software testing technology, and particularly relates to a software testing guidance method, apparatus, medium, and electronic device. Background Technology

[0002] White-box testing, also known as transparent-box testing, is widely used in the field of software testing due to its advantages such as traceability, ability to reveal hidden errors, and provision of feedback to developers.

[0003] When conducting white-box testing on software, testers need to develop test cases from a code perspective. In other words, only when testers have a thorough understanding of the code's internal structure and algorithms can they develop high-quality test cases, thereby achieving comprehensive software testing. However, in actual testing, some testers may miss test cases due to limitations in their experience and external factors (such as restricted code access), making it difficult to guarantee the comprehensiveness of the testing.

[0004] To prevent testers from overlooking certain tests, the current solution is to have more experienced testing experts review the test cases after the testers have developed them, providing guidance. While this guidance approach can effectively reduce test omissions to some extent, it also increases testing costs and reduces testing efficiency. Summary of the Invention

[0005] To overcome the aforementioned deficiencies in the prior art, the present invention provides a guidance method for software testing, the guidance method comprising:

[0006] A rule set is pre-established, which includes rule conditions and corresponding test suggestions;

[0007] Lexical analysis is performed on the code file to be tested to obtain a sequence of symbols carrying multiple words and their related information;

[0008] The symbol sequence is matched with the rule conditions, and corresponding test suggestions are obtained from the rule set based on the successfully matched rule conditions;

[0009] Provide the aforementioned testing recommendations.

[0010] According to one aspect of the invention, in this guidance method, the relevant information of the word includes the word's category and the word's position information in the code file to be tested.

[0011] According to another aspect of the present invention, after the step of obtaining the corresponding test suggestion from the rule set based on the successfully matched rule condition, the guidance method further includes: determining a difference test suggestion from the obtained test suggestions, the difference test suggestion being a test suggestion corresponding to a difference code block between the code file to be tested and its prior version; and the step of providing the test suggestion includes: providing the difference test suggestion.

[0012] According to another aspect of the invention, in this guidance method, the step of providing the test suggestion includes: obtaining the position information of the word that successfully matches the rule condition from the symbol sequence in the code file, and displaying the test suggestion at the corresponding position in the code file to be tested according to the position information.

[0013] According to another aspect of the invention, in this guidance method, the rule set further includes test cases corresponding to the test suggestion; and after the step of providing the test suggestion, the guidance method further includes: obtaining test cases corresponding to the word to be tested from the rule set according to the test suggestion, and automatically executing the test cases.

[0014] According to another aspect of the invention, the guidance method further includes receiving feedback information for the test; and updating the rule set based on the feedback information.

[0015] According to another aspect of the present invention, in this guidance method, the step of updating the rule set based on the feedback information includes: inputting the feedback information into an information recognition model for recognition, wherein the information recognition model is trained on historical feedback information of testers through machine learning; and automatically updating the rule set based on the recognition result.

[0016] According to another aspect of the invention, in this guidance method, the update includes deleting invalid rule conditions and corresponding test suggestions from the rule set, adding new rule conditions and corresponding test suggestions to the rule set, and modifying the rule conditions and corresponding test suggestions in the rule set.

[0017] The present invention also provides a software testing guidance device, the guidance device comprising:

[0018] A module is established to pre-build a rule set, which includes rule conditions and corresponding test suggestions.

[0019] The analysis module is used to perform lexical analysis on the code file to be tested to obtain a sequence of symbols carrying multiple words and their related information;

[0020] The matching module is used to match the symbol sequence with the rule conditions, and obtain corresponding test suggestions from the rule set based on the successfully matched rule conditions;

[0021] A module is provided for providing the aforementioned test recommendations.

[0022] The present invention also provides one or more computer-readable media storing computer-executable instructions that, when used by one or more computer devices, cause the one or more computer devices to perform a guided method for software testing as described above.

[0023] The present invention also provides an electronic device, the electronic device including a memory and a processor, wherein: the memory stores a computer program, and the processor executes the computer program to implement the software testing guidance method as described above.

[0024] The software testing guidance method and apparatus provided by this invention perform lexical analysis on the code of the file to be tested to obtain a symbol sequence carrying multiple words and their related information. This symbol sequence is then matched against rule conditions in a pre-established rule set. Based on the successfully matched rule conditions, corresponding test suggestions are obtained from the rule set and provided to the testers. Compared with existing technologies, implementing this invention not only ensures the comprehensiveness of testing but also effectively reduces testing costs and improves testing efficiency because it eliminates the need for testing experts to provide guidance. Attached Figure Description

[0025] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0026] Figure 1 This is a flowchart of a software testing guidance method according to a specific embodiment of the present invention;

[0027] Figure 2 This is a flowchart of a rule set update method according to a specific embodiment of the present invention;

[0028] Figure 3 This is a schematic diagram of the structure of a software testing guidance device according to a specific embodiment of the present invention;

[0029] Figure 4 This is a schematic diagram of a software testing guidance device according to another specific embodiment of the present invention.

[0030] Figure 5 This is a schematic diagram of the structure of an update module according to a specific embodiment of the present invention;

[0031] Figure 6This is a schematic diagram of an electronic device used to implement the software testing guidance method of the present invention.

[0032] The same or similar reference numerals in the accompanying drawings represent the same or similar parts. Detailed Implementation

[0033] To better understand and explain this invention, a further detailed description will be provided below with reference to the accompanying drawings. This invention is not limited to these specific embodiments. Rather, any modifications or equivalent substitutions made to this invention should be covered within the scope of the claims.

[0034] It should be noted that numerous specific details are provided in the following detailed embodiments. Those skilled in the art should understand that the present invention can be practiced without these specific details. In the various detailed embodiments given below, principles, structures, and components well known in the art are not described in detail in order to highlight the spirit of the invention.

[0035] This invention provides a guiding method for software testing. Please refer to [link / reference]. Figure 1 , Figure 1 This is a flowchart of a software testing guidance method according to a specific embodiment of the present invention. As shown in the figure, the guidance method includes:

[0036] In step S101, a rule set is pre-established, which includes rule conditions and test suggestions corresponding to the rule conditions;

[0037] In step S102, lexical analysis is performed on the code file to be tested to obtain a symbol sequence carrying multiple words and their related information;

[0038] In step S103, the symbol sequence is matched with the rule conditions, and corresponding test suggestions are obtained from the rule set based on the successfully matched rule conditions;

[0039] In step S104, the test recommendations are provided.

[0040] The following will provide a detailed explanation of the contents of steps S101 to S104.

[0041] Specifically, the software testing guidance method provided by this invention can be executed by a computer device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, touchscreen, personal computer (PC), personal digital assistant (PDA), or other terminal device, and may also include a client. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0042] In step S101, a rule set is pre-established, which includes rule conditions and corresponding test suggestions. A rule condition is a rule or condition corresponding to one or more logic rules in a code file. For example, a rule condition containing "isChannel API call" corresponds to the logic in the code file that "uses the isChannel method to determine whether the current software execution environment is a channel environment." Another example is a rule condition containing "account login function," which corresponds to the logic in the code file that "calls the account login verification interface." Correspondingly, test suggestions are test insights or opinions for code in the code file to be tested that meets the rule conditions. In other words, test suggestions can provide testers with clear test guidance, enabling them to clearly understand the specific test points in the code file to be tested. Taking the aforementioned rule condition of account login function as an example, the corresponding test suggestion could be "It is necessary to verify whether the pop-up prompts given when different clients log in are consistent due to network connection failure." Based on this test suggestion, testers select appropriate test cases for testing. In this embodiment, the rule conditions and test suggestions are provided by experienced professionals (such as test experts). The more professional and comprehensive the rules, conditions, and test suggestions are, the better the subsequent testing guidance for testers based on this rule set will be.

[0043] In step S102, the code file to be tested is received and lexical analysis is performed on the code file to obtain a symbol sequence, wherein the symbol sequence includes multiple words and their related information. Here, a word is defined as the smallest unit with independent meaning in a programming language.

[0044] The process of performing lexical analysis on the code file to be tested to obtain a symbol sequence is as follows: First, the code file to be tested is preprocessed to remove unnecessary information. This unnecessary information mainly includes code comments, newline characters, tabs, and other information irrelevant to the test. Next, lexical analysis is performed on the code file after removing unnecessary information according to word formation rules to decompose it into multiple words and obtain their related information. In this embodiment, a lexical analyzer (e.g., a Lex lexical analyzer) is used to perform lexical analysis on the code file to be tested. The lexical analysis result is presented as a symbol sequence, which includes multiple lexical units, each corresponding to a word. In this embodiment, each lexical unit includes a word and its related information. Since the value of a word is usually the word itself, the word is represented by its value in the lexical unit. The related information includes the word's category and its position in the code file to be tested. The word categories primarily include the word's part of speech, such as identifier, operator, separator, variable, constant, etc. The word's location information in the test code file mainly includes the line number of the word in the test code file and the word's index value within its line or code file. Those skilled in the art will understand that the word's location information should not be limited to the aforementioned line number and index value. Any information that can be used to locate words in the test code file is applicable to the location information in this invention. For example, for more complex test code files, the word's location information may also include the depth of the code block containing the word. For the sake of simplicity, not all possible word location information will be exemplified here.

[0045] In step S103, the symbol sequence obtained from lexical analysis is matched with the rule conditions in the rule set. In this embodiment, the symbol sequence and rule conditions are matched based on the value, category, position information, and context of the words in the symbol sequence. If a rule condition that the symbol sequence meets exists in the rule set, it indicates that the symbol sequence and rule condition have matched successfully. After the symbol sequence and rule condition have matched successfully, corresponding test suggestions are obtained from the rule set based on the matched rule conditions. These test suggestions are for the code file to be tested. It should be noted that the matching of symbol sequences and rule conditions can be achieved using existing methods such as static code analysis. For the sake of simplicity, the matching process of symbol sequences and rule conditions will not be described in detail here.

[0046] In step S104, the test cases obtained from the rule set in step S103 are provided to the testers. This invention does not limit the specific method of providing test cases; any method that allows testers to obtain test suggestions is applicable. In a preferred embodiment, the position information of words in the symbol sequence that successfully match the rule conditions in the code file to be tested is obtained, and test suggestions are displayed at the corresponding position in the code file to be tested (e.g., the line containing the word) based on this position information. It should be noted that the words in the symbol sequence that successfully match the rule conditions can be one or multiple (e.g., an expression composed of multiple words). If the sequence symbols include the position information of words in the code file to be tested, the position information can be directly obtained from the sequence symbols, and then the test suggestions can be displayed at the corresponding position in the code file to be tested. This method of displaying test suggestions at the corresponding position in the code file to provide test guidance allows testers to quickly identify the areas in the code file to be tested, and then simply formulate test cases based on the test suggestions. Those skilled in the art will understand that in other embodiments, test recommendations can also be provided to testers in other ways, such as generating a test recommendation provision report. For the sake of brevity, all the ways of providing test recommendations will not be listed here.

[0047] The software testing guidance method provided by this invention involves performing lexical analysis on the code of the file to be tested to obtain a symbol sequence carrying multiple words and their related information. This symbol sequence is then matched against rule conditions in a pre-established rule set. Based on successfully matched rule conditions, corresponding test suggestions are retrieved from the rule set and provided to the testers. Compared with existing technologies, implementing this invention not only ensures comprehensive testing but also effectively reduces testing costs and improves testing efficiency because it eliminates the need for testing experts to provide guidance.

[0048] The following is a specific embodiment illustrating the software testing guidance method provided by this invention. Specifically, the code file to be tested is as follows:

[0049]

[0050]

[0051] if utils.isChannel()then

[0052] self.LabelMatch:setText(string.format(formatStr, ""))

[0053] end

[0054] "

[0055]

[0056] For the sake of simplicity, only one code snippet is shown in the test code file, with ellipses indicating the context before and after the snippet.

[0057] First, the Lex lexical analyzer is used to perform lexical analysis on the above-mentioned code file to be tested, resulting in the following symbol sequence:

[0058] {…,40:[LexToken(IF,'if',40,326610),LexToken(ID,'utils',40,326613),LexToken(.,'.',40,32661 8),LexToken(ID,'isChannel',40,326619),LexToken((,'(',40,326628),LexToken(),')',40,326629), LexToken(THEN,'then',40,326631)],41:[LexToken(SELF,'self',41,326636)],LexToken((.,'.',41,3 26740),LexToken(ID,'LabelMatch',41,326741),LexToken(:,':',41,326751),LexToken(ID,'setText' ,41,326752),LexToken((,'(',41,326759),LexToken(ID,'string',41,326760),LexToken(.,'.',41,32 6761),LexToken(ID,'format',41,326762),LexToken((,'(',41,326767),LexToken(ID,'formatStr',41 ,326768),LexToken(,,',',41,326777),LexToken(“,')',41,326779),LexToken(”,')',41,326780),LexToken(),')',41,326781),LexToken(),')',41,326782)],42:[LexToken(ENDIF,'end',42,326884)],…}. The symbol sequence only shows the parts related to the code snippet; other parts are still represented by ellipses.

[0059] The above symbol sequence includes multiple lexical units. Taking the lexical unit LexToken(ID,'utils',40,326613) as an example, this lexical unit corresponds to the word 'utils' in the code file under test. Here, "ID" in the lexical unit is the category (specifically, the identifier) ​​of the word 'utils', "'utils'" is the value of the word 'utils' itself, "40" is the line number of the line containing the word 'utils', and "326613" is the index value of the word 'utils' in the code file under test.

[0060] Next, the above symbol sequence is matched with the rule conditions in the rule set. The matching result (only for the aforementioned code snippet) shows that the symbol sequence is successfully matched with the rule condition in the rule set that contains "isChannelAPI call".

[0061] Finally, the test suggestion corresponding to the "isChannelAPI call" rule condition is retrieved from the rule set: "For some use cases, this function cannot obtain complete channel information," and this test suggestion is displayed on line 40 of the code file to be tested. Testers then formulate test cases related to channel information acquisition for different use cases based on the above test suggestion.

[0062] In a preferred embodiment, after step S103 (i.e., after obtaining the corresponding test suggestions from the rule set according to the successfully matched rule conditions), the software testing guidance method provided by the present invention further includes: determining difference test suggestions from the obtained test suggestions, wherein the difference test suggestions are the test suggestions corresponding to the difference code blocks between the code file to be tested and its prior version. Accordingly, when providing test suggestions to testers, only test suggestions corresponding to the difference code blocks are provided. Specifically, after obtaining the corresponding test suggestions from the rule set according to the successfully matched rule conditions, it is determined whether the code file to be tested has a prior version. If the code file to be tested has a prior version and the prior version has been tested, in this case, the difference code blocks between the code file to be tested and the prior version are first determined, wherein the difference code blocks between the code file to be tested and the prior version refer to the code blocks where the code differences between the code file to be tested and the prior version are located. The difference code blocks of the code file to be tested can be determined based on the code modification lines and the code structure of the modification line context. After identifying the code blocks that differ between the code file to be tested and the previous version, the test suggestions corresponding to the differing code blocks are found from the test suggestions obtained in step S103 (hereinafter referred to as differing test suggestions), and these differing test suggestions are provided to the testers. Providing only differing test suggestions can effectively avoid duplicate test suggestions, improve the relevance of test suggestions, and help improve testing efficiency.

[0063] In a preferred embodiment, the rule set includes not only rule conditions and test suggestions, but also test cases corresponding to the test suggestions. Preferably, the test cases are developed by experienced testing experts to ensure comprehensive test case coverage. Accordingly, after providing test suggestions to the code file to be tested, the software testing guidance method provided by this invention further includes: retrieving the test cases corresponding to the test suggestions from the rule set and automatically executing the test cases. In this way, on the one hand, since the development of test cases no longer depends on the testers' own experience, test omissions can be effectively avoided and comprehensive testing can be ensured; in particular, the more comprehensive the coverage of test cases in the rule set, the better the corresponding test results. On the other hand, since testers do not need to develop test cases, testing time can be greatly shortened, thereby further improving testing efficiency. Typically, after executing the test cases, test results are generated and provided to the testers to determine whether the code logic is reasonable and meets the requirements.

[0064] In a preferred embodiment, the software testing guidance method provided by the present invention further includes: receiving feedback information for the test, and updating the rule set based on the feedback information. Please refer to... Figure 2 , Figure 2 This is a flowchart of a rule set update method according to a specific embodiment of the present invention. As shown in the figure, the steps for updating the rule set include:

[0065] First, in step S201, feedback information from the tester regarding the test is received. Specifically, when the tester finds a problem with the provided test suggestion during the test, they can annotate the test suggestion. Receiving the tester's annotation of the test suggestion provides feedback information from the tester regarding the test. In this embodiment, the tester's feedback information includes annotations on the provided test suggestion and corresponding annotation suggestions. The annotations and corresponding annotation suggestions include the following three types: (1) If the provided test suggestion is considered invalid, then the test suggestion is marked as invalid, and the annotation suggestion is to delete the test suggestion; (2) If the provided test suggestion is considered incomplete, then the test suggestion is marked as incomplete, and the annotation suggestion is to supplement the test suggestion for the incomplete test suggestion; (3) If the provided test suggestion is considered incorrect, then the test suggestion is marked as incorrect, and the annotation suggestion is to modify the test suggestion for the incorrect test suggestion.

[0066] It should be noted that in this embodiment, testers complete the annotation by performing actions on the test suggestions (for example, by providing options such as "invalid", "incomplete" and "incorrect", and testers annotating the test suggestions by checking the options), and the testers' annotation suggestions are given in natural language.

[0067] Next, the rule set is updated based on the feedback information. In this embodiment, updating the rule set based on the feedback information further includes steps S202 and S203. Steps S202 and S203 will be described below.

[0068] In step S202, the feedback information is input into the information recognition model for recognition. The information recognition model is pre-trained using machine learning to learn and understand the historical feedback information from the testers.

[0069] In step S203, after the information recognition model identifies the feedback information from the testers, it automatically updates the rule set based on the identification results. Specifically, for feedback information including invalid annotations, invalid test suggestions and their corresponding rule conditions are automatically deleted from the rule set based on the identification results of the annotation suggestions in the feedback information; for feedback information including incomplete annotations, new rule conditions and their corresponding test suggestions are automatically generated in the rule set based on the identification results of the annotation suggestions in the feedback information; and for feedback information including incorrect annotation suggestions, incorrect test suggestions and their corresponding rule conditions are automatically modified in the rule set based on the identification results of the annotation suggestions in the feedback information.

[0070] Preferably, for test suggestions with feedback information, an information recognition model is used to calculate the numerical values ​​of similar feedback information for that test suggestion within a predetermined time period. When the calculated value exceeds a predetermined threshold, the feedback information is considered correct and acceptable. In this case, the rule set is updated accordingly based on the semantic recognition result of the information recognition model for that type of feedback information. For example, the information recognition model calculates a value B for invalid annotations related to test suggestion A within the past month. If value B is greater than a predetermined threshold C, then the test suggestion and its corresponding rule conditions are deleted. This effectively improves the accuracy of rule set updates.

[0071] Let's take the aforementioned code snippet as an example. Specifically, the rule condition is "isChannel API call," and the corresponding test suggestion provided to the code file under test for the word "isChannel" is "For some use cases, this function cannot obtain complete channel information." During testing, the tester noted that the above test suggestion was incomplete and provided the suggestion that "isChannel API calls need to be used in conjunction with the isDesktop API." In this case, based on the information recognition model's recognition results of the above feedback information, the test suggestion "For some use cases, this function cannot obtain complete channel information" is modified in the rule set to "For some use cases, this function cannot obtain complete channel information and needs to be used in conjunction with the isDesktop API."

[0072] Accordingly, the present invention also provides a software testing guidance device. Please refer to... Figure 3 , Figure 3 This is a schematic diagram of a software testing guidance device according to a specific embodiment of the present invention. As shown in the figure, the guidance device 20 includes:

[0073] Module 201 is used to pre-build a rule set, which includes rule conditions and test suggestions corresponding to the rule conditions;

[0074] Analysis module 202 is used to perform lexical analysis on the code file to be tested to obtain a symbol sequence carrying multiple words and their related information;

[0075] The matching module 203 is used to match the symbol sequence with the rule conditions, and obtain corresponding test suggestions from the rule set based on the successfully matched rule conditions;

[0076] Module 204 is provided for providing the test recommendations.

[0077] The following will provide a detailed description of each module of the aforementioned guidance device.

[0078] Specifically, as shown in the figure, the software testing guidance device 20 provided by the present invention includes a establishment module 201, which is used to pre-establish a rule set. The rule set includes rule conditions and corresponding test suggestions. The rule conditions are rules or conditions corresponding to one or more logic rules in a code file. For example, a rule condition containing "isChannel API call" corresponds to the logic in the code file that "uses the isChannel method to determine whether the current software execution environment is a channel environment." Another example is a rule condition containing "account login function," which corresponds to the logic in the code file that "calls the account login verification interface." Correspondingly, test suggestions are test insights or opinions for code in the code file to be tested that meets the rule conditions. In other words, test suggestions can provide testers with clear test guidance, enabling them to clearly understand the specific test points in the code file to be tested. In this embodiment, the rule conditions and test suggestions are provided by experienced professionals (e.g., test experts). The more professional and comprehensive the rule conditions and test suggestions, the better the subsequent test guidance effect for testers based on this rule set.

[0079] As shown in the figure, the software testing guidance device 20 provided by the present invention further includes an analysis module 202, which is used to perform lexical analysis on the code file to be tested to obtain a symbol sequence. This symbol sequence includes multiple words and their related information. Here, a word is defined as the smallest unit with independent meaning in a programming language. The working process of the analysis module 202 is as follows: First, the analysis module 202 preprocesses the code file to be tested, removing unnecessary information. This unnecessary information mainly includes code comments, carriage returns, tabs, and other information unrelated to the test. Next, the analysis module 202 performs lexical analysis on the code file to be tested after removing unnecessary information according to word formation rules, decomposing the code file into multiple words and obtaining the related information of these words. In this embodiment, the analysis module 202 can be implemented using a lexical analyzer (e.g., a Lex lexical analyzer). The lexical analysis result is presented as a symbol sequence, which includes multiple lexical units, each corresponding to a word. In this embodiment, each lexical unit includes a word and its related information. Since the value of a word is usually the word itself, it is represented by its value in the lexical unit. The related information includes the word's category and its position in the code file under test. The word's category mainly includes its part of speech, such as identifier, operator, separator, variable, constant, etc. The word's position in the code file under test mainly includes its line number and its index value within that line or code file. Those skilled in the art will understand that the word's position information should not be limited to the line number and index value. Any information that can be used to locate words in the code file under test is applicable to the position information in this invention. For example, for more complex code files under test, the word's position information may also include the depth of the code block containing the word. For simplicity, not all possible word position information will be exemplified here.

[0080] As shown in the figure, the software testing guidance device 20 provided by the present invention further includes a matching module 203. The matching module 203 matches the symbol sequence obtained by the lexical analysis of the analysis module 202 with the rule conditions in the rule set. In this embodiment, the matching module 203 matches the symbol sequence and rule conditions based on the value, category, position information, and context of the words in the symbol sequence. If a rule condition that the symbol sequence meets exists in the rule set, it indicates that the symbol sequence and rule condition have matched successfully. When a rule condition that successfully matches the symbol sequence exists in the rule set, the matching module 203 obtains corresponding test suggestions from the rule set based on the successfully matched rule condition. These test suggestions are test suggestions for the code file to be tested. It should be noted that the matching module 203 can achieve the matching between the symbol sequence and rule conditions based on existing methods such as static code analysis. For the sake of simplicity, the specific process of the matching module 203 in achieving the matching between the symbol sequence and rule conditions will not be described here.

[0081] The software testing guidance device 20 provided by this invention further includes a providing module 204, which provides test suggestions. Specifically, the providing module 204 provides the test suggestions obtained by the matching module 203 to the testers. This invention does not limit the specific provision method of the providing module 204; any method that allows testers to obtain test suggestions is applicable to this invention. In a preferred embodiment, the providing module 204 obtains the position information of the word in the symbol sequence that successfully matches the rule condition in the code file to be tested, and displays the test suggestions at the corresponding position in the code file to be tested (e.g., the line where the word is located) according to the position information. It should be noted that the word in the symbol sequence that successfully matches the rule condition can be one or multiple (e.g., an expression composed of multiple words). Wherein, if the sequence symbols include the position information of the word in the code file to be tested, the providing module 204 can directly obtain the position information of the word from the sequence symbols and then display the test suggestions at the corresponding position in the code file to be tested. The aforementioned method of displaying test suggestions at corresponding locations in the code file to be tested, providing testers with testing guidance, allows testers to quickly identify the areas in the code file that need to be tested. Testers then simply need to formulate test cases based on the test suggestions. Those skilled in the art will understand that in other embodiments, test suggestions can also be provided to testers in other ways, such as generating test suggestion reports. For the sake of brevity, all methods of providing test suggestions will not be listed here.

[0082] The software testing guidance device provided by this invention performs lexical analysis on the code of the file to be tested to obtain a symbol sequence including multiple words and their related information. This symbol sequence is then matched against rule conditions in a pre-established rule set. Based on the successfully matched rule conditions, corresponding test suggestions are obtained from the rule set and provided to the testers. Compared with existing technologies, implementing this invention not only ensures the comprehensiveness of testing but also effectively reduces testing costs and improves testing efficiency because it eliminates the need for testing experts to provide guidance.

[0083] In a preferred embodiment, such as Figure 4 As shown, the software testing guidance device 20 provided by the present invention further includes a difference determination module 205. This difference determination module 205 is used to determine difference test suggestions from the test suggestions obtained by the matching module 203. The difference test suggestions are test suggestions corresponding to the difference code blocks between the code file to be tested and its prior version. Correspondingly, when providing test suggestions to testers, the providing module 204 only provides test suggestions corresponding to the difference code blocks. Specifically, after the matching module 203 obtains the corresponding test suggestions from the rule set according to the matching success rule conditions, the difference determination module 205 determines whether the code file to be tested has a prior version. If the code file to be tested has a prior version and that prior version has been tested, in this case, the difference determination module 205 first determines the difference code blocks between the code file to be tested and the prior version. The difference code blocks between the code file to be tested and the prior version refer to the code blocks where the code differences between the code file to be tested and the prior version are located. The difference code blocks of the code file to be tested can be determined based on the code modification lines and the code structure of the modification line context. After identifying the code blocks that differ between the code file to be tested and the previous version, the difference determination module 205 finds the test suggestions corresponding to the differing code blocks from the test suggestions obtained by the matching module 203 (hereinafter referred to as difference test suggestions), and provides these difference test suggestions to the testers through the providing device 204. Providing only difference test suggestions can effectively avoid the duplication of test suggestions, provide testers with more targeted test suggestions, and improve testing efficiency.

[0084] In a preferred embodiment, the rule set includes not only rule conditions and test suggestions, but also test cases corresponding to those suggestions. Preferably, the test cases are developed by experienced testing experts to ensure comprehensive test case coverage. Accordingly, as... Figure 4As shown, the software testing guidance device 20 provided by the present invention further includes an execution module 206. This execution module 206 obtains test cases corresponding to the test suggestions provided by the providing module 204 from the rule set and automatically executes the test cases. In this way, on the one hand, since the formulation of test cases no longer depends on the tester's own experience, test omissions can be effectively avoided and the comprehensiveness of testing can be ensured; in particular, the more comprehensive the coverage of test cases in the rule set, the better the corresponding test results. On the other hand, since testers do not need to formulate test cases, testing time can be greatly shortened, thereby further improving testing efficiency. Typically, after executing the test cases, the execution module 206 also generates test results and provides these results to the tester to determine whether the code logic is reasonable and meets the requirements.

[0085] In a preferred embodiment, such as Figure 4 As shown, the software testing guidance device provided by the present invention further includes an update module, which receives feedback information for the test and updates the rule set according to the feedback information. Specifically, as Figure 5As shown, the update module 207 preferably includes a receiving unit 2071, an identification unit 2072, and an update unit 2073. The receiving unit 2071 is used to receive feedback information regarding the test. Specifically, when a tester discovers a problem with the provided test suggestion during the test process, they can annotate the test suggestion. The receiving unit 2071 receives the tester's annotation of the test suggestion to obtain the tester's feedback information regarding the test. In this embodiment, the tester's feedback information includes annotations on the provided test suggestion and corresponding annotation suggestions. The annotations and corresponding annotation suggestions include the following three types: (1) if the provided test suggestion is considered invalid, then the annotation on the test suggestion is invalid, and the annotation suggestion is to delete the test suggestion; (2) if the provided test suggestion is considered incomplete, then the annotation on the test suggestion is incomplete, and the annotation suggestion is to provide supplementary test suggestions for the incomplete test suggestion; (3) if the provided test suggestion is considered incorrect, then the annotation on the test suggestion is incorrect, and the annotation suggestion is to provide modified test suggestions for the incorrect test suggestion. It should be noted that the tester's annotations for the provided test suggestions can be operations or actions, such as providing controls corresponding to invalid, incomplete, and incorrect statements. The tester can complete the annotation by operating the control. The tester's annotation suggestions are given in natural language. The recognition unit 2072 is used to recognize the received feedback information. In this embodiment, the recognition unit 2072 can be an information recognition model pre-trained using machine learning on the tester's historical feedback information. This information recognition model is used to learn and understand the feedback information. The update unit 2073 is used to automatically update the rule set based on the recognition results of the recognition unit 2072. Specifically, for feedback information including invalid information, the update unit 2073 automatically deletes the invalid test suggestions and their corresponding rule conditions from the rule set based on the results identified from the annotation suggestions in the feedback information; for feedback information including incomplete annotations, the update unit 2073 automatically generates new rule conditions and their corresponding test suggestions in the rule set based on the results identified from the annotation suggestions in the feedback information; for feedback information including incorrect annotation suggestions, the update unit 2073 automatically modifies the incorrect test suggestions and their corresponding rule conditions in the rule set based on the results identified from the annotation suggestions in the feedback information.

[0086] Preferably, the update module further includes a calculation unit (not shown). For test suggestions with feedback information, this calculation unit performs numerical calculations on the same type of feedback information for that test suggestion within a predetermined time period. When the calculated value exceeds a predetermined threshold, the feedback information is considered correct and acceptable. In this case, the update unit 2073 updates the rule set accordingly based on the semantic recognition result of the recognition unit 2072 for that same type of feedback information. For example, if the value B is calculated on the feedback information from testers regarding invalid annotations for test suggestion A within the past month, and value B is greater than a predetermined threshold C, then the test suggestion and its corresponding rule conditions are deleted. This effectively improves the accuracy of rule set updates. It should be noted that if the recognition unit 2072 is an information recognition model pre-trained using machine learning on historical feedback information from testers, the information recognition model can typically perform numerical calculations on the feedback information while simultaneously recognizing it. In other words, the recognition unit 2072 also functions as a calculation unit. In this case, a separate calculation unit is not required.

[0087] Accordingly, the present invention also discloses one or more computer-readable media storing computer-executable instructions, which, when used by one or more computer devices, cause the one or more computer devices to perform various specific embodiments of the software testing guidance method described above, for example... Figure 1 The software testing guidelines shown are applicable. The computer-readable medium can be any available medium accessible by a computer device, including volatile and non-volatile media, removable and non-removable media implemented in any way and with any technique to store information such as computer-readable instructions, data structures, program modules, or other data. Computer-readable media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, cassette tape, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store the required information and is accessible by a computing device. Any combination of the above should also be included within the scope of computer-readable media.

[0088] Accordingly, the present invention also discloses an electronic device. Please refer to... Figure 6 , Figure 6 This is a schematic diagram of an electronic device used to implement the software testing guidance method of the present invention. As shown in the figure, the electronic device 30 includes a memory 301 and a processor 302, wherein: the memory 301 stores a computer program, and the processor 302 executes the computer program to implement various specific embodiments of the software testing guidance method described above, for example... Figure 1The software testing guidelines are shown. The memory 301 and processor 302 can be connected via a bus.

[0089] The software logic portion of the software testing guidance method provided by this invention can be implemented using a programmable logic device or as a computer program product that enables a computer to execute the demonstrated method. The computer program product includes a computer-readable storage medium containing computer program logic or code portions for implementing the various steps of the aforementioned software logic portion. The computer-readable storage medium can be an internal medium installed in a computer or a removable medium (e.g., a hot-swappable storage device) removable from the computer body. The internal medium includes, but is not limited to, rewritable non-volatile memory, such as RAM, ROM, and hard disks. The removable medium includes, but is not limited to: optical storage media (e.g., CD-ROMs and DVDs), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tapes or portable hard disks), media with built-in rewritable non-volatile memory (e.g., memory cards), and media with built-in ROM (e.g., ROM cartridges).

[0090] Those skilled in the art will understand that any computer system with suitable programming means is capable of executing the steps of the method of the present invention contained in a computer program product. Although most of the specific embodiments described in this specification focus on software programs, alternative embodiments that implement the method provided by the present invention in hardware are also within the scope of the present invention.

[0091] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered illustrative and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. All variations within the meaning and scope of equivalents of the claims are embraced within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other components, units, or steps, and the singular does not exclude the plural. Multiple components, units, or devices recited in the claims may also be implemented by a single component, unit, or device through software or hardware.

[0092] The above-disclosed embodiments or specific implementations of the present invention are only some examples of the present invention and should not be construed as limiting the scope of the present invention. Equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.

Claims

1. A method for guiding software testing, characterized in that, The guidance method includes: A rule set is pre-established, which includes rule conditions and corresponding test suggestions; Lexical analysis is performed on the code file to be tested to obtain a sequence of symbols carrying multiple words and their related information; The symbol sequence is matched with the rule conditions, and corresponding test suggestions are obtained from the rule set based on the successfully matched rule conditions; Provide the aforementioned testing recommendations; From the obtained test suggestions, identify the test suggestions corresponding to the difference code block, and when providing test suggestions to testers, only provide the difference test suggestions corresponding to the difference code block; The system receives feedback from testers regarding the test recommendations, inputs the feedback information into an information recognition model for identification, and uses the information recognition model to perform numerical calculations on the same type of feedback information of the test recommendations within a predetermined time period. When the calculated value exceeds a predetermined threshold, the feedback information is considered correct and acceptable. The system then updates the rule set accordingly based on the semantic recognition results of the same type of feedback information from the information recognition model. The update of the rule set includes: for feedback information containing invalid annotations, automatically deleting invalid test suggestions and their corresponding rule conditions from the rule set based on the results identified from the annotation suggestions in the feedback information; for feedback information containing incomplete annotations, automatically generating new rule conditions and their corresponding test suggestions in the rule set based on the results identified from the annotation suggestions in the feedback information; and for feedback information containing incorrect annotation suggestions, automatically modifying the incorrect test suggestions and their corresponding rule conditions in the rule set based on the results identified from the annotation suggestions in the feedback information.

2. The guidance method according to claim 1, characterized in that, in: The relevant information about the word includes the word's category and its location in the code file to be tested.

3. The guidance method according to claim 1, characterized in that, in: After obtaining the corresponding test suggestions from the rule set based on the successfully matched rule conditions, the guidance method further includes: determining difference test suggestions from the obtained test suggestions, wherein the difference test suggestions are the test suggestions corresponding to the difference code blocks between the code file to be tested and its earlier version; and The steps for providing the test recommendations include: providing the difference test recommendations.

4. The guidance method according to claim 1 or 2, characterized in that, in, The steps for providing the aforementioned test recommendations include: The position information of the word that successfully matches the rule condition in the code file is obtained from the symbol sequence, and the test suggestion is displayed at the corresponding position in the code file to be tested based on the position information.

5. The guidance method according to claim 1, characterized in that, in: The rule set also includes test cases corresponding to the test recommendations; After providing the test recommendations, the guidance method further includes: obtaining corresponding test cases from the rule set according to the test recommendations, and automatically executing the test cases.

6. The guidance method according to claim 1, characterized in that, in, The step of updating the rule set based on the feedback information includes: The feedback information is input into an information recognition model for recognition, wherein the information recognition model is trained on the tester's historical feedback information through machine learning. The rule set is automatically updated based on the recognition results.

7. A software testing guidance device, characterized in that, The guidance device includes: A module is established to pre-build a rule set, which includes rule conditions and corresponding test suggestions. The analysis module is used to perform lexical analysis on the code file to be tested to obtain a sequence of symbols carrying multiple words and their related information; The matching module is used to match the symbol sequence with the rule conditions, and obtain corresponding test suggestions from the rule set based on the successfully matched rule conditions; Provide a module for providing the aforementioned test recommendations; From the obtained test suggestions, identify the test suggestions corresponding to the difference code block, and when providing test suggestions to testers, only provide the difference test suggestions corresponding to the difference code block; The system receives feedback from testers regarding the test recommendations, inputs the feedback information into an information recognition model for identification, and uses the information recognition model to perform numerical calculations on the same type of feedback information of the test recommendations within a predetermined time period. When the calculated value exceeds a predetermined threshold, the feedback information is considered correct and acceptable. The system then updates the rule set accordingly based on the semantic recognition results of the same type of feedback information from the information recognition model. The update of the rule set includes: for feedback information containing invalid annotations, automatically deleting invalid test suggestions and their corresponding rule conditions from the rule set based on the results identified from the annotation suggestions in the feedback information; for feedback information containing incomplete annotations, automatically generating new rule conditions and their corresponding test suggestions in the rule set based on the results identified from the annotation suggestions in the feedback information; and for feedback information containing incorrect annotation suggestions, automatically modifying the incorrect test suggestions and their corresponding rule conditions in the rule set based on the results identified from the annotation suggestions in the feedback information.

8. One or more computer-readable media storing computer-executable instructions, characterized in that, When used by one or more computer devices, the instructions cause the one or more computer devices to perform the guided method for software testing as described in any one of claims 1 to 6.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor, wherein: the memory stores a computer program, and the processor executes the computer program to implement the guided method for software testing as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Software testing method, device and system

    CN103198010A

  • Automatic testing method and device based on lexical analysis

    CN106354638A

  • Software test case intelligent training method, terminal and storage medium

    CN110209585A

  • Automatic software test system and method for artificial intelligence

    CN110347603A