CN112612711A - UI automation test method and device through short link - Google Patents

UI automation test method and device through short link Download PDF

Info

Publication number
CN112612711A
CN112612711A CN202011588886.8A CN202011588886A CN112612711A CN 112612711 A CN112612711 A CN 112612711A CN 202011588886 A CN202011588886 A CN 202011588886A CN 112612711 A CN112612711 A CN 112612711A
Authority
CN
China
Prior art keywords
link
short
test
long
byte string
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
CN202011588886.8A
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.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202011588886.8A priority Critical patent/CN112612711A/en
Publication of CN112612711A publication Critical patent/CN112612711A/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a UI automation test method, a device, computer equipment and a storage medium through short link, wherein the method comprises the following steps: embedding the pre-data through public script execution, and packaging the test data of the user interface; converting the long chain connection hanging parameters on the user interface into short chain connections and displaying the short chain connections; and receiving an instruction for clicking the short link to test so as to jump to a page corresponding to the long link to finish the test process. The method and the device reduce the complexity of automatic test case maintenance without maintaining numerous page elements; the test efficiency of multi-layer page jumping is greatly improved. Particularly, in the regression testing process of some specific scenes, the cases to be tested can be quickly produced and quickly executed in batches, and the test results of the corresponding scenes are obtained; the standardization of a development framework can be gradually promoted, so that the automatic test is more controllable.

Description

