CN117435472A - Page test method, device, equipment and medium - Google Patents

Page test method, device, equipment and medium Download PDF

Info

Publication number
CN117435472A
CN117435472A CN202311201641.9A CN202311201641A CN117435472A CN 117435472 A CN117435472 A CN 117435472A CN 202311201641 A CN202311201641 A CN 202311201641A CN 117435472 A CN117435472 A CN 117435472A
Authority
CN
China
Prior art keywords
information
source code
page
code file
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311201641.9A
Other languages
Chinese (zh)
Inventor
侯文龙
刘孟昕
任瑜平
敦宏程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202311201641.9A priority Critical patent/CN117435472A/en
Publication of CN117435472A publication Critical patent/CN117435472A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure provides a page test method, which can be applied to the technical field of software test and the technical field of finance. The page testing method comprises the following steps: responding to a page test operation executed in a preset test scene, and acquiring identification information of a target page and page component change information of the target page; the page component change information characterizes the change information of different page components in the loading process of the target page under a preset test scene; obtaining first source code file information corresponding to a target page component by analyzing page component change information; obtaining information of a target difference source code file from the second source code file information according to the identification information of the target page; and generating a test result according to the information of the first source code file and the information of the target difference source code file. The disclosure also provides a page testing device, equipment and a storage medium.

Description

