CN114090418A - Page testing method and device - Google Patents

Page testing method and device Download PDF

Info

Publication number
CN114090418A
CN114090418A CN202011321433.9A CN202011321433A CN114090418A CN 114090418 A CN114090418 A CN 114090418A CN 202011321433 A CN202011321433 A CN 202011321433A CN 114090418 A CN114090418 A CN 114090418A
Authority
CN
China
Prior art keywords
target
file
page
engineering
page elements
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
CN202011321433.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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202011321433.9A priority Critical patent/CN114090418A/en
Publication of CN114090418A publication Critical patent/CN114090418A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

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 invention discloses a page testing method and device, and relates to the technical field of computers. One embodiment of the method comprises: acquiring a project source code, and determining a target project file according to the project source code; determining a target page element according to the target engineering file and the test script file; and updating the corresponding page elements in the test script file according to the target page elements, and executing the page test by using the updated test script file. The implementation mode realizes automatic page testing, reduces the testing cost, shortens the testing period and improves the testing accuracy and the testing effect.

Description

Page testing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a page testing method and device.
Background
In the UI (User Interface) automated test of a Native page (e.g., Android Native page, Android Native), the conventional method drives an automated test script through a page element. Firstly, capturing page element information (all attributes and specific values corresponding to the attributes) by using a mobile application test tool (such as an Appium) and maintaining the page element information in a specific file (usually in a java or xml format); and then calling page element information to compile a page test script, thereby realizing page test.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the existing page testing method has the disadvantages of low automation degree, high testing cost, long testing period, low testing accuracy and poor testing effect due to the fact that the testing script is manually updated.
Disclosure of Invention
In view of this, embodiments of the present invention provide a page testing method and apparatus, which can implement automatic update of a test script according to a target page element, implement automatic page testing, reduce testing cost, shorten testing period, and improve testing accuracy and testing effect.
In order to achieve the above object, according to a first aspect of the embodiments of the present invention, there is provided a page testing method, including:
acquiring a project source code, and determining a target project file according to the project source code;
determining a target page element according to the target engineering file and the test script file;
and updating the corresponding page elements in the test script file according to the target page elements, and executing the page test by using the updated test script file.
Further, determining a target project file according to the project source code, further comprising:
and traversing the engineering source code according to the code identification to determine a target engineering file.
Further, determining a target page element according to the target project file and the test script file, further comprising:
traversing the target engineering file, and screening page elements in the target engineering file;
comparing the page elements in the target engineering file with the page elements in the test script file to determine the target page elements, wherein the target page elements are page elements which execute at least one of the following operations in the target engineering file: delete, add, change.
Further, traversing the target engineering document, determining page elements in the target engineering document, and further comprising:
judging a file format corresponding to the target engineering file;
if the file format is java, performing reflection processing on the target engineering file to determine page elements in the target engineering file;
and if the file format is xml, analyzing the target engineering file to determine the page elements in the target engineering file.
Further, comparing the page elements in the target engineering file with the page elements in the test script file to determine the target page elements, further comprising:
and comparing the attributes of the page elements in the target engineering file with the attributes of the page elements in the test script file to determine the target page elements.
Further, still include: and comparing the attribute value of the page element in the target engineering file with the attribute value of the page element in the test script file so as to update the target page element.
Further, before the step of obtaining the engineering source code, the method further comprises: the code integration status is determined to be completed.
According to a second aspect of the embodiments of the present invention, there is provided a page testing apparatus, including:
the engineering source code acquisition module is used for acquiring engineering source codes and determining a target engineering file according to the engineering source codes;
the target page element determining module is used for determining target page elements according to the target engineering file and the test script file;
and the page testing module is used for updating the corresponding page elements in the test script file according to the target page elements and executing page testing by using the updated test script file.
According to a third aspect of embodiments of the present invention, there is provided an electronic apparatus, including:
one or more processors;
a storage device for storing one or more programs,
when executed by one or more processors, cause the one or more processors to implement any of the page testing methods described above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements any of the page testing methods described above.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of obtaining an engineering source code, and determining a target engineering file according to the engineering source code; determining a target page element according to the target engineering file and the test script file; according to the target page element, the corresponding page element in the test script file is updated, and the updated test script file is used for executing the page test, so that the technical problems of low automation degree of the page test, high test cost, long test period, low test accuracy and poor test effect caused by the fact that the test script is manually updated in the conventional page test method are solved, and the technical effects of realizing automatic update of the test script according to the target page element, further realizing automatic page test, reducing the test cost, shortening the test period and improving the test accuracy and the test effect are further achieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a page testing method according to a first embodiment of the present invention;
FIG. 2a is a schematic diagram of a main flow of a page testing method according to a second embodiment of the present invention;
FIG. 2b is a schematic diagram of a page element in the android native page in the method of FIG. 2 a;
FIG. 2c is a diagram illustrating the attributes and attribute values corresponding to the page elements in the method of FIG. 2 a;
FIG. 3 is a schematic diagram of main modules of a page testing apparatus according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a page testing method according to a first embodiment of the present invention; as shown in fig. 1, the page testing method provided by the embodiment of the present invention mainly includes:
and S101, acquiring a project source code, and determining a target project file according to the project source code.
Specifically, according to the embodiment of the present invention, the target page element is a page element that performs at least one of the following operations in the target project file: delete, add, change.
After the development team creates project, the project file is created and the relevant code is written under the project file. Through the setting, the engineering source code is obtained, the engineering file which executes any one or more of deletion, addition and change aiming at the page element is determined by scanning the engineering source code and is used as the target engineering file, the corresponding page element in the test script file is updated by comparing the page element stored in the test script file subsequently, and the updated test script file is used for carrying out automatic test on the page, so that the test accuracy and the test effect are improved, and the test period is shortened.
Further, according to an embodiment of the present invention, before the step of obtaining the engineering source code, the method further includes: the code integration status is determined to be completed.
According to the embodiment of the invention, in an agile development mode, in order to shorten the development period, a team is usually developed through integrated development, the development process not only involves scene change of a UI, but also changes attributes of page elements or specific values corresponding to the attributes (such as operations according to skill requirements, bug repair and the like) under the condition that the UI is not changed. And after the codes of the respective branches are submitted to the trunk and combined by each research and development personnel and are integrated, all the engineering source codes are obtained, and then the target engineering file is determined according to all the engineering source codes, so that repeated scanning work and corresponding conflict conditions caused by determining the target engineering file for each branch source code are avoided, the test cost is further reduced, and the test period is shortened.
Preferably, according to an embodiment of the present invention, the determining a target project file according to the project source code further includes:
and traversing the engineering source code according to the code identification to determine a target engineering file.
Specifically, according to embodiments of the present invention, page elements exist within the engineering files associated with the front-end page, independent of the engineering files associated with the back-end interface, configuration information, and underlying logic. Therefore, a code scanning tool (such as a sonar) can be adopted to set scanning conditions (such as setting code identification) and traverse the engineering source code according to the scanning conditions to determine the target engineering file, so that the testing cost is reduced.
And S102, determining target page elements according to the target engineering file and the test script file.
Specifically, according to the embodiment of the present invention, determining the target page element according to the target project file and the test script file further includes:
traversing the target engineering file, and screening page elements in the target engineering file;
and comparing the page elements in the target engineering file with the page elements in the test script file to determine the target page elements.
Through the setting, all target engineering files are traversed (page elements in the engineering files execute any one or more operations of modification, new addition and change in the research and development process, the engineering files comprise information such as logic codes, configuration information and page elements), all page element nodes in the engineering files are screened, the page elements are determined, the page elements comprise attributes and attribute values corresponding to the page elements, and then the page elements in the target engineering files are compared with the page elements stored in the test engineering files to determine the target page elements; and then the page elements stored in the test script file are updated according to the target page elements, so that the real-time performance and the accuracy of the page elements in the test script file are ensured, and the accuracy of page test and the page test effect are further improved.
Further, according to an embodiment of the present invention, traversing the target engineering document and determining the page elements in the target engineering document further includes:
judging a file format corresponding to the target engineering file;
if the file format is java, performing reflection processing on the target engineering file to determine page elements in the target engineering file;
and if the file format is xml, analyzing the target engineering file to determine the page elements in the target engineering file.
Through the setting, different processing modes are adopted according to different file formats, all information in the target engineering file can be dynamically acquired, and the situation that the determined page elements are incomplete and the page testing accuracy is reduced due to the fact that all information in the engineering file cannot be acquired is favorably avoided.
Preferably, according to the embodiment of the present invention, the comparing the page element in the target engineering file with the page element in the test script file to determine the target page element further includes:
and comparing the attributes of the page elements in the target engineering file with the attributes of the page elements in the test script file to determine the target page elements.
Specifically, according to the embodiment of the present invention, the page element includes attributes (for example, basic attributes of the Android Native page element include resource-id, class, text, xpath, etc.), and attribute values corresponding to the attributes. The page attribute changes, namely, the page element is subjected to addition and/or deletion operation; through the setting, the page elements of the target project file, which are subjected to the adding and/or deleting operation, can be determined.
Further, according to an embodiment of the present invention, the foregoing further includes: and comparing the attribute value of the page element in the target engineering file with the attribute value of the page element in the test script file so as to update the target page element.
According to the embodiment of the invention, the attribute value corresponding to the page attribute changes, namely, the page element is represented to execute the change operation; through the setting, the page elements of the target project file, which execute the change operation, can be determined.
And step S103, updating the corresponding page element in the test script file according to the target page element, and executing the page test by using the updated test script file.
According to the embodiment of the invention, the automated test is mainly realized by driving an automated test script through page elements. Through the setting, the test script file is updated through the updated page elements determined in the step, so that the instantaneity and accuracy of the page elements in the test script file are guaranteed, and the test accuracy and the test effect are improved.
According to the technical scheme of the embodiment of the invention, the engineering source code is obtained, and the target engineering file is determined according to the engineering source code; determining a target page element according to the target engineering file and the test script file; according to the target page element, the corresponding page element in the test script file is updated, and the updated test script file is used for executing the page test, so that the technical problems of low automation degree of the page test, high test cost, long test period, low test accuracy and poor test effect caused by the fact that the test script is manually updated in the conventional page test method are solved, and the technical effects of realizing automatic update of the test script according to the target page element, further realizing automatic page test, reducing the test cost, shortening the test period and improving the test accuracy and the test effect are further achieved.
FIG. 2a is a schematic diagram of a main flow of a page testing method according to a second embodiment of the present invention; an application scenario of the embodiment of the present invention is a method for testing an android native page, as shown in fig. 2a, the method for testing a page provided by the embodiment of the present invention mainly includes:
step S201, monitoring the status of submitted codes, and determining that the state of code integration is completed.
According to the embodiment of the invention, when the UI of the Android Native changes, the page element information also changes, and the automatic test executed by directly adopting the original test script file fails. In order to ensure that the automated test script can be executed, after the code integration and before the automated test is performed, the modified page elements need to be determined through the engineering source code, and then the page elements in the test script file are updated. Through the arrangement, each research and development personnel submits the codes of each branch to the trunk to be combined, after the codes are integrated, all the engineering source codes are obtained, and then the target engineering file is determined according to all the engineering source codes, so that repeated scanning work and corresponding conflict conditions caused by determining the target engineering file aiming at each branch source code are avoided, the testing cost is further reduced, and the testing period is shortened.
Step S202, acquiring an engineering source code, and traversing the engineering source code according to the code identification to determine a target engineering file; wherein, the target page element is a page element which executes at least one of the following operations in the target project file: delete, add, change.
Through the setting, the engineering source code is obtained, the engineering file which executes any one or more of deletion, addition and change aiming at the page element is determined by scanning the engineering source code and is used as the target engineering file, the corresponding page element in the test script file is updated by comparing the page element stored in the test script file subsequently, and the updated test script file is used for carrying out automatic test on the page, so that the test accuracy and the test effect are improved, and the test period is shortened. Fig. 2b and 2c are schematic diagrams of page elements of an android native page, and attributes and attribute values corresponding to the page elements according to an embodiment of the present invention.
According to a specific implementation manner of the embodiment of the present invention, the file records of the development submission can be viewed from the git address of the source code, so as to determine the modified file (i.e. the target engineering file).
Step S203, judging the file format corresponding to the target project file.
Through the setting, for the engineering files with different file formats, the modes adopted for acquiring all the information in the files are different. The file format is determined firstly, and then the engineering files in the files are determined in different modes, so that the situation that the determined page elements are incomplete and the page testing accuracy is reduced due to the fact that all information in the engineering files cannot be obtained is avoided.
And step S204, if the file format is java, performing reflection processing on the target project file to determine page elements in the target project file.
Specifically, according to the embodiment of the invention, if the file format is java, a java reflection mechanism can be adopted to perform reflection processing on the target engineering file so as to determine the page elements.
Step S205, if the file format is xml, the target project file is analyzed to determine the page elements in the target project file.
Through the setting, all the page elements in the target project file can be obtained dynamically (namely in the running process), wherein the page elements comprise the attributes of the page elements and the corresponding attribute values of the page elements.
Step S206, comparing the attributes of the page elements in the target engineering file with the attributes of the page elements in the test script file to determine the target page elements.
Specifically, according to the embodiment of the present invention, the page element includes attributes (for example, basic attributes of the Android Native page element include resource-id, class, text, xpath, etc.), and attribute values corresponding to the attributes. The page attribute changes, namely, the page element is subjected to addition and/or deletion operation; through the setting, the page elements of the target project file, which are subjected to the adding and/or deleting operation, can be determined.
Step S207, comparing the attribute value of the page element in the target engineering file with the attribute value of the page element in the test script file, so as to update the target page element.
According to the embodiment of the invention, the attribute value corresponding to the page attribute changes, namely, the page element is represented to execute the change operation; through the setting, the page elements of the target project file, which execute the change operation, can be determined.
Specifically, as shown in the following table, for the attributes resource-id and text of the page element X, the corresponding attribute values are not changed (i.e., any one or more operations of deleting, changing, and adding are not performed). While the values of the attributes class and xpath have changed. When the page element of the target engineering file is compared with the page element in the test script file, the page element X in the target engineering file can be found according to the unchanged attributes of resource-id or text; and then sequentially matching and comparing the attribute values corresponding to the attributes of the page element X, finding out the change of the corresponding values, determining the page element X in the target engineering file as a target page element, and subsequently updating the test script file according to the attribute of the target page element and the latest value corresponding to the attribute.
Page element attributes Attribute value (before change) Attribute value (after change)
resource-id A A
class B B’
text C C
xpath D D’
And S208, updating the corresponding page element in the test script file according to the target page element, and executing the page test by using the updated test script file.
According to the embodiment of the invention, the automated test is mainly realized by driving an automated test script through page elements. Through the setting, the test script file is updated through the updated page elements determined in the step, so that the instantaneity and accuracy of the page elements in the test script file are guaranteed, and the test accuracy and the test effect are improved.
According to the technical scheme of the embodiment of the invention, the engineering source code is obtained, and the target engineering file is determined according to the engineering source code; determining a target page element according to the target engineering file and the test script file; according to the target page element, the corresponding page element in the test script file is updated, and the updated test script file is used for executing the page test, so that the technical problems of low automation degree of the page test, high test cost, long test period, low test accuracy and poor test effect caused by the fact that the test script is manually updated in the conventional page test method are solved, and the technical effects of realizing automatic update of the test script according to the target page element, further realizing automatic page test, reducing the test cost, shortening the test period and improving the test accuracy and the test effect are further achieved.
FIG. 3 is a schematic diagram of main modules of a page testing apparatus according to an embodiment of the present invention; as shown in fig. 3, the page testing apparatus 300 according to the embodiment of the present invention mainly includes:
the engineering source code obtaining module 301 is configured to obtain an engineering source code, and determine a target engineering file according to the engineering source code.
After the development team creates project, the project file is created and the relevant code is written under the project file. Through the setting, the engineering source code is obtained, the engineering file which executes any one or more of deletion, addition and change aiming at the page element is determined by scanning the engineering source code and is used as the target engineering file, the corresponding page element in the test script file is updated by comparing the page element stored in the test script file subsequently, and the updated test script file is used for carrying out automatic test on the page, so that the test accuracy and the test effect are improved, and the test period is shortened.
Further, according to the embodiment of the present invention, the page testing apparatus 300 further includes a code integration status determining module, before the step of obtaining the engineering source code, for determining that the code integration status is complete.
According to the embodiment of the invention, in an agile development mode, in order to shorten the development period, a team is usually developed through integrated development, the development process not only involves scene change of a UI, but also changes attributes of page elements or specific values corresponding to the attributes (such as operations according to skill requirements, bug repair and the like) under the condition that the UI is not changed. And after the codes of the respective branches are submitted to the trunk and combined by each research and development personnel and are integrated, all the engineering source codes are obtained, and then the target engineering file is determined according to all the engineering source codes, so that repeated scanning work and corresponding conflict conditions caused by determining the target engineering file for each branch source code are avoided, the test cost is further reduced, and the test period is shortened.
Preferably, according to the embodiment of the present invention, the above engineering source code obtaining module 301 is further configured to: and traversing the engineering source code according to the code identification to determine a target engineering file.
Specifically, according to embodiments of the present invention, page elements exist within the engineering files associated with the front-end page, independent of the engineering files associated with the back-end interface, configuration information, and underlying logic. Therefore, a code scanning tool (such as a sonar) can be adopted to set scanning conditions (such as setting code identification) and traverse the engineering source code according to the scanning conditions to determine the target engineering file, so that the testing cost is reduced.
And the target page element determining module 302 is configured to determine a target page element according to the target project file and the test script file.
Specifically, according to an embodiment of the present invention, the target page element determining module 302 is further configured to:
traversing the target engineering file, and screening page elements in the target engineering file;
and comparing the page elements in the target engineering file with the page elements in the test script file to determine the target page elements.
Through the setting, all target engineering files are traversed (page elements in the engineering files execute any one or more operations of modification, new addition and change in the research and development process, the engineering files comprise information such as logic codes, configuration information and page elements), all page element nodes in the engineering files are screened, the page elements are determined, the page elements comprise attributes and attribute values corresponding to the page elements, and then the page elements in the target engineering files are compared with the page elements stored in the test engineering files to determine the target page elements; and then the page elements stored in the test script file are updated according to the target page elements, so that the real-time performance and the accuracy of the page elements in the test script file are ensured, and the accuracy of page test and the page test effect are further improved.
Further, according to the embodiment of the present invention, the target page element determining module 302 is further configured to:
judging a file format corresponding to the target engineering file;
if the file format is java, performing reflection processing on the target engineering file to determine page elements in the target engineering file;
and if the file format is xml, analyzing the target engineering file to determine the page elements in the target engineering file.
Through the setting, different processing modes are adopted according to different file formats, all information in the target engineering file can be dynamically acquired, and the situation that the determined page elements are incomplete and the page testing accuracy is reduced due to the fact that all information in the engineering file cannot be acquired is favorably avoided.
Preferably, according to the embodiment of the present invention, the target page element determining module 302 is further configured to: and comparing the attributes of the page elements in the target engineering file with the attributes of the page elements in the test script file to determine the target page elements.
Specifically, according to the embodiment of the present invention, the page element includes attributes (for example, basic attributes of the Android Native page element include resource-id, class, text, xpath, etc.), and attribute values corresponding to the attributes. The page attribute changes, namely, the page element is subjected to addition and/or deletion operation; through the setting, the page elements of the target project file, which are subjected to the adding and/or deleting operation, can be determined.
Further, according to the embodiment of the present invention, the page testing apparatus 300 further includes a target page element updating module, configured to: and comparing the attribute value of the page element in the target engineering file with the attribute value of the page element in the test script file so as to update the target page element.
According to the embodiment of the invention, the attribute value corresponding to the page attribute changes, namely, the page element is represented to execute the change operation; through the setting, the page elements of the target project file, which execute the change operation, can be determined.
And the page testing module 303 is configured to update a corresponding page element in the test script file according to the target page element, and execute a page test by using the updated test script file.
According to the embodiment of the invention, the automated test is mainly realized by driving an automated test script through page elements. Through the setting, the test script file is updated through the updated page elements determined in the step, so that the instantaneity and accuracy of the page elements in the test script file are guaranteed, and the test accuracy and the test effect are improved.
According to the technical scheme of the embodiment of the invention, the engineering source code is obtained, and the target engineering file is determined according to the engineering source code; determining a target page element according to the target engineering file and the test script file; according to the target page element, the corresponding page element in the test script file is updated, and the updated test script file is used for executing the page test, so that the technical problems of low automation degree of the page test, high test cost, long test period, low test accuracy and poor test effect caused by the fact that the test script is manually updated in the conventional page test method are solved, and the technical effects of realizing automatic update of the test script according to the target page element, further realizing automatic page test, reducing the test cost, shortening the test period and improving the test accuracy and the test effect are further achieved.
Fig. 4 shows an exemplary system architecture 400 to which the page test method or the page test apparatus of the embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405 (this architecture is merely an example, and the components included in a particular architecture may be adapted according to application specific circumstances). The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have installed thereon various communication client applications, such as a page test type application, a data processing type application, etc. (by way of example only).
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server that provides various services, such as a server (for example only) for users (performing page testing/performing data processing) with the terminal devices 401, 402, 403. The server may analyze and perform other processing on the received data such as the engineering source code, and feed back the processing result (e.g., a target engineering document, a target page element, just an example) to the terminal device.
It should be noted that the page testing method provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, the page testing apparatus is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, a block diagram of a computer system 500 suitable for use with a terminal device or server implementing an embodiment of the invention is shown. The terminal device or the server shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. 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.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes an engineering source code acquisition module, a target page element determination module, and a page test module. The names of the modules do not form a limitation on the modules themselves in some cases, for example, the engineering source code acquiring module may also be described as a "module for acquiring engineering source codes and determining target engineering files according to the engineering source codes".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring a project source code, and determining a target project file according to the project source code; determining a target page element according to the target engineering file and the test script file; and updating the corresponding page elements in the test script file according to the target page elements, and executing the page test by using the updated test script file.
According to the technical scheme of the embodiment of the invention, the engineering source code is obtained, and the target engineering file is determined according to the engineering source code; determining a target page element according to the target engineering file and the test script file; according to the target page element, the corresponding page element in the test script file is updated, and the updated test script file is used for executing the page test, so that the technical problems of low automation degree of the page test, high test cost, long test period, low test accuracy and poor test effect caused by the fact that the test script is manually updated in the conventional page test method are solved, and the technical effects of realizing automatic update of the test script according to the target page element, further realizing automatic page test, reducing the test cost, shortening the test period and improving the test accuracy and the test effect are further achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A page testing method is characterized by comprising the following steps:
acquiring a project source code, and determining a target project file according to the project source code;
determining a target page element according to the target engineering file and the test script file;
and updating the corresponding page elements in the test script file according to the target page elements, and executing page test by using the updated test script file.
2. The page testing method according to claim 1, wherein said determining a target project file from said project source code further comprises:
and traversing the engineering source code according to the code identification to determine a target engineering file.
3. The method for page testing according to claim 1, wherein said determining a target page element from said target project file and test script file further comprises:
traversing the target engineering file, and screening page elements in the target engineering file;
comparing the page elements in the target engineering file with the page elements in the test script file to determine the target page elements, wherein the target page elements are page elements which execute at least one of the following operations in the target engineering file: delete, add, change.
4. The page testing method according to claim 3, wherein said traversing said target project file, determining page elements within said target project file, further comprises:
judging a file format corresponding to the target project file;
if the file format is java, performing reflection processing on the target engineering file to determine page elements in the target engineering file;
and if the file format is xml, analyzing the target engineering file to determine page elements in the target engineering file.
5. The page testing method according to claim 3, wherein the comparing the page elements in the target project file with the page elements in the test script file to determine the target page elements further comprises:
and comparing the attributes of the page elements in the target engineering file with the attributes of the page elements in the test script file to determine the target page elements.
6. The page testing method of claim 5, further comprising: and comparing the attribute value of the page element in the target engineering file with the attribute value of the page element in the test script file so as to update the target page element.
7. The page testing method according to claim 1, further comprising, before said step of obtaining engineering source code: the code integration status is determined to be completed.
8. A page testing apparatus, comprising:
the system comprises an engineering source code acquisition module, a target engineering file determination module and a target engineering file generation module, wherein the engineering source code acquisition module is used for acquiring an engineering source code and determining a target engineering file according to the engineering source code;
the target page element determining module is used for determining target page elements according to the target engineering file and the test script file;
and the page testing module is used for updating the corresponding page elements in the test script file according to the target page elements and executing page testing by using the updated test script file.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202011321433.9A 2020-11-23 2020-11-23 Page testing method and device Pending CN114090418A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011321433.9A CN114090418A (en) 2020-11-23 2020-11-23 Page testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011321433.9A CN114090418A (en) 2020-11-23 2020-11-23 Page testing method and device