UI automation test method and device through short link
Technical Field
The present application relates to the field of computer testing technologies, and in particular, to a method and an apparatus for UI automation testing through short links, a computer device, and a storage medium.
Background
Currently, in the industry, a User Interface (UI) automation test is performed through a self-building or open-source tool, and generally, each level of page and corresponding elements are captured and defined, and then the page is executed step by step to a designated page in a use case according to an operation sequence.
For example, an order confirmation page of an e-commerce platform is modified, and the daily testing actions are as follows:
1. opening app, authorizing a system, logging in the system, switching cities and other initialization actions;
2. opening a commodity searching page to perform commodity searching;
3. finding a specific commodity and clicking to enter a commodity detail page;
4. adding commodities into a shopping cart to enter a shopping page;
5. click to buy into the order confirmation page.
However, the current testing method has the following defects and shortcomings:
1. from opening an app to reaching the target page, there are multiple levels of page adjustments in between, which may cause failure of case execution due to frequent changes in pages and instability of the intermediate pages.
2. The test executed in each test is time-consuming, and the process requiring multiple layers is troublesome in the parameterization process.
3. When the middle page is changed, the whole use case needs to be rewritten.
Disclosure of Invention
Therefore, it is necessary to provide a method, an apparatus, a computer device, and a storage medium for UI automation test by short link, which solve the problem that when UI automation test by short link is performed, technicians need to manually write a large amount of codes, which results in a large workload, and thus the efficiency of the test is reduced.
A first aspect provides a method for UI automation testing by short link, comprising:
embedding the pre-data through public script execution, and packaging the test data of the user interface;
converting the long chain connection hanging parameters on the user interface into short chain connections and displaying the short chain connections;
and receiving an instruction for clicking the short link to test so as to jump to a page corresponding to the long link to finish the test process.
Further, the executing pre-data embedding through the public script comprises: the method comprises the steps of integrating codes in a page or a basic script, and introducing a first preset script on the corresponding page.
Further, the encapsulating the test data of the user interface includes: and creating an image object by using a second preset script, directing the path of the image to a back-end script, and splicing the data.
Further, the converting the long link hanging parameter on the user interface into a short link and displaying the short link includes: converting the long chain link by adopting a long chain-to-short chain algorithm to obtain a short link, and specifically comprising the following steps of:
splicing the long link with a preset key value to obtain an original byte string;
encrypting the original byte string by using an information abstract algorithm to obtain a target byte string;
performing character type conversion on the target byte string to obtain a target character string;
dividing a target character string according to bits to obtain eight-bit hexadecimal numbers;
carrying out bitwise AND operation on the eight-bit hexadecimal number and a first preset value of the hexadecimal number to obtain a first subscript value;
carrying out bitwise AND operation on the first subscript value and a hexadecimal second preset value to obtain a second subscript value; and acquiring characters corresponding to the second subscript value from the preset character array to form short links.
Further, the encrypting the original byte string by using the information digest algorithm to obtain the target byte string includes: the method for encrypting the original byte string by using the MD5 to obtain the target byte string specifically comprises the following steps:
dividing the length of the original byte string by a first preset value to obtain a current remainder;
judging whether the current remainder is a target value;
if the current remainder is not the target value, determining the number of bytes to be filled based on the current remainder, and filling 0 which is consistent with the number of bytes to be filled in the original byte string to obtain an intermediate byte string;
and if the current remainder is the target value, the original byte string is directly used as the updated intermediate byte string without padding.
And performing four-wheel cycle operation on the intermediate byte string to obtain a target byte string.
Further, the receiving an instruction of clicking the short link for testing to jump to a page corresponding to the long link includes the following steps:
searching a corresponding long link based on the short link identifier to obtain webpage content corresponding to the long link;
and sending the webpage content to the client.
Further, the receiving an instruction of clicking the short link for testing to jump to a page corresponding to the long link includes the following steps:
receiving an access request based on a short link;
analyzing the short link according to the access request to obtain a long link matched with the short link;
verifying the long chain link obtained by analysis according to a predefined long chain link regular expression;
and after the verification is passed, redirecting the access request to the long link obtained by analysis.
A second aspect provides a UI automation test apparatus by short link, comprising:
the packaging module is used for executing preposed data embedding through a public script and packaging the test data of the user interface;
the link conversion module is used for converting the long-chain link hanging parameters on the user interface into short-chain links and displaying the short-chain links;
and the test module is used for receiving the instruction for clicking the short link to test so as to jump to the page corresponding to the long link to finish the test process.
A third aspect provides a computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the method for UI automation testing by short link described above.
A fourth aspect provides a storage medium storing computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the UI automation test method by short link described above.
Compared with the prior art, the method, the device, the computer equipment and the storage medium for automatically testing the UI through the short link have the following advantages that:
1. the complexity of maintaining the automatic test case is reduced, and a plurality of page elements are not required to be maintained.
2. The test efficiency of multi-layer page jumping is greatly improved. Particularly, in the regression testing process of some specific scenes, cases (cases) needing to be tested can be rapidly produced and rapidly executed in batches, and the test results of corresponding scenes can be obtained.
3. The standardization of a development framework can be gradually promoted, so that the automatic test is more controllable.
Drawings
FIG. 1 is a block diagram showing an internal configuration of a computer device according to an embodiment;
FIG. 2 is a flow diagram of a method for UI automation testing via short links in one embodiment;
FIG. 3 is a detailed flowchart of UI automation test method step S2 through short link in one embodiment;
FIG. 4 is a block diagram of a UI automation test device via short links in one embodiment;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 6 shows a schematic diagram of a storage medium provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first UI automation test script by short link may be referred to as a second UI automation test script by short link, and similarly, a second UI automation test script by short link may be referred to as a second UI automation test script by short link, without departing from the scope of the present application.
The conventional UI test scheme needs root acquisition of super authority and installation of a corresponding cracking program frame, and is not needed in the application. In the application, the corresponding page to be tested is directly reached through the jump of a short link (a determined long link is connected with an address which can be identified by an application program after being processed), then a relevant test is developed, and the previous steps are transplanted through initialized data or data of the long link.
Example 1
Fig. 1 is a schematic diagram of an internal structure of a computer device according to an embodiment. The computer device includes a processor, a non-volatile storage medium, a memory, and a network interface connected by a system bus. The non-volatile storage medium of the computer device stores an operating system, a database and computer readable instructions, the database can store control information sequences, and the computer readable instructions can enable the processor to realize a UI automation testing method through short link when being executed by the processor. The processor of the computer device is used for providing calculation and control capability and supporting the operation of the whole computer device. The memory of the computer device may have stored therein computer readable instructions that, when executed by the processor, may cause the processor to perform a method of automated testing of a UI via short links. The network interface of the computer device is used for connecting and communicating with the terminal. Those skilled in the art will appreciate that the architecture shown in fig. 1 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The following describes a method, an apparatus, an electronic device, and a storage medium for UI automation test by short link according to embodiments of the present application with reference to the accompanying drawings.
In one embodiment, as shown in fig. 2, a method and system for UI automated testing by short link, and a computer-readable storage medium are provided, and the simulation correlation system real-time callback method may include, but is not limited to, the following steps.
And S1, embedding the pre-data through the public script execution, and packaging the test data of the user interface.
When a page of a user interface is opened, a js fragment of a buried point in the page is executed, the js code asynchronously loads a js file which is sdk without the buried point and is requested by a browser to be executed, data collection is carried out through the script, and after the data collection of the user interface is finished, the data is transmitted to a back end to be collected and sorted.
The common script encapsulates some common operation items of the app and contains some pre-embedding required to test data, so that time consumption caused by frequent page switching in the opening process is reduced.
And S2, converting the long link (URL) on the user interface into a short link after hanging the parameter, and displaying the short link.
The link of the page to be tested is modified and hung with necessary parameters (the parameters are configurable, and corresponding data and information which needs to be loaded when the page to be tested is displayed) and then short-chain conversion is carried out, so that the two-dimensional code can also be generated.
And S3, receiving the instruction of clicking the short link for testing so as to jump to the page corresponding to the long link and finish the testing process.
And clicking the short chain or scanning the two-dimensional code to reach the corresponding page, completing the complete display of the page through the link parameters and the pre-embedded data, and performing subsequent test verification. The uncertainty caused by the skip of the middle multi-level page is reduced, and the test focus can be focused on the page to be tested.
Further, step S1 includes: by integrating the code in the page or the basic script, the bury _ test script can be introduced on the corresponding page, and the bury _ test script is the buried point sdk.
By the method, some basic page data and more detailed data can be acquired and added according to specific service requirements.
Further, step S1 includes: and reporting the collected data. Here it needs to be analyzed on a case-by-case basis, and simplest is ajax if there is no cross-domain. However, many sdk involve cross-domain, so the present application creates an Image object with js script, points the Image's src to the backend script, and concatenates the data.
Further, step S2 includes: and converting a long link (URL) on the user interface into a short link after adding a hanging parameter by using a long-to-short link algorithm, and displaying. The long-chain to short-chain algorithm is an algorithm for converting long-chain links into short links. The short link is to convert the web page address corresponding to the long link to obtain a shorter web page address.
In step S2, a long link is converted by using a long-to-short link algorithm to obtain a short link, which specifically includes the following steps:
s21: and splicing the long link with a preset key value to obtain an original byte string.
The original byte string is obtained after the long link is spliced with the preset key value. The preset key value is a custom byte string that includes, but is not limited to, a short letter of a username or a lower case spell of the user's name. Specifically, splicing the long link and the preset key value specifically means that the long link and the preset key value are directly combined, that is, the byte string corresponding to the long link and the byte string corresponding to the preset key value are added to obtain the original byte string.
S22: and encrypting the original byte string by adopting an information-abstract algorithm to obtain a target byte string.
The message-digest (MD) algorithm is a function for changing an input information string of any length into an output string of a fixed length, and is generally used for generating an information digest, encrypting a key, and the like. In the embodiment, the fifth version of the MD algorithm, namely the MD5 algorithm, is adopted, and the MD5 has the characteristic of high safety, so that user information is not easy to leak, and the privacy of a user is protected. The target byte string is a byte string that is converted from an original byte string without a fixed length into a byte string with a fixed length (128-bit binary system) by using an information-digest algorithm.
Specifically, since MD5 processes incoming information in 512-bit (i.e., 512-bit binary) packets, each packet is in turn divided into 16 32-bit sub-packets. Therefore, in step S22, the encrypting the original byte string by using MD5 to obtain the target byte string specifically includes the following steps:
s221: the length of the original byte string is divided by 512 to obtain the current remainder.
S222: it is determined whether the current remainder is 448.
S223: if the current remainder is not 448, the number of bytes to be padded is determined based on the current remainder, and 0's which is consistent with the number of bytes to be padded are padded in the original byte string to obtain an intermediate byte string. And then adding a 64-bit binary-represented stuffing byte (bit is taken as a unit) behind the intermediate byte string to obtain an updated intermediate byte string, wherein the updated intermediate byte string is (N +1) × 512 and is a multiple of 512. Wherein, the stuff bytes are preset fixed bytes.
S224: if the current remainder is 448, the original byte string is directly used as the updated intermediate byte string without padding.
S225: and performing four-wheel cycle operation on the intermediate byte string to obtain a target byte string.
There are four 32-bit integer parameters called Chaining variables (Chaining variables) in MD5, which are set as: a ═ 0x01234567, B ═ 0x89abcdef, C ═ 0xfedcba98, D ═ 0x 76543210. When the four chaining variables are set, the four-round loop operation of the MD5 algorithm is started, and the number of the loops is the number of 512-bit information packets in the information, and is N + 1.
Further, the operation of the four round-robin operation includes subdividing each 512 bits into 16 subgroups of 32 bits each; the four chaining variables are copied to the other four variables (a, B, C, D), namely a to a, B to B, C to C, D to D. The main cycle has four cycles, and the operation of each cycle is similar. Each round of 16 operations, each operation performs a logical operation on three variables of a, b, c and D, then adds the fourth variable (a sub-group and a constant in the text) to the obtained result, and then performs four cycles to obtain new four linked variables of A, B, C and D, and the new four linked variables are cascaded according to the sequence of ABCD and output to obtain a 128-bit binary (16-byte) MD5 value, namely the target byte string. Specifically, the calculation result of each operation is circularly shifted to the right by 4 bits, and the next operation is performed. After each cycle A, B, C and D are added with a, b, c and D respectively, and then the next cycle is entered.
Specifically, the logical operation formula of each round of logical operation is as follows: the first round of logical operation formula is F (x, y, z) ═ x & y) | ((-x) & z); the second round of logical operation formula is G (x, y, z) ═ x & z | (y & (-z)); the third round of logical operation formula is H (x, y, z) ═ x ^ y ^ z; the fourth logical operation formula is I (X, Y, Z) ═ Y ^ (X | (-Z)). Wherein, the symbol & represents and operation, the symbol-representation non-operation, the symbol ^ represents exclusive or operation. And operation, negation operation and exclusive or operation are all a basic logic operation mode in a computer. The and operation rule is: 0&0 ═ 0, 0&1 ═ 0, 1&0 ═ 0, 1&1 ═ 1, that is, both bits are "1" at the same time, and as a result, only "1", otherwise 0. Taking the non-operation rule as-0-1 and-1-0; that is, a "0" results in a "1" and a non-1 "results in a" 0 ". The operation rule of the exclusive-or operation is 0^0, 0^1, 1^ 0^1, 1^ 0; namely, two bits are equal to be "1" and different to be "0".
In this embodiment, the operation of the four-wheel cycle operation can be expressed by the following formula: FF (a, b, c, d, Mj, s, ti), representing a ═ b + ((a + F (b, c, d) + Mj + ti) < <)); GG (a, b, c, d, Mj, s, ti), representing a ═ b + ((a + G (b, c, d) + Mj + ti) < <; HH (a, b, c, d, Mj, s, ti), representing a ═ b + ((a + H (b, c, d) + Mj + ti) < < < s); II (a, b, c, d, Mj, s, ti), represents a ═ b + ((a + I (b, c, d) + Mj + ti) < < s). Where Mj represents the jth group of 16 subgroups, "< < s" represents the cyclic left shift by s bits, ti represents the constant in step i, i.e., the integer part of 232 abs (sin (i)), i is 1-64, and i is in radians. In this embodiment, in each cycle, the value of s is sequentially selected in a loop according to a preset array s (displacement of loop movement) and the array sequence until each cycle is finished. It is to be understood that the s array in each round is different, where in the first round, s is {7, 12, 17, 22}, in the second round, s is {5, 9, 14, 20}, in the third round, s is {4, 11, 16, 23}, and in the fourth round, s is {6, 10, 15, 21 }.
S23: and performing character type conversion on the target byte string to obtain a target character string.
The target string is a string obtained by converting a target byte string (128-bit binary) into hexadecimal. Since the processing of strings in computers is typically processing hexadecimal strings, the target string of bytes (i.e., the 128-bit binary MD5 value) is converted to a hexadecimal string (i.e., a 32-bit target string).
Specifically, the specific process of converting the target byte string into the target character string is as follows: the method comprises the steps of circularly taking out a target byte string of 16 bytes (128 bits) and converting each taken out byte to obtain a hexadecimal character, wherein each byte represents 8-bit binary, so that high four bits in each byte are converted first, low four bits in each byte are converted, and finally the character obtained by converting each byte is output to obtain the target character string. The specific conversion formula for converting each byte into hexadecimal characters is hexDigits [ byte0> > >4&0xf ], hexDigits [ byte0&0xf ], symbol > > > represents cyclic right shift, symbol & represents bitwise and operation, and hexdigs [ ] (hexadecimal) refers to an algorithm for converting a byte string into a hexadecimal character string. In this embodiment, the target byte string is converted into the hexadecimal target character string, so that the phenomenon of code confusion of the target byte string obtained based on MD5 can be effectively avoided, the subsequent processing speed is effectively increased, and the efficiency is improved.
S24: dividing the target character string according to bits to obtain eight-bit hexadecimal numbers.
The dividing of the target character string by bits specifically means that the target character string (32-bit hexadecimal) obtained in step S22 is divided by equal length, that is, the target character string is divided by groups of eight bits to obtain 4 groups of character string groups, and each group of character string groups contains eight-bit hexadecimal numbers, which is easy to calculate.
S25: and carrying out bitwise AND operation on the eight-bit hexadecimal number and the first preset value of the hexadecimal number to obtain a first subscript value.
The first preset value is a self-defined hexadecimal number. In this embodiment, the first preset value is a hexadecimal number 0x3FFFFFFF, four groups of eight-bit hexadecimal numbers obtained in step S24 are respectively bit-wise and-operated with the first preset value, that is, 0x3FFFFFFF, and since the obtained operation result is an effective length of 32 bits, the first two bits need to be removed from the lower 30-bit value of the operation result to obtain the first subscript value. Specifically, the bitwise and operation is a basic logical operation mode in a computer, the symbol is represented by &, and the operation rule is as follows: 0&0 ═ 0, 0&1 ═ 0, 1&0 ═ 0, 1&1 ═ 1; i.e. both bits are "1" at the same time, the result is "1", otherwise it is 0.
S26: and carrying out bitwise AND operation on the first subscript value and a hexadecimal second preset value to obtain a second subscript value.
And the second preset value is a self-defined hexadecimal number. Further, the first subscript value and the second preset value obtained in step S25 are subjected to a bitwise and operation. In this embodiment, the second preset value is a hexadecimal number 0x0000003D, and the first subscript value and 0x0000003D are bitwise and operated to obtain a second subscript value.
S27: and acquiring characters corresponding to the second subscript value from the preset character array to form short links.
The preset character array is a predefined character type array which contains characters used for generating short links. In this embodiment, the predetermined character array includes, but is not limited to, upper case english characters, lower case english letters, and arabic numerals (0 to 9). Through the second subscript value obtained in step S26, an index of the preset character array is obtained. And circularly selecting the characters corresponding to the second subscript value from the preset character array based on the index of the preset character array, adding the taken characters in each circulation, then shifting the characters to the right by 5 bits, entering the next circulation, and acquiring the candidate short links. Randomly selecting a short link from the candidate links to obtain the required short link. Specifically, based on the index of the preset character array, the characters in the preset character array are taken out in a circulating manner for 6 times to obtain 6 characters, namely a candidate short link, and since 4 circulating operations exist in the step S224, each circulating operation obtains one candidate short link, and finally 4 candidate short links are obtained. And finally, randomly selecting one candidate short link from the 4 candidate short links as a final short link.
Specifically, the Index of the preset character array is obtained by the Index function according to the second subscript value obtained in step S26. The Index function is a value or reference to a value in a return table or region. The Index function has two forms: array form and reference form. The array form usually returns a numerical value (in this embodiment, the numerical value form is used to return an index of a preset character array) or a numerical value array; the reference form typically returns a reference.
Specifically, when the short link is selected from the candidate short links, the server judges whether the candidate short link is the same as the short link stored in the server, if the candidate short link is the same as the short link stored in the server, the candidate short link can be directly rejected, one candidate short link is randomly selected from the remaining candidate short links with different short links stored in the server to serve as the final short link, and the process of selecting the short link can effectively avoid the repeated problem.
Further, step S3 includes:
s31: and searching the corresponding long link based on the short link identifier to obtain the webpage content corresponding to the long link.
Specifically, the server searches the corresponding long link in the database according to the short link identifier carried by the short link. The database stores a link information table, which includes but is not limited to a long link, a short link identifier, and web page content corresponding to the long link (i.e., long link content). The method has the advantages that the corresponding long link is found based on the short link identification, and the corresponding webpage content is found according to the long link, so that the process does not need to convert the short link into the long link through a conversion method, the corresponding long link is directly found only through the short link identification, the time is saved, and the user experience is improved.
S32: and sending the webpage content to the client.
The web page content refers to web page content corresponding to the long link. The server can search the corresponding long link in the database based on the short link identifier, then search the corresponding webpage content according to the long link, and send the webpage content to the client. The server pre-associates and stores the webpage content corresponding to the long link associated with the short link identifier, so that the corresponding webpage content can be conveniently and rapidly searched through the long link in the follow-up process.
In this embodiment, the server receives the access request sent by the client, and returns the long-link web content corresponding to the short link to the client, and the client receives and displays the web content sent by the server on the client. The web page content is specifically an H5 (hypertext markup language, HTML5 for short) interface, and is convenient for a user to view. Hypertext markup language is an application under the standard universal markup language. "hypertext" means that a page may contain pictures, links, and even non-textual elements such as music, programs, etc. The structure of the hypertext markup language includes a "header" section that provides information about the web page (i.e., the title, introduction, description, etc. of the web page), and a "body" section that provides specific content of the web page.
According to another embodiment of the present invention, the short link jump long link process of step S3 may further adopt the following manner:
step S301: an access request based on a short link is received.
As mentioned above, the service provider may publish the corresponding service content in the form of a short link in the UI. Based on this, the access request may be sent by the user by triggering (e.g., clicking) a short link in the UI.
Step S303: and analyzing the short link according to the access request to obtain a long link matched with the short link.
In practical scenarios, short links are usually generated based on long links, i.e. short links usually correspond to corresponding long links. Then, the analysis server can analyze the short link to obtain the matched long link. In the embodiment of the present specification, the long link may be a CDN address, or may be a URL pointing to a service content page. And is not particularly limited herein.
Step S305: and checking the long chain link obtained by analysis according to a predefined long chain link regular expression. Wherein the long-link regular expression is distributed by a configuration server.
In the embodiment of the present specification, the long chain link obtained by the analysis is verified according to the long chain link regular expression, and it may be considered to verify whether the long chain link obtained by the analysis conforms to the regular expression, more specifically, if the long chain link conforms to the regular expression, the long chain link may be considered to belong to a secure link.
Step S307: and after the verification is passed, redirecting the access request to the long link obtained by analysis.
It should be noted that, as described above, in an actual application scenario, the configuration server may distribute configured current limiting information (e.g., a current limiting threshold, a CDN address, etc.) to each analysis server, so that each analysis server performs current limiting management and control in the process of analyzing the short connection.
Based on this, the method may further include analyzing the short link according to the access request to obtain a long link matching the short link, and may include: determining a short code value corresponding to the short connection, judging whether the short code value of the short connection based on the access request corresponds to the CDN address according to the corresponding relation between the short code value and the CDN address established in advance, if so, returning the CDN address to be used as the long link obtained through analysis, and otherwise, determining a long link with the corresponding relation established in advance with the short code value according to the short code value to be used as the long link obtained through analysis.
In addition, the verifying the long chain link obtained by the analysis may include: checking whether the long link is matched with a predefined long link regular expression or not, and if so, passing the checking; otherwise, the check fails.
Further, redirecting the access request to the parsed long link may include: determining the domain name corresponding to the long link, counting the access amount of the domain name within a set time period, judging whether the access amount of the domain name corresponding to the long link exceeds a current limiting threshold value according to the access amount and the current limiting threshold value preset for the domain name, redirecting the access request to a preset current limiting page if the access amount exceeds the current limiting threshold value, and redirecting the access request to the long link obtained through analysis if the access amount does not exceed the current limiting threshold value.
The current limit page may specifically be a page including current limit prompt information, for example: prompt messages such as "server busy, queuing for access, please wait" are displayed on the page. Of course, this is merely an example and should not be construed as limiting the present application.
The page operation of the App end is influenced by more factors, and in the process of automatic testing, there are more possibilities that the page operation is interrupted, or a long time is needed for waiting, the whole testing period is prolonged, and the efficiency cannot be better reflected. For example, in the case of purchasing goods in the owner mall of the currently tested app, the automated testing requires many steps to complete an order.
If only the order confirmation page is modified in development, only the current page needs to be tested and verified according to evaluation, all steps in the red frame need to be operated in an automatic case, and the order confirmation page can be reached, so that the complexity and maintainability of the case are relatively poor, and the test time consumption is obviously increased. The steps are solidified through the test script, so that data required by a subsequent test page can be purchased in a preposed mode or transmitted through the url, and the corresponding test page can be directly verified in the automatic test process.
According to the application, some common operation items of the app are packaged through the public script, and the common operation items comprise pre-embedding of some data needing to be tested, so that time consumption caused by frequent page switching in the opening process is reduced.
The link of the page to be tested is modified, necessary parameters (the parameters are configurable, and corresponding data and information needing to be loaded when the page to be tested is displayed) are added, short-chain conversion is carried out, and the two-dimensional code can also be generated.
The corresponding page can be reached by clicking the short chain or scanning the two-dimensional code, complete display of the page is completed through the link parameters and the pre-embedded data, and subsequent test verification is performed. The uncertainty caused by the skip of the middle multi-level page is reduced, and the test focus can be focused on the page to be tested.
The application generally packages through the public script, the test data is preposed, the tested page is linked and customized, the tested page data is written in several steps and is completed, the operation on the page in the middle process is reduced, the test time consumption is reduced, the tested page is accurate and controllable, and the test quality and the test efficiency are improved.
In the method, only the order confirmation page is modified, the preposed steps can be simplified in the test process, the technology in the application can omit the preposed steps, test data required by the order purchase page is assembled into parameters requesting for linking, then the linking is processed to obtain a short link which can be identified by a system, and after the short link is accessed, the short link can directly reach the order confirmation page and display the corresponding test data for test follow-up.
As shown in fig. 4, in one embodiment, there is provided a UI automation test apparatus by short link, which may include:
the encapsulating module 411 is configured to execute pre-data embedding through a public script and encapsulate test data of a user interface;
the link conversion module 412 is configured to convert the long link hanging parameter on the user interface into a short link and display the short link;
and the test module 413 is configured to receive an instruction for clicking the short link to perform a test, so as to jump to a page corresponding to the long link to complete a test process.
The embodiment of the present application further provides an electronic device corresponding to the UI automation test method performed by short link provided in the foregoing embodiment, so as to execute the UI automation test method performed by short link. The embodiments of the present application are not limited.
Please refer to fig. 5, which illustrates a schematic diagram of an electronic device according to some embodiments of the present application. As shown in fig. 5, the electronic device 2 includes: the system comprises a processor 200, a memory 201, a bus 202 and a communication interface 203, wherein the processor 200, the communication interface 203 and the memory 201 are connected through the bus 202; the memory 201 stores a computer program that can be executed on the processor 200, and the processor 200 executes the method for UI automation test by short link provided by any of the foregoing embodiments when executing the computer program.
The Memory 201 may include a high-speed Random Access Memory (RAM) and may further include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 203 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used.
Bus 202 can be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is configured to store a program, and the processor 200 executes the program after receiving an execution instruction, and the method for automatically testing a UI through a short link disclosed in any embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.
The processor 200 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 200. The Processor 200 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the method in combination with the hardware thereof.
The electronic equipment provided by the embodiment of the application and the UI automatic testing method through the short link provided by the embodiment of the application have the same inventive concept and have the same beneficial effects as the method adopted, operated or realized by the electronic equipment.
The present embodiment further provides a computer-readable storage medium corresponding to the UI automatic testing method by short link provided in the foregoing embodiment, please refer to fig. 6, which illustrates the computer-readable storage medium being an optical disc 30 on which a computer program (i.e., a program product) is stored, where the computer program, when being executed by a processor, executes the UI automatic testing method by short link provided in any of the foregoing embodiments.
It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory, or other optical and magnetic storage media, which are not described in detail herein.
The computer-readable storage medium provided by the above-mentioned embodiment of the present application and the UI automation testing method through short links provided by the embodiment of the present application have the same beneficial effects as the method adopted, run or implemented by the application program stored in the computer-readable storage medium.
It should be noted that:
the algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose devices may be used with the teachings herein. The required structure for constructing such a device will be apparent from the description above. In addition, this application is not directed to any particular programming language. It will be appreciated that a variety of programming languages may be used to implement the teachings of the present application as described herein, and any descriptions of specific languages are provided above to disclose the best modes of the present application.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the application, various features of the application are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the application and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: this application is intended to cover such departures from the present disclosure as come within known or customary practice in the art to which this invention pertains. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this application.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the application and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the present application may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the creation apparatus of a virtual machine according to embodiments of the present application. The present application may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present application may be stored on a computer readable medium or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The above description is only for the preferred embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for UI automation test through short link, which is characterized by comprising the following steps:
embedding the pre-data through public script execution, and packaging the test data of the user interface;
converting the long chain connection hanging parameters on the user interface into short chain connections and displaying the short chain connections;
and receiving an instruction for clicking the short link to test so as to jump to a page corresponding to the long link to finish the test process.
2. The method for UI automation testing by short link according to claim 1,
the pre-data embedding is executed through a public script, and the method comprises the following steps:
the method comprises the steps of integrating codes in a page or a basic script, and introducing a first preset script on the corresponding page.
3. The method for UI automation testing by short link according to claim 1,
the packaging the test data of the user interface comprises:
and creating an image object by using a second preset script, directing the path of the image to a back-end script, and splicing the data.
4. The method for UI automation testing by short link according to claim 1,
the converting the long chain connection hanging parameters on the user interface into short chain connections and displaying the short chain connections comprises the following steps: converting the long chain link by adopting a long chain-to-short chain algorithm to obtain a short link, and specifically comprising the following steps of:
splicing the long link with a preset key value to obtain an original byte string;
encrypting the original byte string by using an information abstract algorithm to obtain a target byte string;
performing character type conversion on the target byte string to obtain a target character string;
dividing a target character string according to bits to obtain eight-bit hexadecimal numbers;
carrying out bitwise AND operation on the eight-bit hexadecimal number and a first preset value of the hexadecimal number to obtain a first subscript value;
carrying out bitwise AND operation on the first subscript value and a hexadecimal second preset value to obtain a second subscript value;
and acquiring characters corresponding to the second subscript value from the preset character array to form short links.
5. The method for UI automation testing by short link according to claim 4,
the method for encrypting the original byte string by using the information digest algorithm to obtain the target byte string comprises the following steps: the method for encrypting the original byte string by using the MD5 to obtain the target byte string specifically comprises the following steps:
dividing the length of the original byte string by a first preset value to obtain a current remainder;
judging whether the current remainder is a target value;
if the current remainder is not the target value, determining the number of bytes to be filled based on the current remainder, and filling 0 which is consistent with the number of bytes to be filled in the original byte string to obtain an intermediate byte string;
and if the current remainder is the target value, the original byte string is directly used as the updated intermediate byte string without padding.
And performing four-wheel cycle operation on the intermediate byte string to obtain a target byte string.
6. The method for UI automation testing by short link according to claim 1,
the receiving and clicking the instruction of the short link for testing to jump to the page corresponding to the long link comprises the following steps:
searching a corresponding long link based on the short link identifier to obtain webpage content corresponding to the long link;
and sending the webpage content to the client.
7. The method for UI automation testing by short link according to claim 1,
the receiving and clicking the instruction of the short link for testing to jump to the page corresponding to the long link comprises the following steps:
receiving an access request based on a short link;
analyzing the short link according to the access request to obtain a long link matched with the short link;
verifying the long chain link obtained by analysis according to a predefined long chain link regular expression;
and after the verification is passed, redirecting the access request to the long link obtained by analysis.
8. An apparatus for automated UI testing by short link, comprising:
the packaging module is used for executing preposed data embedding through a public script and packaging the test data of the user interface;
the link conversion module is used for converting the long-chain link hanging parameters on the user interface into short-chain links and displaying the short-chain links;
and the test module is used for receiving the instruction for clicking the short link to test so as to jump to the page corresponding to the long link to finish the test process.
9. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the method for automated testing of UIs via short links of any of claims 1 to 7.
10. A storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the method for UI automation testing by short link according to any of claims 1 to 7.
CN202011588886.8A 2020-12-28 2020-12-28 UI automation test method and device through short link Pending CN112612711A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011588886.8A CN112612711A (en) 2020-12-28 2020-12-28 UI automation test method and device through short link

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011588886.8A CN112612711A (en) 2020-12-28 2020-12-28 UI automation test method and device through short link

Publications (1)

Publication Number Publication Date
CN112612711A true CN112612711A (en) 2021-04-06

Family

ID=75248653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011588886.8A Pending CN112612711A (en) 2020-12-28 2020-12-28 UI automation test method and device through short link

Country Status (1)

Country Link
CN (1) CN112612711A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726610A (en) * 2021-08-31 2021-11-30 中国平安人寿保险股份有限公司 Routing protocol-based UI (user interface) automatic testing method, device, equipment and medium
CN116400946A (en) * 2023-02-24 2023-07-07 深圳市丰润达科技有限公司 Block difference-based switch upgrading method, device, equipment and storage medium
CN116701792A (en) * 2023-08-03 2023-09-05 阿里健康科技(中国)有限公司 Access method, device, equipment and storage medium of target interface

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726610A (en) * 2021-08-31 2021-11-30 中国平安人寿保险股份有限公司 Routing protocol-based UI (user interface) automatic testing method, device, equipment and medium
CN113726610B (en) * 2021-08-31 2023-08-08 中国平安人寿保险股份有限公司 Routing protocol-based UI (user interface) automatic test method, device, equipment and medium
CN116400946A (en) * 2023-02-24 2023-07-07 深圳市丰润达科技有限公司 Block difference-based switch upgrading method, device, equipment and storage medium
CN116701792A (en) * 2023-08-03 2023-09-05 阿里健康科技(中国)有限公司 Access method, device, equipment and storage medium of target interface
CN116701792B (en) * 2023-08-03 2023-11-24 阿里健康科技(中国)有限公司 Access method, device, equipment and storage medium of target interface

Similar Documents

Publication Publication Date Title
CN112612711A (en) UI automation test method and device through short link
CN104317938B (en) Web page interlinkage validation verification method and device
CN104166822B (en) A kind of method and apparatus of data protection
CN103617191B (en) Use the hardware-accelerated method and browser for realizing that browser renders
US10546132B2 (en) String property labels for static analysis
CN103279538B (en) Prestrain accesses the server of webpage, browser client and method in website
CN110352427A (en) System and method for collecting data associated with the fraudulent content in networked environment
CA2846581A1 (en) Data infrastructure for providing interconnectivity between platforms, devices and operating systems
CN107239970A (en) A kind of Behavior-based control daily record determines the method and system of ad click rate
CN110619103A (en) Webpage image-text detection method and device and storage medium
CN110851682A (en) Text anti-crawler method, server and display terminal
CN108932640B (en) Method and device for processing orders
CN104199865A (en) Searching method, client-side and system of custom result providing content provider
Dyson et al. Scenario-based creation and digital investigation of ethereum ERC20 tokens
CN102662838B (en) The adjustment method of Flash and system in a kind of browser
CN103559097B (en) The method of interprocess communication, device and browser in a kind of browser
CN104536974A (en) Method for searching information in browser and client side of browser
CN103634366A (en) Method and device for identifying network robot
CN105450460A (en) Network operation recording method and system
CN104199862B (en) Searching method, server and the system customized based on content providers
CN112749351A (en) Link address determination method, link address determination device, computer-readable storage medium and equipment
CN116346660A (en) Data processing method, device, equipment and medium based on dependent replacement service
CN111209028B (en) Data processing method and device, electronic equipment and storage medium
CN106130964A (en) The automatic logging method of micro-end and device
CN110633077A (en) Rapid development system and method based on modularization

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