Page test method, device, equipment and medium
Technical Field
The present disclosure relates to the field of software testing technology and the field of financial technology, and in particular, to a page testing method, apparatus, device, and medium.
Background
Along with the development of the front-end single-page application development mode and the deepening application of the front-end and rear-end separation mode, the multi-page development mode is gradually changed into a single-page mode, and in the single-page mode, in order to facilitate maintenance, a component is generally selected to serve as a program file to be managed, and a development tool can package and compile all front-end codes in a project.
In the process of realizing the conception of the present disclosure, the inventor finds that in the related art, in the process of packaging and compiling the front-end codes, a development tool compresses, optimizes, merges and the codes, so that the program code structure after the packaging and compiling process and the original project source code lose a one-to-one comparison relation, so that when a user tests a certain function by clicking a page, the user cannot identify which front-end component source code corresponding to the page, the source code covered by the testing process is difficult to determine, and the testing accuracy is low.
Disclosure of Invention
In view of the above, the present disclosure provides a page testing method, apparatus, device, and medium.
According to a first aspect of the present disclosure, there is provided a page testing method, including:
responding to a page test operation executed in a preset test scene, and acquiring identification information of a target page and page component change information of the target page; the page component change information characterizes change information of different page components in the target page loading process under the preset test scene;
Obtaining first source code file information corresponding to a target page component by analyzing the page component change information;
obtaining information of a target difference source code file from second source code file information according to the identification information of the target page, wherein the second source code file information represents information of a difference source code file of a page program of a new version relative to a page program of an old version; and
and generating a test result according to the first source code file information and the information of the target difference source code file, wherein the test result represents the ratio of the target difference source code file to the coverage test.
According to an embodiment of the present disclosure, the obtaining, by analyzing the page component change information, first source code file information corresponding to a target page component includes:
according to the page component change information, determining name information of a target page component which changes in the loading process of the target page; and
and inquiring the first source code file information according to the name information.
According to an embodiment of the present disclosure, the querying the first source code file information according to the name information includes:
Determining a target storage path of a source code file corresponding to the target page component from page configuration information according to the name information; and
and inquiring the first source code file information from a source code library according to the target storage path.
According to an embodiment of the present disclosure, a page test method further includes:
respectively acquiring the source code file information of the page program of the new version and the source code file information of the page program of the old version from a source code library;
and comparing the difference between the source code file information of the page program of the new version and the source code file information of the page program of the old version to obtain the second source code file information.
According to an embodiment of the present disclosure, the generating a test result according to the first source code file information and the information of the target difference source code file includes:
obtaining a first quantity by comparing the first source code file information with the information of the target difference source code file, wherein the first quantity represents the same file quantity of the information of the target difference source code file as the first source code file information; and
And generating the test result according to the first number and the number of the target difference source code files.
According to an embodiment of the present disclosure, a page test method further includes:
according to the test result, obtaining the information of the source code file which is not covered by the test;
obtaining information of a supplementary test scene according to the information of the source code file which is not covered by the test and the history test record;
and under the supplementary test scene, carrying out supplementary test on the target page.
According to an embodiment of the present disclosure, the obtaining the information of the supplemental test scenario according to the information of the source code file of the uncovered test and the history test record includes:
determining information of a plurality of history source code files of a plurality of covered tests corresponding to a plurality of history test scenes according to the history test records;
obtaining a third number of the source code files under test included in the plurality of historical source code files according to the information of the source code files under test and the information of the plurality of historical source code files; and
and determining the information of the supplementary test scenes from the plurality of historical test scenes according to the third quantity.
A second aspect of the present disclosure provides a page testing apparatus, comprising: the device comprises an acquisition module, an analysis module, an acquisition module and a generation module. Wherein the method comprises the steps of
The first acquisition module is used for responding to the page test operation executed in the preset test scene and acquiring the identification information of the target page and the page component change information of the target page; the page component change information characterizes change information of different page components in the target page loading process under the preset test scene;
the analysis module is used for obtaining first source code file information corresponding to the target page component by analyzing the page component change information;
the obtaining module is used for obtaining information of a target difference source code file from second source code file information according to the identification information of the target page, wherein the second source code file information represents information of a difference source code file of a page program of a new version relative to a page program of an old version; and
and the generating module is used for generating a test result according to the first source code file information and the information of the target difference source code file, wherein the test result represents the ratio of the coverage test of the target difference source code file.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the page test method described above.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described page test method.
According to the page testing method, the device, the equipment and the medium, the identification information of the target page and the page component change information of the target page are obtained by responding to the page testing operation executed under the preset testing scene; the page component change information characterizes the change information of different page components in the loading process of the target page under a preset test scene; then, the first source code file information corresponding to the target page component is obtained by analyzing the page component change information; obtaining information of a target difference source code file from second source code file information according to the identification information of the target page, wherein the second source code file information represents information of the difference source code file of the page program of the new version relative to the page program of the old version; and finally, generating a test result according to the information of the first source code file and the information of the target difference source code file, wherein the test result represents the ratio of the coverage test of the target difference source code file. And analyzing the acquired identification information and page component change information of the page to obtain first source code file information and target difference source code information corresponding to the target page, and generating a test result according to the ratio of the first source code file information to the target difference source code information. According to the first source code file information and the target difference source code information, source code file information covered by the testing process can be determined, and therefore accuracy of testing results is improved.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be more apparent from the following description of embodiments of the disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of a page testing method according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a page testing method according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a flow chart of determining a supplemental test scenario in accordance with an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart of a resulting supplemental test scenario according to yet another embodiment of the present disclosure;
FIG. 5 schematically illustrates a block architecture diagram of a page test method according to an embodiment of the present disclosure;
FIG. 6 schematically illustrates a block diagram of a page testing apparatus according to an embodiment of the present disclosure; and
fig. 7 schematically illustrates a block diagram of an electronic device adapted to implement a page testing method according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
In the technical scheme of the invention, the related user information (including but not limited to user personal information, user image information, user equipment information, such as position information and the like) and data (including but not limited to data for analysis, stored data, displayed data and the like) are information and data authorized by a user or fully authorized by all parties, and the processing of the related data such as collection, storage, use, processing, transmission, provision, disclosure, application and the like are all conducted according to the related laws and regulations and standards of related countries and regions, necessary security measures are adopted, no prejudice to the public welfare is provided, and corresponding operation inlets are provided for the user to select authorization or rejection.
In the process of realizing the method, it is found that in the single-page development mode, most of developers write functional codes based on components as granularity in the single-component development process, for the developers, decoupling of functional modules with finer granularity is realized, function change and maintenance are more convenient, and the efficiency of code development and adjustment is improved, but for testers, because the program code structure after the packaging compiling process and the original project source code lose a one-to-one comparison relationship, the test time consumption is longer and the test accuracy is not high.
In view of this, an embodiment of the present disclosure provides a method for controlling a state of an application instance, including: responding to a page test operation executed in a preset test scene, and acquiring identification information of a target page and page component change information of the target page; the page component change information characterizes the change information of different page components in the loading process of the target page under a preset test scene; obtaining first source code file information corresponding to a target page component by analyzing page component change information; obtaining information of a target difference source code file from second source code file information according to the identification information of the target page, wherein the second source code file information represents information of the difference source code file of the page program of the new version relative to the page program of the old version; and generating a test result according to the first source code file information and the information of the target difference source code file, wherein the test result represents the ratio of the coverage test of the target difference source code file.
Fig. 1 schematically illustrates an application scenario diagram of page testing according to an embodiment of the present disclosure.
As shown in fig. 1, an application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is a medium used to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 through the network 104 using at least one of the first terminal device 101, the second terminal device 102, the third terminal device 103, to receive or send messages, etc. Various communication client applications, such as a shopping class application, a web browser application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only) may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
The first terminal device 101, the second terminal device 102, the third terminal device 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the page testing method provided by the embodiments of the present disclosure may be generally performed by the server 105. Accordingly, the page testing apparatus provided by the embodiments of the present disclosure may be generally disposed in the server 105. The page testing method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105. Accordingly, the page testing apparatus provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The page test method of the disclosed embodiment will be described in detail below with reference to fig. 2 to 5 based on the scenario described in fig. 1.
Fig. 2 schematically illustrates a flow chart of a page testing method according to an embodiment of the disclosure.
As shown in fig. 2, the page test method of this embodiment includes operations S210 to S240.
In operation S210, identification information of a target page and page component change information of the target page are acquired in response to a page test operation performed in a predetermined test scenario.
According to embodiments of the present disclosure, a user may register and maintain a test scenario, and a predetermined test scenario may characterize a test scenario that the user selects to be tested, for example, a transaction scenario or a verification scenario based on a User Interface (UI) test.
According to embodiments of the present disclosure, a target page may characterize a page under test, and a target page identification may characterize a page identification of the page under test.
According to the embodiment of the disclosure, the page component change information of the target page can represent change information of different page components in the loading process of the target page under a preset test scene, for example, when the page is refreshed, a date component appears, and a text input component disappears.
In operation S220, first source code file information corresponding to the target page component is obtained by parsing the page component change information.
According to the embodiment of the disclosure, the first source code file information can find a target storage path of a source code file corresponding to the target page component in the configuration information through the component name, and then find the source code file according to the target storage path of the target source code file, so as to determine the first source code file information.
In operation S230, information of the target differential source code file is obtained from the second source code file information according to the identification information of the target page.
According to embodiments of the present disclosure, the second source code file information may characterize information of a differential source code file of the page program of the new version relative to the page program of the old version.
In operation S240, a test result is generated according to the first source code file information and the information of the target differential source code file.
According to embodiments of the present disclosure, test results may characterize the proportion of the target differential source code file that is covered by the test.
According to the embodiment of the disclosure, the identification information of the target page and the page component change information of the target page are acquired by responding to the page test operation executed under the preset test scene; the page component change information characterizes the change information of different page components in the loading process of the target page under a preset test scene; then, the first source code file information corresponding to the target page component is obtained by analyzing the page component change information; obtaining information of a target difference source code file from second source code file information according to the identification information of the target page, wherein the second source code file information represents information of the difference source code file of the page program of the new version relative to the page program of the old version; and finally, generating a test result according to the information of the first source code file and the information of the target difference source code file, wherein the test result represents the ratio of the coverage test of the target difference source code file. And analyzing the acquired identification information and page component change information of the page to obtain first source code file information and target difference source code information corresponding to the target page, and generating a test result according to the ratio of the first source code file information to the target difference source code information. According to the first source code file information and the target difference source code information, source code file information covered by the testing process can be determined, and therefore accuracy of testing results is improved.
According to an embodiment of the present disclosure, obtaining first source code file information corresponding to a target page component by parsing page component change information includes: according to the page component change information, determining name information of a target page component which changes in the loading process of the target page; and inquiring the first source code file information according to the name information.
According to embodiments of the present disclosure, the name information of the target page component may be a date component, a text entry component, a navigation component, and so forth.
According to the embodiment of the disclosure, a plurality of components with changed target page refreshing and loading processes can be provided, source code file information corresponding to each component name is queried according to each component name, and each source code is connected together to form first source code file information.
For example, when the date component and the text input component in the refreshing and loading process of the target page change and the source code file information A corresponding to the date component and the source code file information B corresponding to the text input component are queried according to the component name date component and the text input component, the first source code file information comprises the source code file information A and the source code file information B.
According to the embodiment of the disclosure, the first source code file information can represent the source code information corresponding to the change component, so that the problem that the source code information and the page cannot be in one-to-one correspondence is solved, and the accuracy of the test can be ensured.
According to an embodiment of the present disclosure, the first source code file information may be queried according to name information, including: determining a target storage path of the source code file corresponding to the target page component from the page configuration information according to the name information; and inquiring the first source code file information from the source code library according to the target storage path.
For example: the component name information may be a date component, and the target storage path of the source code file corresponding to the date component may be determined to be a date component storage path C through configuration information, then the first source code file information C corresponding to the date component is queried from the source code according to the date component storage path C, and the whole flow of querying the first source code file information corresponding to the date component according to the date component is that the date component- > the date component storage path C- > the first source code file information C.
According to the embodiment of the disclosure, the component name information is used for inquiring the first source code file information corresponding to the component name, so that the component name can be corresponding to the source code file information, and the accuracy of the test can be ensured.
According to the embodiment of the disclosure, source code file information of a page program of a new version and source code file information of a page program of an old version are respectively obtained from a source code library; and obtaining second source code file information by comparing the difference between the source code file information of the page program of the new version and the source code file information of the page program of the old version.
For example: the source code file of the new version of the page program may include: source code file information f, source code file information g, source code file information h, and source code file information i; the source code file of the old version of the page program may include: the source code file information g, the source code file information h, the source code file information j and the source code file information k may be the source code file information f, the source code file information g, the source code file information h, the source code file information i, the source code file information j and the source code file information k.
According to the embodiment of the disclosure, the range of the version change source code change can be determined through the second source code file information, so that the ratio of the information of the source code file passing through the coverage test to the information of the second source code file can be conveniently determined.
According to an embodiment of the present disclosure, generating a test result according to first source code file information and information of a target difference source code file includes: obtaining a first quantity by comparing the first source code file information with the information of the target difference source code file; and generating a test result according to the first number and the number of the target difference source code files.
According to embodiments of the present disclosure, the first number may characterize a number of files of which information of the target differential source code file is the same as the first source code file information.
For example: the first source code file information is source code file information f and source code file information i; the information of the target difference source code file is source code file information f, source code file information i, source code file information j and source code file information k, the first number is 2, and the generated test result is 50% according to the first number and the number of the target difference source code file.
According to the embodiment of the disclosure, the coverage rate of the test can be determined according to the ratio of the first number and the number of the target difference source code files, and the accuracy of the test can be further ensured.
Fig. 3 schematically illustrates a flow chart of acquiring a supplemental test scenario in accordance with an embodiment of the present disclosure.
As shown in fig. 3, the flowchart of determining the supplementary test scenario includes operations S310 to S370.
In operation S310, identification information of a target page and page component change information of the target page are acquired in response to a page test operation performed in a predetermined test scenario.
According to embodiments of the present disclosure, a user may register and maintain a test scenario, and a predetermined test scenario may characterize a test scenario that the user selects to be tested, for example, a transaction scenario or a verification scenario based on a User Interface (UI) Interface test.
According to embodiments of the present disclosure, a target page may characterize a page being tested, and a target page identification may characterize a page identification of the page being tested.
According to the embodiment of the disclosure, the page component change information of the target page can represent change information of different page components in the loading process of the target page under a preset test scene, for example, when the page is refreshed, a date component appears, and a text input component disappears.
In operation S320, first source code file information corresponding to the target page component is obtained by parsing the page component change information.
According to the embodiment of the disclosure, the first source code file information can find a target storage path of a source code file corresponding to the target page component in the configuration information through the component name, find the source code file according to the target storage path of the target source code file, and determine the source code file covered by the change of the test component.
In operation S330, information of the target differential source code file is obtained from the second source code file information according to the identification information of the target page.
According to embodiments of the present disclosure, the second source code file information may characterize information of a differential source code file of the page program of the new version relative to the page program of the old version.
In operation S340, a test result is generated according to the first source code file information and the information of the target differential source code file.
According to embodiments of the present disclosure, test results may characterize the proportion of the target differential source code file that is covered by the test.
In operation S350, information of the source code file not covered by the test is obtained according to the test result.
According to an embodiment of the present disclosure, the first source code file and the source code file not under-tested together constitute a source code file.
In operation S360, the information of the supplementary test scenario is obtained according to the information of the source code file of the uncovered test and the history test record.
According to embodiments of the present disclosure, the history test record may characterize tests performed prior to the present test, such as a verification test of history test scenario 1 and a login test of history test scenario 2.
According to an embodiment of the present disclosure, it is determined that the information of the source code file not covered by the test is the most identical information among the plurality of historical test scenes, and the information of the historical test scenes is considered as the information of the supplementary test scenes.
In operation S370, in a supplementary test scenario, a supplementary test is performed on the target page.
According to the embodiment of the disclosure, according to the first source code file information, the test scenes which can cover the source code files are queried from the historical scene test and used as the supplementary test scenes, and the supplementary test is performed, so that the efficiency of the supplementary test can be improved, and the accuracy of the test can be further improved.
Fig. 4 schematically illustrates a flow chart of a resulting supplemental test scenario according to yet another embodiment of the present disclosure.
As shown in fig. 4, the historical source code files F1"3405" corresponding to the historical test scene 1"3401", the historical source code files F2"3406" corresponding to the historical test scene 2"3402" and the historical source code files F3"3407" corresponding to the historical test scene 3"3403" are respectively compared with the source code files F0"3404" of the uncovered test, the number S1"3408" of F0 contained in the F1 is determined, the number S2"3409" of F0 contained in the F2 is determined, and the number S3"3410" of F0 contained in the F3 is determined, and the historical test scene 1"3401" is determined as the supplementary test scene "3411" under the condition that S1 > S2 > S3 is satisfied.
For example, the historical source code file F1"3405" corresponding to the historical test scenario 1"3401" includes a, b, c, d and e, the historical source code file F2"3406" corresponding to the historical test scenario 2"3402" includes b, c, F and h, the historical source code file F3"3407" corresponding to the historical test scenario 3"3403" includes g, l, m and n and the source code file F0"3404" not covered by the test "a, b and c are respectively compared, the number S1"3408 "of F1 containing F0 is determined to be 3, the number S2"3409 "of F2 containing F0 is determined to be 2, and the number S3"3410 "of F3 containing F0 is determined to be 0, and thus, S1 > S2 > S3 determines the historical test scenario 1"3401 "as the supplementary test scenario" 3411".
According to an embodiment of the present disclosure, obtaining information of a supplemental test scenario from information of an uncovered test source code file and a historical test record includes: determining information of a plurality of historical source code files of a plurality of covered tests corresponding to a plurality of historical test scenes according to the historical test records; obtaining a third number of uncovered tested source code files contained in the plurality of historical source code files according to the information of the uncovered tested source code files and the information of the plurality of historical source code files; and determining information of the supplemental test scenario from the plurality of historical test scenarios according to the third quantity.
According to the embodiment of the disclosure, the recommendation of the supplementary test scene can be made from the historical test scenes by determining the maximum value of the third quantity, so that the test scenes can be accurately recommended, and the test efficiency is improved.
Fig. 5 schematically illustrates a block architecture diagram of a page test method according to an embodiment of the present disclosure.
As shown in fig. 5, in 500, the test scenario maintenance module 510 may enable a user to register and maintain a test scenario, support the user to select a test scenario to be executed, select a test scenario to be executed by the user, click to start a test, the test scenario maintenance module 510 automatically invokes the start test interface skip monitor module 520, and transmits a test scenario name of the test execution to the test interface skip monitor module 520, when the test scenario execution is finished, the user clicks a complete test button, the test scenario maintenance module 510 automatically closes the test interface skip monitor module 520, and simultaneously acquires a list of overlay test source code component names recorded in the execution process from the test interface skip monitor module 520.
The test interface skip monitoring module 520 may monitor the skip of the page, when the page is skip refreshed, automatically capture the identification information of the page and the change information of the page component, and call the skip information analyzing module 530 to obtain the source code component name corresponding to the skip refresh of the page, record the component name information related to the test execution process, and finally form the source program component name covered by the test.
The skip information parsing module 530 may parse the page component change information of the target page and determine the component name and the target storage path of the source code file corresponding to the target page component.
The program front end source code file difference comparison module 540 can realize comparison of new and old version source code file change differences, and binary comparison is performed based on old version source code file content and new version source code file to form a changed source code file name list.
The front end source program coverage analysis module 550 may implement the comparison of the information of the test coverage source code file with the target difference source code file, to obtain the information of the source code file that is not covered by the test and the test result.
The uncovered front end source code test scene recommendation module 560 can compare the information of the historical source code files with the uncovered tested source code files to obtain a third number, and determine the supplementary test scenes according to the third number.
Based on the page testing method, the disclosure also provides a page testing device. The device will be described in detail below in connection with fig. 6.
Fig. 6 schematically shows a block diagram of a structure of a page test apparatus according to an embodiment of the present disclosure.
As shown in fig. 6, the page testing apparatus 600 of this embodiment includes a first obtaining module 610, a parsing module 620, an obtaining module 630, and a generating module 640.
The first obtaining module 610 is configured to obtain, in response to a page test operation performed in a predetermined test scenario, identification information of a target page and page component change information of the target page; the page component change information characterizes change information of different page components in a target page loading process under a preset test scene. In an embodiment, the first obtaining module 610 may be configured to perform the operation S210 described above, which is not described herein.
The parsing module 620 is configured to obtain first source code file information corresponding to the target page component by parsing the page component change information. In an embodiment, the parsing module 620 may be configured to perform the operation S220 described above, which is not described herein.
The obtaining module 630 is configured to obtain information of a target differential source code file from second source code file information according to the identification information of the target page, where the second source code file information characterizes information of a differential source code file of a page program of a new version relative to a page program of an old version. In an embodiment, the obtaining module 630 may be configured to perform the operation S230 described above, which is not described herein.
The generating module 640 is configured to generate a test result according to the first source code file information and the information of the target difference source code file, where the test result characterizes a ratio of the target difference source code file to the coverage test. In an embodiment, the generating module 640 may be configured to perform the operation S240 described above, which is not described herein.
According to an embodiment of the present disclosure, the parsing module 620 for obtaining first source code file information corresponding to a target page component by parsing page component change information includes:
the first analysis sub-module is used for determining the name information of the target page component which changes in the loading process of the target page according to the page component change information.
And the second analysis sub-module is used for inquiring the information of the first source code file according to the name information.
According to an embodiment of the present disclosure, a second parsing sub-module for querying first source code file information according to name information includes:
and the first analysis unit is used for determining a target storage path of the source code file corresponding to the target page component from the page configuration information according to the name information.
And the second analysis unit is used for inquiring the first source code file information from the source code library according to the target storage path.
According to an embodiment of the present disclosure, the above page test method further includes:
and the second acquisition module is used for respectively acquiring the source code file information of the page program of the new version and the source code file information of the page program of the old version from the source code library.
The first obtaining module is used for obtaining second source code file information by comparing the difference between the source code file information of the page program in the new version and the source code file information of the page program in the old version.
According to an embodiment of the present disclosure, the generating module 640 for generating a test result according to the first source code file information and the information of the target difference source code file includes:
the first generation sub-module is used for obtaining a first quantity by comparing the information of the first source code file and the information of the target difference source code file.
And the second generation sub-module is used for generating a test result according to the first number and the number of the target difference source code files.
According to an embodiment of the present disclosure, the above page test method further includes:
and the second obtaining module is used for obtaining the information of the source code file which is not covered by the test according to the test result.
And the third obtaining module is used for obtaining the information of the supplementary test scene according to the information of the source code file which is not covered by the test and the history test record.
And the execution module is used for executing the supplementary test on the target page under the supplementary test scene.
According to an embodiment of the present disclosure, the third obtaining module for obtaining information of a supplemental test scenario according to information of an uncovered tested source code file and a historical test record includes:
and the first obtaining submodule is used for determining information of a plurality of historical source code files of a plurality of covered tests corresponding to a plurality of historical test scenes according to the historical test records.
And the second obtaining submodule is used for obtaining a third number of the source code files which are not covered by the test and are contained in the historical source code files according to the information of the source code files which are not covered by the test and the information of the historical source code files.
And a third obtaining sub-module, configured to determine, according to the third number, information of a supplemental test scenario from the plurality of historical test scenarios.
Any of the first acquisition module 610, the parsing module 620, the obtaining module 630, and the generating module 640 may be combined in one module to be implemented, or any of the modules may be split into a plurality of modules according to an embodiment of the present disclosure. Alternatively, at least some of the functionality of one or more of the modules may be combined with at least some of the functionality of other modules and implemented in one module. According to embodiments of the present disclosure, at least one of the first acquisition module 610, the parsing module 620, the obtaining module 630, and the generating module 640 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable way of integrating or packaging the circuitry, or in any one of or a suitable combination of any of the three implementations of software, hardware, and firmware. Alternatively, at least one of the first acquisition module 610, the parsing module 620, the obtaining module 630, and the generating module 640 may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
Fig. 7 schematically illustrates a block diagram of an electronic device adapted to implement a page testing method according to an embodiment of the disclosure.
As shown in fig. 7, an electronic device 700 according to an embodiment of the present disclosure includes a processor 701 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. The processor 701 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. The processor 701 may also include on-board memory for caching purposes. The processor 701 may comprise a single processing unit or a plurality of processing units for performing different actions of the method flows according to embodiments of the disclosure.
In the RAM 703, various programs and data necessary for the operation of the electronic apparatus 700 are stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. The processor 701 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 702 and/or the RAM 703. Note that the program may be stored in one or more memories other than the ROM 702 and the RAM 703. The processor 701 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, the electronic device 700 may further include an input/output (I/O) interface 705, the input/output (I/O) interface 705 also being connected to the bus 704. The electronic device 700 may also include one or more of the following components connected to the I/O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output portion 707 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 708 including a hard disk or the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. The drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read therefrom is mounted into the storage section 708 as necessary.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 702 and/or RAM 703 and/or one or more memories other than ROM 702 and RAM 703 described above.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 701. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed over a network medium in the form of signals, downloaded and installed via the communication section 709, and/or installed from the removable medium 711. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 709, and/or installed from the removable medium 71 1. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 701. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems and methods according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be provided in a variety of combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (10)