Publications (1)

Publication Number Publication Date
CN114090418A true CN114090418A (en) 2022-02-25

Family

ID=80295862

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011321433.9A Pending CN114090418A (en) 2020-11-23 2020-11-23 Page testing method and device

Country Status (1)

Country Link
CN (1) CN114090418A (en)

Similar Documents

Publication Publication Date Title
CN110554876A (en) Method and device for compiling android project
CN109766127B (en) Method for updating application version information
US11934287B2 (en) Method, electronic device and computer program product for processing data
US9971794B2 (en) Converting data objects from multi- to single-source database environment
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN113010405A (en) Application program testing method and device
CN113971037A (en) Application processing method and device, electronic equipment and storage medium
CN112948306A (en) Method and device for expanding system interface
CN112559024A (en) Method and device for generating transaction code change list
CN112068874A (en) Software project continuous integration method and device, terminal equipment and storage medium
CN111367500A (en) Data processing method and device
US9996799B2 (en) Migrating a legacy system by inferring context-sensitive business rules from legacy source code
CN114090418A (en) Page testing method and device
CN115454956A (en) Log generation method and device, electronic equipment and storage medium
CN110795259A (en) Method and device for analyzing application collapse
CN113448578A (en) Page data processing method, processing system, electronic device and readable storage medium
CN114721943A (en) Method and device for determining test range
CN114625458A (en) Page data processing method and device, electronic equipment and storage medium
CN113419740A (en) Program data stream analysis method and device, electronic device and readable storage medium
CN113297081A (en) Execution method and device of continuous integration assembly line
CN112084114A (en) Method and apparatus for testing an interface
CN108628909B (en) Information pushing method and device
CN111259047A (en) Data loading method, device, equipment and storage medium thereof
CN111460269B (en) Information pushing method and device
CN108984189B (en) Module parsing method and device

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