A test script generation method and device, a storage medium and an apparatus
By matching the properties of test script objects under different operating systems and automatically converting test scripts, the problem of repetitive script writing under iOS and Android operating systems is solved, and efficient script generation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING SANKUAI ONLINE TECH CO LTD
- Filing Date
- 2021-06-30
- Publication Date
- 2026-07-31
AI Technical Summary
When writing test scripts for iOS and Android operating systems, existing technologies require repetitive work, resulting in a waste of time and resources.
By obtaining the original test script under the first operating system, the corresponding test page and operation object are determined. Based on the object attributes, the specified object is matched in the second operating system to generate the target test script.
It enables automatic conversion of test scripts across different operating systems, avoiding repetitive writing, saving time and resources, and without changing the code of the client being tested.
Smart Images

Figure CN115617638B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of Internet technology, and in particular to a test script generation method, apparatus, storage medium and device. Background Technology
[0002] With the development of internet technology, smartphone clients have gradually become the mainstream way for users to access the internet. Before any client is launched, it needs to be tested to ensure that it can be used normally by users.
[0003] Currently, there are two main smartphone operating systems: iOS and Android. Before a client application is launched, it must be ensured that it functions correctly on both of these different operating systems. However, since test scripts written for one operating system cannot be directly run on the other, testers need to perform separate tests on both operating systems. Specifically, testers need to write and run test scripts for the client on Android and then write and run the same test scripts for the same client on iOS.
[0004] In practice, the aforementioned task of repeatedly writing test scripts on both ends is both time-consuming and resource-intensive. Summary of the Invention
[0005] This specification provides a test script generation method and apparatus to partially solve the aforementioned problems existing in the prior art.
[0006] The following technical solution is adopted in this specification:
[0007] This manual provides a method for generating test scripts, including:
[0008] Obtain the original test script under the first operating system; and determine the page to be tested corresponding to the original test script in the second operating system as the designated page.
[0009] Determine the object being manipulated and the operation behavior in the original test script;
[0010] Based on the attributes of the object being operated on, an object that matches the attributes of the object being operated on is selected from the specified page and used as the specified object.
[0011] Based on the specified object and the operation behavior, a target test script is generated, which is a test script under the second operating system.
[0012] Optionally, based on the attributes of the manipulated object, an object matching the attributes of the manipulated object is determined in the specified page and designated as the specified object, specifically including:
[0013] Determine the identifier of the object being operated on; and, in the first operating system, determine the page being tested corresponding to the original test script as the original page;
[0014] Based on the identifier of the object being manipulated, the text of the object being manipulated is determined in the original page and used as the first text.
[0015] Based on the first text, determine the object corresponding to the text that matches the first text on the designated page, and use it as the object to be identified;
[0016] When the object to be identified is unique, the object to be identified is designated as the specified object.
[0017] Optionally, when the object to be identified is not unique, the method further includes:
[0018] The attributes of the object being operated on, excluding the text, are determined as standard attributes; and for each object to be identified, the attributes of that object, excluding the text, are determined as attributes to be identified.
[0019] Identify the object to be identified corresponding to the attribute to be identified that matches the standard attribute, and designate it as the specified object.
[0020] Optionally, based on the attributes of the manipulated object, an object matching the attributes of the manipulated object is determined in the specified page and designated as the specified object, specifically including:
[0021] In the first operating system, the page to be tested corresponding to the original test script is determined as the original page;
[0022] The image corresponding to the object being manipulated is determined in the original page and used as the standard image;
[0023] On the specified page, the object corresponding to the image with the highest similarity to the standard image (not less than a specified threshold) is identified as the specified object.
[0024] Optionally, when there is no image on the specified page that has a similarity of not less than a specified threshold to the standard image, the method further includes:
[0025] Convert the standard image into the character corresponding to the standard image;
[0026] Use the character as the specified object.
[0027] Optionally, after generating the target test script, the method further includes:
[0028] On the specified page, the object corresponding to the image with the highest similarity to the converted image is identified as the object to be operated on in the target test script;
[0029] Based on the operation behavior, the manipulated object in the target test script is operated.
[0030] Optionally, before determining the object corresponding to the image with the highest similarity to the standard image (not less than a specified threshold) on the designated page as the designated object, the method further includes:
[0031] Determine the identifier of the object being operated on; and determine the test page corresponding to the original test script in the first operating system as the original page;
[0032] Based on the identifier of the object being manipulated, the text of the object being manipulated is determined in the original page and used as the first text.
[0033] Based on the first text, it is determined that there is no text matching the first text on the specified page.
[0034] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described test script generation method.
[0035] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described test script generation method.
[0036] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects:
[0037] In the test script generation method provided in this specification, the object to be operated on and the operation behavior are determined in the original test script under the first operating system. Based on the attributes of the object to be operated on, an object matching the attributes of the object to be operated on is determined in the test page corresponding to the original test script in the second operating system, and is used as the designated object. Based on the determined designated object and operation behavior, the target test script under the second operating system is generated.
[0038] As can be seen from the above method, this approach automatically converts test scripts from one operating system to another, saving testers the trouble of repeatedly writing scripts and thus saving time and resources. At the same time, this method does not modify the original code of the client being tested when generating the test scripts; that is, this method is non-intrusive. Attached Figure Description
[0039] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:
[0040] Figure 1 This is a flowchart illustrating a test script generation method described in this specification.
[0041] Figure 2 This is a diagram illustrating the original pages and specified pages in this manual;
[0042] Figure 3 This is a schematic diagram of a test script generation device provided in this specification;
[0043] Figure 4 The corresponding information provided in this specification Figure 1 A schematic diagram of an electronic device. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0045] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0046] Figure 1 This is a flowchart illustrating a test script generation method described in this specification, which specifically includes the following steps:
[0047] S100: Obtain the original test script under the first operating system; and determine the page to be tested corresponding to the original test script in the second operating system as the designated page.
[0048] In existing technologies, testers test the client that is about to be launched. Since the hardware and software that support the operation of different operating systems are different, test scripts written for one operating system cannot be used directly for another operating system. Therefore, for each operating system, testers need to write test scripts for that system and run them. However, this work of repeatedly writing test scripts wastes time and resources and may even delay the client's launch time.
[0049] This method can automatically convert a test script written under one operating system into a test script that can be directly executed under another operating system. The execution subject of this method can be a client or a server, which is not limited in this specification. The operating system can be a mobile phone operating system or a computer operating system, which is not limited in this specification. The following explanation will only use a mobile phone operating system as an example.
[0050] Specifically, after the server has written a test script for one operating system, in order to obtain a test script for another operating system, it can first obtain the test script for the first operating system as the original test script, and at the same time, determine the page to be tested in the second operating system that corresponds to the original test script as the specified page.
[0051] S102: Determine the object being operated on and the operation behavior in the original test script.
[0052] In step S100, the server has already obtained the original test script under the first operating system and the specified page under the second operating system. The object being operated on and the operation behavior are two elements in a complete test script. Therefore, in order to accurately and automatically convert the original test script into a test script under another operation, the server can first determine the object being operated on in the original test script and the operation behavior performed on the object being operated on.
[0053] It is worth noting that the target test script is automatically generated from the original test script, but the original test script is obtained in advance through recording operations by the tester. Specifically, the tester can first determine the object to be operated on and the operation to be performed on the object under the first operating system. Then, the tester can use a non-code recording and playback tool under the first operating system to obtain the test script, which serves as the original test script.
[0054] For example, the first operating system is Android, and the second is iOS. The test objective is to determine whether button 1 on the calculator can be clicked correctly. Therefore, button 1 is the object being operated on, and the operation is clicking. The original test script is obtained by using a recording tool on Android to record the clicking of button 1 on the calculator, while the specified page is the calculator page on iOS.
[0055] S104: Based on the attributes of the operated object, determine an object in the specified page that matches the attributes of the operated object, and designate it as the specified object.
[0056] As described above, the two key elements of a test script are the object being operated on and the operation behavior. To ensure consistency in the test content across different operating systems, it is necessary to ensure that the object being tested and the operation behavior contained in the test script for each operating system are consistent. Therefore, by identifying the object being operated on in the second operating system that matches the object being operated on in the first operating system, and combining it with the same operation behavior as in the original test script, i.e., the operation behavior determined in step S102, the server can automatically generate the target test script for the second operating system.
[0057] Specifically, the server can find the object corresponding to the attribute of the object being operated on in the specified page based on the attributes of the object being operated on, such as coordinates and type, and use it as the specified object, that is, the object being operated on in the test script under the second operating system.
[0058] The following methods can be used to determine a specific object on a specified page based on the attributes of the object being manipulated:
[0059] The server can determine the test page corresponding to the original test script under the first operating system, which is used as the original page. It also determines the identifier of the manipulated object. Then, based on the identifier, the server can determine the text of the manipulated object in the original page, which is used as the first text. The identifier of the manipulated object can be understood as the ID (identity document) of the manipulated object in the original test script, and the text of the manipulated object can be understood as the name displayed for the manipulated object on the original page.
[0060] The server can determine the object corresponding to the first copy on the specified page, based on the first copy, and use it as the specified object.
[0061] Specifically, the server can find an object on a specified page whose name matches the name of the object being operated on, based on the name of the object being operated on in the original page, and use it as the object to be identified.
[0062] When the server determines that the object to be identified is unique, it will be designated as the specified object. When the server determines that the object to be identified is not unique, i.e., there are multiple objects to be identified, the server needs to filter out the unique object that matches the object being operated on from the multiple objects. Specifically, the server can determine the attributes of the object being operated on, other than the text, such as coordinates, type, etc., as standard attributes. Similarly, for each object to be identified, the server determines the attributes of that object other than the text, such as coordinates, type, etc., as the attributes to be identified. Among these multiple objects to be identified, the object corresponding to the attribute to be identified that matches the standard attribute is determined and designated as the specified object.
[0063] In addition, when the server determines that the object to be identified is unique, the server can also determine the other attributes of the object being operated on and the object to be identified, excluding the text, as standard attributes and attributes to be identified, respectively. By matching the standard attributes and attributes to be identified, the server can once again determine that the object to be identified is the specified object required by the server.
[0064] Because each operating system has a different level of openness, the number and types of attributes of the manipulated object that can be obtained vary across different operating systems. For example, a server can obtain all the attributes of the manipulated object from an Android operating system, but can only obtain a portion of the attributes from an iOS operating system. Therefore, when the object to be identified is not unique, the server can use standard attributes to match the attributes of the same type among the attributes to be identified. For example, if the standard attributes include coordinates and type, and the attribute to be identified only contains coordinates, then the server can determine the object to be identified corresponding to the coordinates that match the coordinates of the manipulated object on the specified page, and use it as the specified object.
[0065] like Figure 2 As shown, following the previous example, the server can determine that the test page corresponding to the original test script under the Android operating system is the calculator page, and the identifier of the operated object, button 1, is 001. Based on the identifier 001 of button 1, the text of button 1 in the calculator page under the Android operating system is determined to be 1, which is used as the first text. The server can then find the object corresponding to the text that matches the first text 1 in the calculator page under the iOS operating system. That is, the object corresponding to text 1 in the calculator page under the iOS operating system is button 1 in the calculator page under the iOS operating system, which is used as the object to be identified.
[0066] Afterwards, the server can determine the target object: the coordinate information of button 1 in the Android operating system and the target object to be identified, the coordinate information of button 1 in the iOS operating system, that is, the coordinate information of button 1 in the iOS operating system. If the coordinate information of the two matches, then the target object to be identified: button 1 in the iOS operating system is the specified object.
[0067] Additionally, when the server cannot obtain text attributes in the second operating system, it can perform text recognition on a specified page. For example, it can use OCR (Optical Character Recognition) to obtain the text on the specified page and determine the coordinates of each text on the specified page. The server can then use this method to identify the object corresponding to the text that matches the first text among the texts obtained through OCR recognition, and use this as the designated object. When multiple texts match the first text, the server can match the coordinates in the standard attributes of the object being operated on with the coordinates of each text, ultimately filtering out the unique object corresponding to the first text from the multiple texts, and using this as the designated object.
[0068] When no matching text exists on the specified page, the server can convert the object to be operated on into an image on the original page, and then determine the object corresponding to the matching image on the specified page based on the converted image, and use it as the specified object.
[0069] Specifically, the server can first determine the image corresponding to the object being operated on in the original page as the standard image, and then determine the object corresponding to the image with a similarity of not less than a specified threshold in the specified page. Since only one specified object can be determined, the object corresponding to the image with the highest similarity can be used as the specified object. The specified threshold can be set according to the requirements, and this manual does not impose any restrictions.
[0070] It is worth noting that the standard image is the image corresponding to a screenshot of the image of the object being operated on in the original page. For example, if the object being operated on is the OK button, then the standard image is the image corresponding to the screenshot of the OK button in the original page.
[0071] After identifying the specified object, the server can determine other attributes of the specified object besides the text, such as coordinates and type. The server can then match these other attributes of the specified object with the other attributes of the object being operated on to ensure the accuracy of the specified object identified by the server on the specified page.
[0072] In addition, to improve the speed and accuracy of finding a specified object, the server can first determine the coordinates of the object to be operated on. Based on the coordinate information of the object to be operated on, the search range can be narrowed down. The server can then identify the object corresponding to the image with the highest similarity to the standard image (greater than a specified threshold) within the specified page of the narrowed range, and use it as the specified object.
[0073] If no image with a similarity of at least a specified threshold to a standard image exists on the specified page, the server can convert the standard image into its corresponding character set and use the converted character set as the specified object. For example, the server can determine the base64 value of the standard image and use it as the specified object.
[0074] Following the previous example, the server can convert the object being operated on—button 1 in the Android operating system—into an image corresponding to a screenshot of button 1 on the original page, using this image as the standard image. The server then uses image recognition to find the image with the highest similarity to the standard image in the calculator page of the iOS operating system, which has a similarity greater than a specified threshold. This image is the image of button 1 in the calculator of the iOS operating system. The server then determines the object corresponding to the image of button 1, i.e., button 1 in the iOS operating system, and uses it as the specified object.
[0075] It is worth noting that the server can also directly use the method described above, which uses the image of the object being operated on in the original page, to determine the specified object in the specified page. That is, the method of determining the specified object by using text and the method of determining the specified object by using images are parallel, and the server can choose either of these two methods to determine the specified object.
[0076] S106: Generate a target test script based on the specified object and the operation behavior, wherein the target test script is a test script under the second operating system.
[0077] In step S104, the server determines the specified object, namely the object to be operated on under the second operating system. The server can automatically generate the target test script based on the determined specified object and the operation behavior.
[0078] After obtaining the target test script, the server can run the obtained target test script under the second operating system to ensure that the obtained target test script can be used normally.
[0079] It is worth noting that when the specified object in the target test script under the second operating system is a character, when the target test script is executed under the second operating system, the server can convert the character into its corresponding image, find the image with the highest similarity to the converted image on the specified page as the object to be operated on in the target test script, and then the server can determine the object to be operated on in the target test script based on the operation behavior.
[0080] If the target test script obtained cannot be executed normally under the second operating system, the server can determine that the automatic conversion of the original test script into the target test script has failed.
[0081] The above describes one or more embodiments of the test script generation method provided in this specification. Based on the same idea, this specification also provides a corresponding test script generation device, such as... Figure 3 As shown.
[0082] Figure 3 This specification provides a schematic diagram of a test script generation device, which specifically includes:
[0083] The module includes a confirmation module 301, a matching module 302, and a script generation module 303, among which:
[0084] The confirmation module 301 is used to obtain the original test script under the first operating system; and to determine the page to be tested corresponding to the original test script in the second operating system as the designated page; and to determine the object to be operated on and the operation behavior in the original test script.
[0085] Matching module 302 is used to determine, based on the attributes of the operated object, an object in the specified page that matches the attributes of the operated object, and use it as a specified object;
[0086] The script generation module 303 is used to generate a target test script based on the specified object and the operation behavior, wherein the target test script is a test script under the second operating system.
[0087] Optionally, the matching module 302 is specifically used to determine the identifier of the object being operated on; and to determine the test page corresponding to the original test script in the first operating system as the original page; to determine the text of the object being operated on in the original page according to the identifier of the object being operated on, as the first text; to determine the object corresponding to the text matching the first text in the designated page according to the first text, as the object to be identified; and when the object to be identified is unique, the object to be identified is designated as the designated object.
[0088] Optionally, the matching module 302 is further configured to determine the attributes of the operated object other than the text, as standard attributes; and, for each object to be identified, determine the attributes of the object to be identified other than the text, as the attribute to be identified; and determine the object to be identified corresponding to the attribute to be identified that matches the standard attribute, as the designated object.
[0089] Optionally, the matching module 302 is specifically used to determine, in the first operating system, the test page corresponding to the original test script as the original page; determine, in the original page, the image corresponding to the object being operated on as the standard image; and determine, in the specified page, the object corresponding to the image with the highest similarity to the standard image (not less than a specified threshold) as the specified object.
[0090] Optionally, the matching module 302 is further configured to convert the standard image into characters corresponding to the standard image; and to use the characters as a specified object.
[0091] Optionally, the script generation module 303 is further configured to, when executing the target test script in the second operating system, convert the characters of the specified object into images; determine the object corresponding to the image with the highest similarity to the converted image in the specified page as the object to be operated on in the target test script; and operate the object to be operated on in the target test script according to the operation behavior.
[0092] Optionally, the matching module 302 is further configured to determine the identifier of the object being operated on; and, in the first operating system, determine the page being tested corresponding to the original test script as the original page; based on the identifier of the object being operated on, determine the text of the object being operated on in the original page as the first text; and based on the first text, determine that there is no object corresponding to the text that matches the first text in the specified page.
[0093] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 The provided method for generating test scripts.
[0094] This instruction manual also provides Figure 4 The diagram shows a schematic structural representation of the electronic device. Figure 4 At the hardware level, the electronic device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other hardware required for the business operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it to achieve the above-mentioned functions. Figure 1 The test script generation method described above. Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0095] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0096] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0097] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0098] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.
[0099] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0100] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0101] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0102] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0103] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0104] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0105] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media 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 memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0106] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0107] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0108] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0109] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0110] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.
Claims
1. A test script generation method characterized by comprising: include: Obtain the original test script under the first operating system; Furthermore, in the second operating system, the page to be tested corresponding to the original test script is determined as the designated page; Determine the object being manipulated and the operation behavior in the original test script; Determine the identifier of the object being operated on; Furthermore, the test page corresponding to the original test script is determined in the first operating system and used as the original page; Based on the identifier of the object being manipulated, the text of the object being manipulated is determined in the original page and used as the first text. Based on the first text, determine the object corresponding to the text that matches the first text on the designated page, and use it as the object to be identified; When the object to be identified is unique, the object to be identified is taken as the designated object; When the object to be identified is not unique, the attributes of the object being operated on, other than the text, are determined as standard attributes. Furthermore, for each object to be identified, the attributes of that object other than the text are determined as the attributes to be identified; Identify the object to be identified corresponding to the attribute to be identified that matches the standard attribute, and designate it as the specified object; If no matching text exists on the specified page, the server can convert the object being manipulated into an image on the original page. Based on the converted image, the server can then determine the object on the specified page that matches the image, and use this object as the specified object. In the original page, the image corresponding to the object being operated on is determined as the standard image. In the designated page, the object corresponding to the image with the highest similarity to the standard image (not less than a specified threshold) is determined as the designated object. When there is no image on the specified page that has a similarity of not less than a specified threshold to the standard image, the standard image is converted into the character corresponding to the standard image, and the character is used as the specified object; Based on the specified object and the operation behavior, a target test script is generated, wherein the target test script is a test script under the second operating system.
2. The method of claim 1, wherein, After generating the target test script, the method further includes: When the target test script is executed in the second operating system, the characters of the specified object are converted into images; On the specified page, the object corresponding to the image with the highest similarity to the converted image is identified as the object to be operated on in the target test script; Based on the operation behavior, the manipulated object in the target test script is operated.
3. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method as described in any one of claims 1 to 2.
4. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 2.