1. A method of page testing, comprising:
responding to a page test operation executed in a preset test scene, and acquiring identification information of a target page and page component change information of the target page; the page component change information characterizes change information of different page components in the target page loading process under the preset test scene;
obtaining first source code file information corresponding to a target page component by analyzing the page component change information;
obtaining information of a target difference source code file from second source code file information according to the identification information of the target page, wherein the second source code file information represents information of a difference source code file of a page program of a new version relative to a page program of an old version; and
And generating a test result according to the information of the first source code file and the information of the target difference source code file, wherein the test result represents the ratio of the coverage test of the target difference source code file.
2. The method of claim 1, wherein the obtaining the first source code file information corresponding to the target page component by parsing the page component change information includes:
according to the page component change information, determining name information of a target page component which changes in the loading process of the target page; and
and inquiring the first source code file information according to the name information.
3. The method of claim 2, wherein the querying the first source code file information according to the name information comprises:
determining a target storage path of the source code file corresponding to the target page component from page configuration information according to the name information; and
and inquiring the first source code file information from a source code library according to the target storage path.
4. The method of claim 1, further comprising:
respectively acquiring source code file information of the page program of the new version and source code file information of the page program of the old version from a source code library;
And comparing the difference between the source code file information of the page program of the new version and the source code file information of the page program of the old version to obtain the second source code file information.
5. The method of claim 1, wherein the generating a test result from the first source code file information and the information of the target differential source code file comprises:
obtaining a first quantity by comparing the first source code file information with the information of the target difference source code file, wherein the first quantity represents the same file quantity of the information of the target difference source code file as the first source code file information; and
and generating the test result according to the first number and the number of the target difference source code files.
6. The method of claim 1, further comprising:
according to the test result, obtaining the information of the source code file which is not covered by the test;
obtaining information of a supplementary test scene according to the information of the source code file which is not covered by the test and the history test record;
and under the supplementary test scene, carrying out supplementary test on the target page.
7. The method of claim 6, wherein the obtaining the information of the supplemental test scenario from the information of the source code file of the uncovered test and the historical test record comprises:
determining information of a plurality of history source code files of a plurality of covered tests corresponding to a plurality of history test scenes according to the history test records;
obtaining a third number of the source code files which are not covered and are contained in the historical source code files according to the information of the source code files which are not covered and tested and the information of the historical source code files; and
and determining information of the supplementary test scenes from the plurality of historical test scenes according to the third quantity.
8. A page testing apparatus, comprising:
the acquisition module is used for responding to the page test operation executed in the preset test scene and acquiring the identification information of the target page and the page component change information of the target page; the page component change information characterizes change information of different page components in the target page loading process under the preset test scene;
the analysis module is used for obtaining first source code file information corresponding to the target page component by analyzing the page component change information;
The obtaining module is used for obtaining information of a target difference source code file from second source code file information according to the identification information of the target page, wherein the second source code file information represents information of a difference source code file of a page program of a new version relative to a page program of an old version; and
and the generating module is used for generating a test result according to the information of the first source code file and the information of the target difference source code file, wherein the test result represents the ratio of the coverage test of the target difference source code file.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-7.
10. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method according to any of claims 1-7.
CN202311201641.9A 2023-09-18 2023-09-18 Page test method, device, equipment and medium Pending CN117435472A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311201641.9A CN117435472A (en) 2023-09-18 2023-09-18 Page test method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311201641.9A CN117435472A (en) 2023-09-18 2023-09-18 Page test method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN117435472A true CN117435472A (en) 2024-01-23

