A method, device and storage medium for determining a software test scope
By acquiring updated components and their associated components, and utilizing component relationships and the minimum set of pages, the page to be tested is automatically determined. This solves the problem of incomplete testing caused by reliance on human experience in existing technologies, and achieves efficient and accurate software testing scope assessment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2021-12-30
- Publication Date
- 2026-05-05
AI Technical Summary
Existing methods for determining the scope of software testing rely on human experience, resulting in incomplete test coverage, difficulty in maintaining high quality, and inability to effectively assess the impact of mutual references between components.
By obtaining the updated components and their associated components, and utilizing the pre-stored component relationships and the minimum set of pages covering all component combinations, the page to be tested is automatically determined, and Babel parsing and a greedy algorithm are used to optimize the coverage of component combinations.
It improves the completeness and efficiency of software testing, reduces manual labor, accurately assesses the impact between components, and ensures test quality.
Smart Images

Figure CN114328246B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more particularly to the field of computer software technology. Background Technology
[0002] Typically, after the development or update of software is completed, it needs to be tested to determine whether it can function properly. Before conducting software testing, it is usually necessary to define the scope of the testing. Summary of the Invention
[0003] This disclosure provides a method, apparatus, device, and storage medium for determining the scope of software tests to improve the integrity of the test scope.
[0004] According to one aspect of this disclosure, a method for determining the scope of software testing is provided, comprising:
[0005] Retrieve the updated components that have been updated in the software under test;
[0006] Based on the pre-stored component association relationships in the software under test, determine the associated components that are associated with the updated component;
[0007] Based on the updated component, the associated component, and the minimum set of pages covering all component combinations in the pre-stored software under test, the test pages of the software under test are determined.
[0008] According to another aspect of this disclosure, a software testing scope determination apparatus is provided, comprising:
[0009] The update component acquisition module is used to acquire the update components that have been updated in the software under test;
[0010] The associated component acquisition module is used to determine the associated components associated with the updated component based on the pre-stored component association relationships in the software to be tested;
[0011] The test page determination module is used to determine the test page of the software under test based on the updated component, the associated component, and the minimum set of pages covering all component combinations in the pre-stored software under test.
[0012] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0013] At least one processor; and
[0014] A memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform any of the above-described methods for determining the scope of software testing.
[0016] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method for determining the scope of software testing as described above.
[0017] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method for determining the software test scope described above.
[0018] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0019] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0020] Figure 1a This is a schematic diagram of a first embodiment of the method for determining the scope of software testing provided in this disclosure;
[0021] Figure 1b This is a schematic diagram illustrating the relationship between pages and components in this disclosure;
[0022] Figure 2 This is a flowchart illustrating a process for obtaining the correspondence between pages and components in this disclosure;
[0023] Figure 3 This is a schematic diagram illustrating one process of obtaining the correspondence between pages and components in this disclosure;
[0024] Figure 4 This is a schematic diagram illustrating the process of obtaining component association relationships based on component dependencies in this disclosure;
[0025] Figure 5 This is a flowchart illustrating the process of obtaining the minimum set of pages covering all component combinations in this disclosure;
[0026] Figure 6 This is a schematic diagram illustrating a specific example of obtaining a minimal set of pages covering all component combinations in this disclosure;
[0027] Figure 7 This is a schematic diagram of a second embodiment of the method for determining the scope of software testing provided in this disclosure;
[0028] Figure 8 This is a schematic diagram of the component impact range assessment report generated in this disclosure;
[0029] Figure 9 This is a schematic diagram of a third embodiment of the method for determining the scope of software testing provided in this disclosure;
[0030] Figure 10 This is a schematic diagram of a first embodiment of the software testing scope determination apparatus provided in this disclosure;
[0031] Figure 11 This is a schematic diagram of a second embodiment of the software testing scope determination apparatus provided in this disclosure;
[0032] Figure 12 This is a block diagram of an electronic device used to implement the method for determining the software testing scope of embodiments of the present disclosure. Detailed Implementation
[0033] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0034] Currently, software testing mainly includes front-end testing, which involves testing the front-end pages of the software. Front-end testing is largely black-box testing, and the completeness of test points heavily relies on the individual capabilities of the testers. This makes it easy for omissions to occur due to incomplete impact assessments, or incomplete definitions of the software testing scope.
[0035] Furthermore, with the development of the business, the current front-end testing methods rely entirely on manual labor to adapt to the continuous expansion of the business. This depends on both the amount of manpower invested and human experience, making it difficult to maintain a high level of software testing quality.
[0036] To address the above problems, this disclosure provides a method, apparatus, electronic device, and storage medium for determining the scope of software testing. The method for determining the scope of software testing provided in this disclosure will be described first.
[0037] like Figure 1a As shown, Figure 1a This is a schematic diagram of a first embodiment of a method for determining the scope of software testing provided in this disclosure. The method may include the following steps:
[0038] Step S110: Obtain the updated components that have been updated in the software to be tested.
[0039] Typically, computer software presents various pages to users as a collection of components. For example... Figure 1b As shown, by configuring and parsing components A through I, the corresponding page A can be obtained. Page A includes components A, B, C, and D, where component B contains components C and D. The software under test can interact with the user through the page, thereby providing the user with corresponding network services.
[0040] In this embodiment of the disclosure, the aforementioned page may include a web-type page and a C-end type page. A web-type page is a file organized in HTML format on the web and can be accessed via the web. A C-end type page refers to a page accessed through a client, such as the interface of an app. Both web-type pages and C-end type pages can be composed of a large number of different types of components, such as a large number of ONEUI components and WIDGETID components.
[0041] In this embodiment of the disclosure, each component can be uniquely identified by setting a corresponding component identifier (e.g., component Id (widgetId)).
[0042] In this embodiment of the disclosure, the above-mentioned components may include graphic components, image components, form components, multi-image components, and single-image components, etc.
[0043] Step S120: Based on the pre-stored component association relationships in the software to be tested, determine the associated components that are associated with the updated component.
[0044] As mentioned above, in the field of computer software technology, a software application (such as an app) typically includes multiple components across its various pages. These components often have interdependencies and influences each other, resulting in high coupling. For example, an upgraded single-image component might display correctly on its own, but when it coexists with a form component on the same page, the single-image component may display as a blank screen. This situation illustrates how the form component can negatively impact the single-image component.
[0045] Therefore, in this embodiment of the disclosure, when testing the software after upgrading a certain component, it is necessary to consider the components associated with it. In one embodiment of this disclosure, the component association relationships of the aforementioned ONEUI component and WIDGETID component can be obtained and stored. Based on the updated component and the stored component association relationships, the associated components affected by the updated component can be obtained.
[0046] Step S130: Based on the updated component, the associated component, and the minimum set of pages covering all component combinations in the pre-stored software under test, determine the pages to be tested in the software under test.
[0047] Typically, a software application has a large number of individual components (e.g., possibly hundreds). In actual software testing, it is difficult to construct pages for each combination of components and use them for software testing.
[0048] Therefore, in this embodiment of the disclosure, a minimum set of pages covering all component combinations in the software under test can be obtained in advance, and pages to be tested can be selected from this minimum set of pages based on the aforementioned updated components and associated components. Since this minimum set of pages covers all component combinations in the software under test, it is equivalent to covering all pages. Therefore, selecting pages to be tested from this minimum set of pages can improve the convenience of software testing and reduce manual labor to a certain extent.
[0049] As can be seen, the method for determining the scope of software testing provided in this disclosure, after obtaining the updated components in the software to be tested, obtains the related components affected by the updated components based on pre-stored component association relationships. Finally, based on the updated components, related components, and a pre-stored minimum page set covering all component combinations, the page to be tested is obtained. Applying this disclosure, based on component association relationships, other components affected by the updated components can be obtained, rather than simply considering the updated components themselves, making the evaluated impact of the updated components more comprehensive. Furthermore, since the page to be tested is obtained from the minimum page set covering all component combinations, which covers all pages, the completeness of the software testing coverage is further improved.
[0050] In addition, the software testing scope determination method provided in this disclosure can determine the affected pages based on the component association relationship after obtaining the updated component, and then determine the pages to be tested based on the minimum set of pages covering all component combinations. The whole process can be carried out automatically, and the determination of the software testing scope does not rely on human experience, thereby saving human resources and maintaining the software testing quality at a high level, thus ensuring the quality of software testing.
[0051] In this embodiment of the disclosure, before obtaining the minimum set of pages covering all component combinations, it is necessary to first obtain the correspondence between pages and components.
[0052] In the field of computer software technology, URLs are typically used to uniquely identify web pages. As mentioned above, a page can contain multiple components, meaning that one URL can correspond to multiple component identifiers (widgetIds).
[0053] As described above, in this embodiment of the disclosure, the pages in the software to be tested can be divided into two types: web pages and C-end (client) pages. Different methods can be used to obtain the correspondence between the pages and components for these two types of pages.
[0054] like Figure 2 As shown in this embodiment of the disclosure, when obtaining the correspondence between a web page and its components, the following steps can be used:
[0055] Step S210: Obtain the test code of the software to be tested.
[0056] In this embodiment, the code structure of the software under test can be described as a "tree". The root node of the "tree" corresponds to a URL, namely the page mentioned above, which is a business function entry point of the software under test (such as login, check-in, etc.). Non-leaf nodes correspond to the JS files that describe the UI display, while leaf nodes correspond to components in the component library or internal underlying JS files. The directed edges of the "tree" correspond to the reference relationships between JS files and components.
[0057] The aforementioned JS file is Javascript (a type of script file). The JS file that describes the UI display can include information about the various components referenced on the page.
[0058] Step S220: Perform Babel parsing on the code to be tested to obtain the abstract syntax tree corresponding to the code to be tested.
[0059] Babel is a JavaScript compiler that can perform source code to source code conversion. In other words, Babel can compile source code using higher-level syntax into code using compatible syntax.
[0060] In this embodiment of the disclosure, Babel can be used to traverse a preset code library to parse the code to be tested. The preset code library may contain relevant code that the Babel compiler needs to use when compiling the code.
[0061] As one specific implementation of this disclosure, the JS file can be parsed by using Babel to call the parser method (Babel-parser). The parsing process can specifically include tokenization and syntax analysis of the JS file's code.
[0062] After parsing the above JS file using Babel-parser, you can obtain the corresponding Abstract Syntax Tree (AST).
[0063] An abstract syntax tree (AST) is a tree-like representation of the abstract syntactic structure of source code. Each node in the tree represents a structure in the source code. It does not represent every detail of the actual syntax; for example, nested parentheses are implicit in the tree structure and are not presented as nodes.
[0064] Figure 2 In step S230, the abstract syntax tree is traversed and parsed using Babel to obtain the correspondence between pages and components in the code to be tested, and then stored.
[0065] In this embodiment of the disclosure, the traverse method (Babel-traverse) in Babel can be used to traverse and parse the above-mentioned abstract syntax tree, that is, to process the required syntax tree nodes.
[0066] Babel-traverse is a tool for traversing an abstract syntax tree. Similar to the replace method for strings, it allows replacing strings by specifying a regular expression. Babel-traverse can also perform replacements on an abstract syntax tree. In this embodiment of the disclosure, the process of traversing and parsing the abstract syntax tree using Babel-traverse may include replacing, deleting, and copying nodes in the abstract syntax tree, etc.
[0067] As mentioned above, this step is to obtain the correspondence between pages and components from the abstract syntax tree. Therefore, in this embodiment, when traversing the abstract syntax tree, the traversal of some nodes that are not related to the correspondence between pages and components can be skipped, that is, only the necessary syntax tree nodes can be processed.
[0068] After parsing the aforementioned JS file, the reference relationship between pages (URLs) and components (component IDs) contained in the code can be extracted, i.e., a one-to-many relationship between URLs and components can be obtained. In this embodiment of the disclosure, after obtaining the above correspondence between URLs and components, the correspondence can be stored in a database (DB) for subsequent use.
[0069] In one embodiment of this disclosure, after obtaining the correspondence between the above URL and the component, the above URL can be converted into an abstract component to establish the corresponding reference relationship and store it in the database.
[0070] See Figure 3. Figure 3 A schematic diagram illustrating the process of obtaining the correspondence between URLs and components in an embodiment of this disclosure is shown.
[0071] First, the Babel compiler is used to parse the JS files corresponding to each page's URL (full URL), obtaining the corresponding abstract syntax tree (AST), and then using this AST to parse the component reference relationships in the code. For example... Figure 3 As shown, url1 references internal component 1, internal component 2, and internal component 3, while internal component 2 references component library component 2, and internal component 3 references component library component 3; url2 references internal component 3, internal component 4, and component library component 1; url3 references internal component 5.
[0072] In this embodiment, the aforementioned full URLs can be transformed into abstract components to establish full reference relationships. Specifically, for URL1, corresponding relationships can be established based on its reference relationships with internal component 1, internal component 2, and internal component 3, respectively.
[0073] As can be seen, in this embodiment of the disclosure, using the Babel compiler to build an abstract syntax tree for the code under test can significantly enhance code compatibility, making the retrieval of page and component references from the code platform-independent. Furthermore, retrieving page and component references based on the abstract syntax tree is more efficient because the abstract syntax tree effectively represents the code structure, and only necessary nodes can be processed during traversal.
[0074] In this embodiment of the disclosure, when obtaining the correspondence between pages and components for a C-end page, it can be done as follows:
[0075] Retrieve the pre-stored mapping between pages and components from the database.
[0076] In this embodiment of the disclosure, when writing the C-end page code, the page URL and the component identifiers (e.g., component IDs (widgetId)) of the referenced components can be stored in the database. When obtaining the correspondence between the C-end page and the components, the above correspondence can be directly retrieved from the database. This greatly improves the convenience of obtaining the correspondence between pages and components.
[0077] As shown in the table below, the table provides an exemplary storage structure in the database for the correspondence between pages and components in this embodiment of the present disclosure.
[0078] Field Type NULL Key Default Extra …… …… …… …… …… …… app_id int(10) NO 3 site_id Bigint(20) NO MUL -1 page_id Bigint(20) NO MUL -1 widget_id Bigint(20) NO -1 widget_context longtext YES NULL …… …… …… …… …… ……
[0079] In the table above, `field` refers to member variables within the class, used for method calls within the class. As shown in the table, these class member variables can include the APP identifier (`app_id`), website identifier (`site_id`), page identifier (`page_id`, which uniquely identifies a URL), component identifier (`widget_id`, which uniquely identifies a component), and component content (`widget_context`), etc. In the table, `Type` indicates the data type; `NULL` indicates whether the corresponding data is empty (`NO` means not empty, `YES` means empty); `Key` indicates the key corresponding to the corresponding data, based on which the corresponding data can be retrieved; `Default` indicates the default value of the corresponding data; `Extra` indicates some additional information.
[0080] In this embodiment, the page identifier (page_id) and component identifier (widget_id) have a one-to-many correspondence.
[0081] As mentioned above, the components are not completely independent; there are references and dependencies between them. For example, if a single graph component is upgraded, and multiple graph components reference or depend on it, then the functionality of those multiple graph components also needs to undergo corresponding regression testing. Therefore, in this embodiment, the relationships between components can be obtained based on their dependencies, thereby allowing the identification of related components affected by the updated components.
[0082] As described above, in this embodiment of the disclosure, different methods can be used to obtain the inter-component relationships for ONEUI components and WIDGETID components.
[0083] In one embodiment of this disclosure, when obtaining the inter-component relationships of the aforementioned ONEUI components, the abstract syntax tree corresponding to the code to be tested can be parsed to obtain and store the inter-component relationships of each ONEUI component in the software to be tested.
[0084] In this embodiment of the disclosure, the traverse method (Babel-traverse) in Babel can also be used to parse the abstract syntax tree to obtain the relationship between ONEUI components.
[0085] When retrieving the relationships between components using the WIDGETID component mentioned above, the following methods can be used:
[0086] First, for each WIDGETID component, obtain the dependencies between this component and other components set when the component was generated.
[0087] For each WIDGETID component, when creating or editing each WIDGETID component, the component relationships that the component depends on are generated and persisted to the database. In other words, the dependency relationships between the component and its dependent components are stored in the database. For example, the dependency relationships between an advanced graphic component and its dependent image and text components can be stored in the database.
[0088] Therefore, in this embodiment of the disclosure, the dependencies between components and other components can be directly obtained from the database.
[0089] Secondly, based on the dependencies between each component and other components, the association relationships between each component in the software under test are obtained and stored.
[0090] In this embodiment of the disclosure, after obtaining the dependencies between components and other components, the dependencies can be reversed to obtain the associations between components, that is, the set of components that will be affected by the upgrade of a single component.
[0091] See Figure 4 , Figure 4 This diagram illustrates the process of obtaining component association relationships based on component dependencies in an embodiment of this disclosure. In this diagram, a component is represented by a widgetId.
[0092] like Figure 4 As shown, widgetId1 depends on widgetId2, widgetId3, and widgetId4; widgetId3 depends on widgetId2, widgetId5, and widgetId6; and widgetId7 depends on widgetId3 and widgetId8. Therefore, for widgetId2, we can determine that the components it is associated with include widgetId1, widgetId3, and widgetId7. In other words, if widgetId2 is upgraded, the upstream components affected will be widgetId1, widgetId3, and widgetId7.
[0093] As can be seen, in this embodiment of the disclosure, by obtaining the component association relationship, it is possible to obtain other components affected by the updated component when a single component is updated or upgraded, thereby improving the completeness of the test scope.
[0094] To avoid missing any component combinations, the most direct method is to perform regression testing on all component combinations. However, this is extremely labor-intensive and involves a lot of repetitive work. Therefore, this disclosure proposes to establish a minimal set of pages that covers all component combinations in the software under test, thereby avoiding this problem.
[0095] As described above, a page (URL) is composed of multiple components (widgetId), and the combination relationship of these components uniquely represents a page. In other words, if all component combinations are covered, then all pages are covered. Based on this idea, in this embodiment of the disclosure, a set of pages that covers all component combinations can be filtered out based on the component-page relationship data set.
[0096] This problem can be transformed into a set covering problem, i.e., selecting the minimum number of sets to cover all elements. However, no algorithm can solve this problem fast enough, and when facing NP-complete problems (nondeterministic problems with polynomial complexity), the best approach is to use approximate algorithms. In this embodiment, a greedy algorithm can be used to solve this NP-complete problem. A greedy algorithm selects the current optimal solution at each step in order to obtain the globally optimal solution.
[0097] like Figure 5 As shown, in one embodiment of this disclosure, the minimum set of pages covering all component combinations can be obtained in advance using the following steps:
[0098] Step S510: Obtain the correspondence between pages and components in the software to be tested.
[0099] The method for obtaining the correspondence between pages and components in the software under test has been described in detail above and will not be repeated here.
[0100] Step S520: Based on the correspondence between the pages and components, the page that covers the most components is selected as the candidate page.
[0101] In this embodiment of the disclosure, based on the correspondence between each page and component in the aforementioned full set of URLs (pages), the page with the most corresponding components can be selected as a candidate page. If there are multiple pages with the most corresponding components, all of these pages can be selected as candidate pages.
[0102] Step S530: For pages other than the candidate pages, repeat the step of selecting the page that covers the most components as the candidate page based on the correspondence between the page and the components, until each candidate page covers all component combination relationships.
[0103] In this embodiment of the disclosure, when obtaining candidate pages, if the newly obtained page that covers the most components covers a combination of components that has already been covered, the page can still be used as a candidate page.
[0104] In this embodiment of the disclosure, after obtaining each candidate page, the candidate pages can be filtered. That is, if multiple candidate pages cover the same component combination, then the candidate page that covers more component combinations can be selected as the page in the smallest page set covering all component combinations. For example, if page 1 covers component 1, component 2, and component 3, and page 2 covers component 1 and component 2, then page 1 can be selected as the page in the smallest page set covering all component combinations.
[0105] Step S540: Store all the candidate pages obtained as a minimal set of pages covering all component combinations.
[0106] In this embodiment of the disclosure, after obtaining the minimum set of pages covering all component combinations, the pages in this set can be filtered. As a specific implementation, if multiple pages in the set of pages covering all component combinations have the exact same covered component combinations, then one of these pages can be selected as a page in the set of pages covering all component combinations for storage. For example, if page 3 consists of components 5, 6, and 7, and page 6 also consists of components 5, 6, and 7, then one page can be selected from pages 3 and 6 as a page in the set of pages covering all component combinations for storage.
[0107] In this embodiment of the disclosure, the minimum set of pages covering all component combinations can be stored in a database. In this embodiment of the disclosure, the component combinations contained in each page of the minimum set can be stored in the database along with the corresponding page information.
[0108] See Figure 6 , Figure 6 This is a schematic diagram illustrating a specific example of obtaining a minimum set of pages covering all component combinations in this embodiment of the disclosure. In this diagram, "url" refers to a page, and "wid" refers to a component.
[0109] like Figure 6 As shown, url1 consists of component 1, component 2 and component n, url2 consists of component 1, component 2 and component n, url3 consists of component 1 and component 2, and url4 consists of component 4. The component combination corresponding to each of the above urls can be obtained from the database or by parsing the above abstract syntax tree.
[0110] Next, the URLs are categorized according to component combinations, thus transforming the minimum set of pages covering all component combinations into a set coverage problem. For example... Figure 6As shown, URLs 1 and 2 contain combinations of components 1, 2, and n; URL 3 contains combinations of components 1 and 2; and URL 4 contains component 4. For these four pages, based on a greedy algorithm, we can first select URLs 1 and 2 as candidate pages, then select URL 3 as a candidate page, and finally select URL 4 as a candidate page. At this point, the candidate pages have covered all component combinations.
[0111] Since url1, url2, and url3 all cover the component combinations of component 1 and component 2, and url1 and url2 cover more component combinations than url3, the set of pages that cover the most component combinations can include url1, url2, and url4.
[0112] Since url1 and url2 cover the exact same component combinations, we only need to select url1 and url4 as representatives to cover all component combination relationships.
[0113] In this embodiment of the disclosure, the minimum set of pages covering all component combinations includes all component combinations and ensures the minimum size of the pages, thereby ensuring the minimum size of the pages to be tested obtained subsequently. This not only improves the completeness of the test scope but also greatly improves the efficiency of software testing and saves human resources.
[0114] In one embodiment of this disclosure, such as Figure 7 As shown above, Figure 1a Step S130 may specifically include the following steps:
[0115] Step S131: Match the component combinations contained in each page of the minimum page set covering all component combinations with the updated component and the associated component to obtain the page to be tested.
[0116] As described above, in this embodiment of the disclosure, the database can store a minimum set of pages covering all component combinations in the software under test, as well as the component combinations contained in each page. Therefore, in this step, the updated component and associated component can be matched with the component combinations contained in each page stored in the database, and the page corresponding to the successfully matched component combination is taken as the page to be tested. For example, if the updated component is component 1, and the associated components include component 2, component 3, and component 4, and the software under test includes 10 components (components 1 to 10), the minimum set of pages covering all component combinations in the software under test contains 4 pages: page 1 consists of component 1, component 2, and component 5; page 2 consists of component 1, component 3, and component 4; page 3 consists of component 6, component 7, component 8, and component 9; and page 4 consists of component 10. Then, based on the updated component and associated component, the pages to be tested selected from the minimum set of pages can be page 1 and page 2, which contain component 1, component 2, component 3, and component 4.
[0117] This ensures a minimum size of the page to be tested, improving the convenience of software testing.
[0118] In one embodiment of this disclosure, such as Figure 7 As shown, in Figure 1a In addition to the steps shown, the following steps may also be included:
[0119] Step S740: Based on the page to be tested, generate an impact range assessment report of the updated components in the software to be tested.
[0120] In this embodiment of the disclosure, after relevant personnel release the upgraded component / code, an impact assessment task can be automatically triggered, and a component impact scope assessment report can be generated. After generating the assessment report, it can be sent to software testers via email or other means to assist manual testing.
[0121] In this embodiment of the disclosure, the evaluation report may include: the updated component information, the associated component information, and the page information to be tested. The updated component information may include the component identifier (e.g., component ID) and component name of the upgraded component; the associated component information may include the names of components that may be affected by the updated component; the page information to be tested may include the URL address of the page to be tested, the components contained in the page to be tested, and the identifier of the page to be tested (e.g., page ID), etc.
[0122] In this embodiment of the disclosure, the aforementioned evaluation report may also include business information corresponding to this component release, such as test cases (story), quality assurance (QA) personnel, front-end engineers (FE), and other information. By providing the updated component impact scope evaluation report to testers, it is possible to better assist testers in their testing and improve testing efficiency.
[0123] like Figure 8 As shown, Figure 8 An example of a specific evaluation report is shown.
[0124] The evaluation report may include the evaluation report title ("XXX Component Release Evaluation Report", where XXX can represent the component name of the upgraded component), information about the upgraded component (information about the component released on the online D-end, including the component ID and component name), information about the component publisher, information about the test cases bound to the released component, information about other components that may be affected by the component upgrade (i.e., related component information, including the names of the affected components, such as component 1, component 2, component 3), and may also include URL information for recommended testing (which may include the URL sequence number, component ID, component name, the page URL that needs to be regressed, and the components contained in the URL, etc.).
[0125] like Figure 9 As shown, Figure 9 A schematic diagram illustrating a specific process for determining the scope of software testing in an embodiment of this disclosure is shown.
[0126] like Figure 9 As shown, in this embodiment, a minimum set of pages covering all component combinations, obtained based on the correspondence between components and pages, is pre-stored in a widgetId&url mapping library, and component associations are stored in a widgetId mapping library. After obtaining the code submitted by relevant personnel, the upgraded component and its component Id (widgetId) are determined. Then, based on this Id, the components widgetId1, widgetId2, and widgetId3 affected by the upgraded component are determined from the widgetId mapping library. Based on the upgraded component and the affected components, the affected page URLs URL1, URL2, URL3, URL4, and URL5 are obtained from the widgetId&url mapping library. Finally, a component test scope evaluation report is generated based on the affected pages and sent to the testers.
[0127] In existing technologies, the scope of software testing is typically evaluated based on JS coverage, which has the following problems:
[0128] 1. A mapping library based on historical use cases and code relationships can deduce historical use cases affected by this upgrade based on newly added code. However, it cannot recommend which new features require attention. In other words, it can only evaluate historical use cases, not newly added use cases.
[0129] 2. JavaScript coverage can numerically assess the test coverage of code, but it cannot assess the cross-references between functions. For example, it cannot assess the impact of the following scenario: function A uses function B, and function B is upgraded; it cannot assess whether function A will be affected. That is, it can only assess the coverage of the current upgrade, not the impact of the call relationship.
[0130] The method for determining the scope of software testing provided in this disclosure can obtain the pages to be tested based on the minimum set of pages covering all component combinations, and is not limited to pages that have been tested previously. Furthermore, this disclosure can determine related components affected by the upgraded component based on component relationships, that is, it can identify other functional points affected by the upgraded component, thus assessing the impact of call relationships and improving the completeness of the software testing scope.
[0131] According to embodiments of this disclosure, this disclosure also provides a device for determining the scope of software testing, such as... Figure 10 As shown, the device may include:
[0132] The update component acquisition module 1010 is used to acquire the update components that have been updated in the software under test;
[0133] The associated component acquisition module 1020 is used to determine the associated components associated with the updated component based on the pre-stored component association relationships in the software to be tested.
[0134] The test page determination module 1030 is used to determine the test page of the software under test based on the updated component, the associated component, and the minimum set of pages covering all component combinations in the pre-stored software under test.
[0135] The software testing scope determination apparatus provided in this disclosure, after acquiring the updated component in the software to be tested, obtains the associated components affected by the updated component based on pre-stored component association relationships. Finally, based on the updated component, associated components, and a pre-stored minimum page set covering all component combinations, it obtains the page to be tested. By applying this disclosure, based on component association relationships, other components affected by the updated component can be obtained, rather than simply considering the updated component itself, making the evaluated impact of the updated component more comprehensive. Furthermore, since the page to be tested is obtained from the minimum page set covering all component combinations, which covers all pages, the completeness of the software testing coverage is further improved.
[0136] In one embodiment of this disclosure, the minimum set of pages covering all component combinations is obtained in advance using the following steps:
[0137] Obtain the correspondence between pages and components in the software under test;
[0138] Based on the correspondence between the pages and components, the page that covers the most components will be selected as the candidate page;
[0139] For pages other than the candidate pages, repeat the step of selecting the page that covers the most components as the candidate page based on the correspondence between the page and the components, until each candidate page covers all component combinations.
[0140] All candidate pages obtained are stored as a minimal set of pages covering all component combinations.
[0141] In one embodiment of this disclosure, obtaining the correspondence between pages and components in the software to be tested includes:
[0142] Obtain the test code of the software to be tested;
[0143] Perform Babel parsing on the code to be tested to obtain the abstract syntax tree corresponding to the code to be tested;
[0144] The abstract syntax tree is traversed and parsed using Babel to obtain and store the correspondence between pages and components in the code to be tested.
[0145] In other embodiments of this disclosure, obtaining the correspondence between pages and components in the software to be tested includes:
[0146] Retrieve the pre-stored mapping between pages and components from the business system database.
[0147] In one embodiment of this disclosure, the component association relationship is obtained in advance using the following steps:
[0148] The abstract syntax tree corresponding to the code under test is parsed to obtain and store the relationships between various ONEUI components in the software under test; and / or,
[0149] For each WIDGETID component, retrieve the dependencies between that component and other components set when that component was created;
[0150] Based on the dependencies between each component and other components, the association relationships between each component in the software under test are obtained and stored.
[0151] In one embodiment of this disclosure, the page to be tested determination module 1030 is used to match the component combinations contained in each page of the minimum page set covering all component combinations with the updated component and the associated component to obtain the page to be tested.
[0152] In one embodiment of this disclosure, such as Figure 11 As shown, in Figure 10 Based on the device shown, it may also include:
[0153] The evaluation report generation module 1140 is used to generate an impact assessment report of the updated components in the software under test based on the page to be tested; the evaluation report includes: information of the updated components, information of the associated components, and information of the page to be tested.
[0154] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0155] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0156] Figure 12 A schematic block diagram of an example electronic device 1200 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0157] like Figure 12 As shown, device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1202 or a computer program loaded from storage unit 1208 into random access memory (RAM) 1203. The RAM 1203 may also store various programs and data required for the operation of device 1200. The computing unit 1201, ROM 1202, and RAM 1203 are interconnected via bus 1204. Input / output (I / O) interface 1205 is also connected to bus 1204.
[0158] Multiple components in device 1200 are connected to I / O interface 1205, including: input unit 1206, such as keyboard, mouse, etc.; output unit 1207, such as various types of monitors, speakers, etc.; storage unit 1208, such as disk, optical disk, etc.; and communication unit 1209, such as network card, modem, wireless transceiver, etc. Communication unit 1209 allows device 1200 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0159] The computing unit 1201 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1201 performs the various methods and processes described above, such as the method for determining the scope of software testing. For example, in some embodiments, the method for determining the scope of software testing may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1208. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1200 via ROM 1202 and / or communication unit 1209. When the computer program is loaded into RAM 1203 and executed by the computing unit 1201, one or more steps of the method for determining the scope of software testing described above may be performed. Alternatively, in other embodiments, the computing unit 1201 may be configured by any other suitable means (e.g., by means of firmware) to perform a method for determining the scope of software testing.
[0160] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0161] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0162] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0163] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0164] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0165] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0166] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0167] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for determining the scope of software testing, comprising: Retrieve the updated components that have been updated in the software under test; Based on the pre-stored component association relationships in the software under test, determine the associated components that are associated with the updated component; Based on the updated component, the associated component, and the minimum set of pages covering all component combinations in the pre-stored software under test, the test pages of the software under test are determined. The component combination refers to the combination of various components covered by the same page of the software under test. The minimum set of pages covering all component combinations is obtained in advance using the following steps: Obtain the correspondence between pages and components in the software under test; Based on the correspondence between the pages and components, the page that covers the most components will be selected as the candidate page; For pages other than the candidate pages, repeat the step of selecting the page that covers the most components as the candidate page based on the correspondence between the page and the components, until each candidate page covers all component combinations. All candidate pages obtained are stored as a minimal set of pages covering all component combinations.
2. The method according to claim 1, wherein, The step of obtaining the correspondence between pages and components in the software under test includes: Obtain the test code of the software to be tested; Perform Babel parsing on the code to be tested to obtain the abstract syntax tree corresponding to the code to be tested; The abstract syntax tree is traversed and parsed using Babel to obtain and store the correspondence between pages and components in the code to be tested.
3. The method according to claim 2, wherein, The component relationships are obtained in advance using the following steps: The abstract syntax tree corresponding to the code to be tested is parsed to obtain the relationship between each ONEUI component in the software to be tested and stored. And / or, For each WIDGETID component, retrieve the dependencies between that component and other components set when that component was created; Based on the dependencies between each component and other components, the association relationships between each component in the software under test are obtained and stored.
4. The method according to claim 1, wherein, The step of obtaining the correspondence between pages and components in the software under test includes: Retrieve the pre-stored mapping between pages and components from the business system database.
5. The method according to claim 1, wherein, The step of determining the test pages of the software under test based on the updated component, the associated component, and the minimum set of pages covering all component combinations in the pre-stored software under test includes: The component combinations contained in each page of the minimum page set covering all component combinations are matched with the updated component and the associated component to obtain the page to be tested.
6. The method according to claim 1, further comprising: Based on the page to be tested, generate an impact assessment report of the updated components in the software to be tested; The evaluation report includes: the updated component information, the associated component information, and the page to be tested information.
7. A device for determining the scope of software testing, comprising: The update component acquisition module is used to acquire the update components that have been updated in the software under test; The associated component acquisition module is used to determine the associated components associated with the updated component based on the pre-stored component association relationships in the software to be tested; The test page determination module is used to determine the test page of the software under test based on the updated component, the associated component, and the minimum set of pages covering all component combinations in the pre-stored software under test. The component combination is a combination of various components covered by the same page of the software under test. The device further includes a construction module, which is used for: Obtain the correspondence between pages and components in the software under test; Based on the correspondence between the pages and components, the page that covers the most components will be selected as the candidate page; For pages other than the candidate pages, repeat the step of selecting the page that covers the most components as the candidate page based on the correspondence between the page and the components, until each candidate page covers all component combinations. All candidate pages obtained are stored as a minimal set of pages covering all component combinations.
8. The apparatus according to claim 7, wherein, The process of obtaining the correspondence between pages and components in the software under test includes: Obtain the test code of the software to be tested; Perform Babel parsing on the code to be tested to obtain the abstract syntax tree corresponding to the code to be tested; The abstract syntax tree is traversed and parsed using Babel to obtain and store the correspondence between pages and components in the code to be tested.
9. The apparatus according to claim 8, wherein, The component relationships are obtained in advance using the following steps: The abstract syntax tree corresponding to the code to be tested is parsed to obtain the relationship between each ONEUI component in the software to be tested and stored. And / or, For each WIDGETID component, retrieve the dependencies between that component and other components set when that component was created; Based on the dependencies between each component and other components, the association relationships between each component in the software under test are obtained and stored.
10. The apparatus according to claim 7, wherein, The process of obtaining the correspondence between pages and components in the software under test includes: Retrieve the pre-stored mapping between pages and components from the business system database.
11. The apparatus according to claim 7, wherein, The page to be tested determination module is used to match the component combinations contained in each page of the minimum page set covering all component combinations with the updated component and the associated component to obtain the page to be tested.
12. The apparatus according to claim 7, further comprising: The evaluation report generation module is used to generate an impact assessment report of the updated components in the software under test based on the page to be tested. The evaluation report includes: the updated component information, the associated component information, and the page to be tested information.
13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.
15. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.
Citation Information
Patent Citations
To-be-tested front-end page determination method and device, storage medium and electronic equipment
CN112596738A