Family

ID=89546978

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311201641.9A Pending CN117435472A (en) 2023-09-18 2023-09-18 Page test method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN117435472A (en)

Similar Documents

Publication Publication Date Title
CN112463729B (en) Data file warehousing method and device, electronic equipment and medium
CN112597047A (en) Test method, test device, electronic equipment and computer readable medium
CN112860556A (en) Coverage rate statistical method, coverage rate statistical device, computer system and readable storage medium
CN113535577A (en) Application testing method and device based on knowledge graph, electronic equipment and medium
CN109542743B (en) Log checking method and device, electronic equipment and computer readable storage medium
CN116483888A (en) Program evaluation method and device, electronic equipment and computer readable storage medium
CN115080433A (en) Testing method and device based on flow playback
CN117435472A (en) Page test method, device, equipment and medium
CN115203178A (en) Data quality inspection method and device, electronic equipment and storage medium
CN108399223B (en) Data acquisition method and device and electronic equipment
CN114168607A (en) Global serial number generation method, device, equipment, medium and product
CN112596781A (en) Service execution and service configuration method and device
CN115629983A (en) Test case set generation method, device, equipment and medium
CN113360380B (en) Method and device for generating data case based on flow chart
CN117234910A (en) Information processing method, device, equipment and storage medium
CN117493207A (en) Page processing method, device, electronic equipment and storage medium
CN117009201A (en) Application cold start test method, device, equipment, medium and program product
CN116467214A (en) Code quality detection method, device, equipment and storage medium
CN114064484A (en) Interface testing method and device, electronic equipment and readable storage medium
CN115687083A (en) Business system testing method and device, electronic equipment and storage medium
CN118277204A (en) Data acquisition method, data acquisition device, electronic equipment, storage medium and program product
CN113360417A (en) Test method, session modifier, electronic device, and medium
CN115185798A (en) Data acquisition and analysis method and device, electronic equipment and storage medium
CN117493206A (en) Test data generation method, device, equipment and storage medium
CN117744043A (en) Code obfuscation method, apparatus, device, storage medium, and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination