Automated testing method and device
By using automated testing methods to obtain device information and perform consistency verification, the problems of traditional testing tools being time-consuming and inaccurate are solved, and efficient and accurate automated testing is achieved.
Patent Information
- Application Number
- CN202210615188.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2042-05-31
AI Technical Summary
Traditional testing tools require manual operation, which is time-consuming and inaccurate, and easily leads to operator fatigue and errors.
Through the automated testing method, a port device list is obtained, the ports are traversed to obtain the first device information, the devices are scanned to obtain the second device information, and consistency verification is performed. Automated testing is achieved using automated scripts and verification units.
It reduces manual operation time, reduces human resource costs, and improves testing efficiency and accuracy.
Smart Images

Figure CN114860613B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automated testing, and in particular to an automated testing method and a testing device. Background Art
[0002] Traditional testing tools require manual login, clicking the detection option and scanning device button, waiting for the workstation APP (Application) to scan, and manually observing whether the scan results are correct. This testing method consumes a lot of time and has a cumbersome workload, which can easily cause operators to make mistakes due to eye fatigue, affecting the accuracy of the test. Summary of the Invention
[0003] In view of this, the present invention provides an automated testing method and testing device, which solve the problem that traditional testing tools can only be operated manually, are time-consuming and have low accuracy.
[0004] An automated testing method provided by one embodiment of the present invention includes: obtaining a port device list, the port device list including ports of all connected devices; traversing all ports based on the port device list to obtain first device information corresponding to each port; scanning all devices to obtain second device information; and performing consistency verification based on the first device information and the second device information.
[0005] In one embodiment, obtaining the port device list includes: calling a software development kit preset in the operating system to obtain the port list.
[0006] In one embodiment, traversing all ports based on the port device list to obtain the first device information corresponding to each port includes: sending a command prompt string provided by the first device in the configuration file to the first port in the port device list for inquiry; receiving a first string returned by the first device, and comparing the first string with a confirmation string of the first device in the configuration file; if the first string and the confirmation string match, determining the first device information corresponding to the first port; if the first string and the confirmation string do not match, continuing to send the command prompt string of the next device in the configuration file for inquiry until the device information connected to the first port is confirmed or the inquiry of all devices in the configuration file is completed.
[0007] In one embodiment, scanning all devices to obtain the second device information includes: automatically entering the administrator account and password corresponding to the pre-generated test script into the login window to log in to the target account; if the target account login is successful, scanning all devices to obtain the second device information.
[0008] In one embodiment, the step of scanning all devices to obtain the second device information includes: checking whether the port is open: if the port is open, sending the command prompt string provided by the second device in the configuration file to the second port in the port device list for inquiry; receiving the second string returned by the second device, and comparing the second string with the confirmation string of the second device in the configuration file; if the second string and the confirmation string match, determining the second device information corresponding to the second port; if the second string and the confirmation string do not match, continuing to send the command prompt string of the next device in the configuration file for inquiry until the second device information connected to the second port is determined or the inquiry of all devices in the configuration file is completed.
[0009] In one embodiment, the step of scanning all devices to obtain the second device information includes: if the port cannot be opened, checking the configuration file to determine whether the second device supports the second connection mode; if the second device supports the second connection mode, connecting to the second device through the second connection mode; receiving the second device information sent by the second device through the second connection mode.
[0010] In one embodiment, the method further includes: if the second character string returned by the second device is not received within a preset time, repeatedly sending the command prompt character string provided by the second device in the configuration file to the second port and waiting for the preset time; if the second character string returned by the second device is still not received after sending the command prompt character string provided by the second device a preset number of times, the second device information scan of the second port fails.
[0011] In one embodiment, the method further includes: receiving a start instruction sent by a preset timer task; and executing the step of obtaining a port device list when the start instruction is received.
[0012] In one embodiment, before obtaining the port device list, the method further includes: enabling or disabling some ports to implement test scenarios of connecting different devices.
[0013] In one embodiment, the method further includes: designing a test scenario and writing a corresponding automation script, and debugging the written automation script to generate a test script.
[0014] In one embodiment, the method further includes: after completing the test, exiting to the login window and clearing the cache.
[0015] An automated testing device provided by one embodiment of the present invention includes: a serial port configuration debugging unit, used to obtain a port device list, the port device list including ports of all connected devices; traversing all ports based on the port device list to obtain first device information corresponding to each port; a workstation application software operation simulation unit, used to scan all devices to obtain second device information; and a verification unit, used to perform consistency verification based on the first device information and the second device information.
[0016] In one embodiment, the serial port configuration and debugging unit is further configured to enable or disable a specific port to implement different device connection scenarios.
[0017] An electronic device provided by one embodiment of the present invention includes a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the automated testing method described above.
[0018] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by one or more processors, it is used to implement the automated testing method described above.
[0019] An automated testing method and apparatus provided by embodiments of the present invention implements automated testing by automatically accessing first device information, automatically launching and logging into workstation application software, automatically scanning devices to obtain second device information, and automatically verifying the first and second device information. This method saves manual operation time, reduces the human resource and time costs of manual connection verification testing, and makes test result verification more accurate, thereby improving work efficiency and quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 FIG2 is a flow chart of an automated testing method provided by an embodiment of the present invention.
[0021] Figure 2 FIG2 is a flow chart of obtaining first device information according to an embodiment of the present invention.
[0022] Figure 3 FIG2 is a schematic diagram of a process for obtaining second device information provided by an embodiment of the present invention.
[0023] Figure 4 FIG2 is a schematic structural diagram of an automatic testing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0025] This embodiment provides an automated testing method, which is implemented based on an automated testing device. Figure 1 As shown, the automated testing method includes:
[0026] Step 01: Obtain a port device list, which includes ports of all connected devices.
[0027] The automated testing device receives a startup instruction and obtains a port device list by calling a software development kit (SDK) preset in the operating system. The available port list can be viewed through My Computer -> Management -> Device Manager -> Ports. The port device list contains the port information of all connected devices.
[0028] Step 02: Traverse all ports based on the port device list to obtain first device information corresponding to each port.
[0029] Each device manufacturer will provide the corresponding device instructions, which are used to confirm whether the device is connected properly. Figure 2 As shown, all ports are traversed based on the port device list to obtain the first device information corresponding to each port, including:
[0030] Step 021: Send a command prompt string provided by the first device in the configuration file to the first port in the port device list for inquiry;
[0031] Step 022: Receive a first character string returned by the first device, and compare the first character string with a confirmation character string of the first device in the configuration file;
[0032] Step 023: If the first character string matches the confirmation character string, determine the first device information corresponding to the first port;
[0033] Step 024: If the first character string and the confirmation character string do not match, continue to send the command prompt character string of the next device in the configuration file for inquiry until the device information connected to the first port is confirmed or the inquiry of all devices in the configuration file is completed.
[0034] If we start to traverse the first port (first port) in the port device list, we first send the command prompt (command, cmd) string provided by the electrocardiograph (first device) in the configuration file. The first device will return a string (first string). The string returned by the device connected to the first interface is compared with the ack confirmation character (Acknowledge character, ack) string provided by the electrocardiograph manufacturer. If they are inconsistent, it is considered that the device connected to the port is not an electrocardiograph; the next device in the configuration file, the blood pressure monitor, is asked in turn. If the returned instruction is consistent with that provided by the blood pressure monitor manufacturer, we confirm that the port is connected to the blood pressure monitor device (the device connected to the first port). The information about the blood pressure monitor connected to the first port is recorded in the first device device information. Optionally, the record format is: com port 1-blood pressure monitor-model, and the device information corresponding to the port is stored locally for verification.
[0035] Step 03: Scan all devices to get the second device information.
[0036] The workstation application software is called, and the administrator account and password corresponding to the pre-generated test script are automatically entered in the login window to log in to the target account. If the target account successfully logs in, all devices are scanned to obtain the second device information. Optionally, after the target account successfully logs in, a health check is automatically selected to enter the device scanning page, and the scan device button is clicked to start the scan. Optionally, the preset login process is 5 minutes.
[0037] like Figure 3 As shown, the step of scanning all devices to obtain the second device information includes:
[0038] Step 031: Check whether the port is open. Obtain a port device list by calling the software development kit (SDK) preset in the operating system, and then check whether the port is open. Alternatively, check whether the port is open by calling the system's open function.
[0039] Step 032: If the port is open, send the command prompt string provided by the second device in the configuration file to the second port in the port device list for inquiry.
[0040] If the port can be opened normally, it means that the port is not occupied. At this time, you can send device instructions to the port according to the device information configured in the configuration file, where the device instruction is the command prompt string provided by the device.
[0041] Step 033: Receive a second character string returned by the second device, and compare the second character string with a confirmation character string of the second device in the configuration file;
[0042] If the second string matches the confirmation string, the second device information corresponding to the second port is determined. If the returned second string matches the confirmation string of the second device in the configuration file, the second device corresponding to the second port is confirmed, and the second device information scan of the second port is successful.
[0043] If the second character string does not match the confirmation character string, continue to send the command prompt character string of the next device in the configuration file for inquiry until the information of the second device connected to the second port is determined or the inquiry of all devices in the configuration file is completed.
[0044] In step 034, if the port cannot be opened, the configuration file is checked to determine whether the second device supports the second connection mode. If the second device supports the second connection mode, the second device is connected via the second connection mode. The second device information sent by the second device via the second connection mode is received. It should be understood that step 034 is not a step after step 033. The numbering is merely a designation and does not represent the order of execution.
[0045] If the device supports both connection modes, such as serial port and Bluetooth, the test device and the test equipment will be connected via Bluetooth. Bluetooth is enabled and a Bluetooth connection is established. Based on wireless communication technology, the test equipment receives and parses the messages broadcast by the Bluetooth device, obtaining device information such as the device type and model. The workstation application software then sends Bluetooth control messages corresponding to the control information to control the Bluetooth device.
[0046] When the workstation application software checks the port and calls the system open function and returns an exception and cannot be opened, it indicates that the port is in an occupied state. It may be that other devices have not released the port after disconnection, resulting in the inability to scan for connected devices by sending commands. At this time, the workstation application software checks the configuration file to determine whether the device supports the second connection mode. If it supports the second connection mode, it also connects to the device through the second connection mode; if it does not support the second mode, the port scan fails and the reason for the failure is recorded. Optionally, the way to record the reason for the port scan failure can be: Port X is already in an occupied state.
[0047] Step 4: Perform a consistency check based on the first and second device information. After traversing the port list, the first device information is obtained and passed to the verification tool. After the workstation application scans the port-connected devices, it obtains the second device information and sends the first and second device information to the verification tool. Finally, the verification tool performs a consistency check on the first and second device information.
[0048] Compare the port list one by one to see if they are consistent, for example: whether the port number is consistent, whether the device name string is consistent, whether the device model string is consistent, etc., based on the string selection principle of whether it is a full match. If all attributes match successfully, the workstation scan result is considered correct, the verification is consistent, the verification passes, and the test of the device is marked as passed.
[0049] If at least one attribute check is inconsistent, the verification fails and the device test case is marked as failed. Attribute inconsistencies include inconsistent serial port numbers, inconsistent device types, and no device model returned. Any of these inconsistencies will result in a device scan failure and a failure description will be recorded. For example, if the device model is NULL, the failure description may be NULL. Optionally, for Bluetooth-connected devices, only the device type and model are verified, omitting the serial port number. Upon completion, a test report listing the test results will be sent to the relevant test developers.
[0050] In one embodiment of the present invention, the automated testing method further includes: if the second character string returned by the second device is not received within a preset time, repeatedly sending the command prompt character string provided by the second device in the configuration file to the second port and waiting for a preset time; if the second character string returned by the second device is still not received after sending the command prompt character string provided by the second device a preset number of times, the second device information scan of the second port fails.
[0051] Define the time for the receiving device to return the instruction. If it times out, resend the instruction for confirmation. If it exceeds the preset number of times, no more instructions will be sent, and the connection will be considered abnormal, the scan will fail, and the failure will be recorded. Optionally, the reason for the scan port failure can be recorded as: connection timeout.
[0052] In one embodiment of the present invention, the automated testing method further includes: receiving a startup instruction from a preset scheduled task; upon receiving the startup instruction, executing the step of obtaining a port device list. Windows scheduled tasks can implement scheduled script execution, Windows can add scheduled tasks, and batch files can be used to execute scheduled batch files. Batch files can be used to write executable files that execute automated scripts, thereby implementing scheduled startup testing. Upon receiving the startup instruction from Windows during the set time period, steps 01 to 04 are executed.
[0053] In one embodiment of the present invention, before obtaining the port device list, the method further includes: enabling or disabling some ports to implement test scenarios of connecting different devices.
[0054] By enabling and disabling specific ports, different device connection scenarios can be implemented. For example, the test scenario of connecting only three devices includes: ① Testing only port 1 connected to device one, disabling port 2 and port 3 by calling the system SDK, and verifying whether device one is correctly scanned and identified; ② Testing only port 2 connected to device two, disabling port 1 and port 3 by calling the system SDK, and verifying whether device two is correctly scanned and identified; ③ Testing only port 3 connected to device three, disabling port 1 and port 2 by calling the system SDK, and verifying whether device three is correctly scanned and identified; ④ Testing that both port 1 and port 2 are connected to devices, disabling port 3 by calling the system SDK, and verifying whether device one and device two are correctly scanned and identified; ⑤ Testing that both port 1 and port 3 are connected to devices, disabling port 2 by calling the system SDK, and verifying whether device one and device three are correctly scanned and identified; ⑥ Testing that both port 2 and port 3 are connected to devices, disabling port 1 by calling the system SDK, and verifying whether device two and device three are correctly scanned and identified; ⑦ Testing that all three ports are connected to devices, enabling all ports by calling the system SDK, and verifying whether device one, device two, and device three are all correctly scanned and identified. Through full-scenario testing, we ensure that single and simultaneous connections between different devices do not interfere with each other, and that the addition of new devices does not affect the scanning and recognition of existing devices. Three devices require seven scenarios. As more new devices are added, they must be tested in combination with existing devices. More test scenarios will be designed, and application automation will significantly save manpower and time.
[0055] In one embodiment of the present invention, the automated testing method further includes: designing a test scenario and writing a corresponding automated script, and debugging the written automated script to generate a test script.
[0056] In one embodiment of the present invention, the automated testing method further includes: exiting to the login window and clearing the cache after the test is completed. After a test process is completed, the workstation returns to the previous login page, exits the current scan results, and clears the cache to avoid affecting the scan of the next scene.
[0057] In one embodiment of the present invention, before starting the automated test, it is necessary to connect the test equipment to the USB hub expansion serial port, manually connect all the test detection devices, start all the devices, and thus set up the test environment.
[0058] This embodiment provides an automated testing device 100, such as Figure 4 As shown, the automated testing device 100 includes a serial port configuration and debugging unit 10 , a workstation application software operation simulation unit 20 , and a verification unit 3 .
[0059] in:
[0060] The serial port configuration and debugging unit 10 is used to obtain a port device list, the port device list including ports of all connected devices; traverse all ports based on the port device list to obtain first device information corresponding to each port;
[0061] The workstation application software operation simulation unit 20 is used to scan all devices to obtain the second device information;
[0062] The verification unit 30 is configured to perform consistency verification based on the first device information and the second device information.
[0063] Furthermore, the serial port configuration and debugging unit 10 is configured to call a software development kit preset in the operating system to obtain a port list. The serial port configuration and debugging unit 10 is configured to send a command prompt string provided by a first device in a configuration file to a first port in the port device list for inquiry; receive a first string returned by the first device, and compare the first string with a confirmation string of the first device in the configuration file; if the first string and the confirmation string match, determine the first device information corresponding to the first port; if the first string and the confirmation string do not match, continue to send a command prompt string for the next device in the configuration file for inquiry until the device information connected to the first port is confirmed or the inquiry of all devices in the configuration file is completed.
[0064] Furthermore, the workstation application software operation simulation unit 20 is used to automatically input the administrator account and password corresponding to the pre-generated test script into the login window to log in to the target account; if the target account logs in successfully, all devices are scanned to obtain the second device information.
[0065] The workstation application software operation simulation unit 20 is further configured to verify whether a port is open: if the port is open, the command prompt string provided by the second device in the configuration file is sent to the second port in the port device list for query; a second string returned by the second device is received, and the second string is compared with a confirmation string of the second device in the configuration file; if the second string and the confirmation string match, the second device information corresponding to the second port is determined; if the second string and the confirmation string do not match, the command prompt string of the next device in the configuration file is sent for query until the second device information connected to the second port is determined or all devices in the configuration file are queried. If the port cannot be opened, the configuration file is checked to determine whether the second device supports the second connection mode; if the second device supports the second connection mode, the second device is connected via the second connection mode; and the second device information sent by the second device via the second connection mode is received.
[0066] The serial port configuration and debugging unit 20 is further used to enable or disable a specific port to implement different device connection scenarios.
[0067] This embodiment provides an electronic device, which may be a mobile phone, computer, or tablet computer, including a memory and a processor. The memory stores a computer program that, when executed by the processor, implements the automated testing method described in the embodiment. It is understood that the electronic device may also include an input / output (I / O) interface and a communication component.
[0068] The processor is used to execute all or part of the steps in the automated testing method in the embodiment. The memory is used to store various types of data, which may include instructions of any application or method in the electronic device, as well as application-related data.
[0069] The processor can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components to execute the automated testing method in the above embodiment.
[0070] The memory can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0071] This embodiment provides a computer-readable storage medium. The functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. If the functions are implemented as software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium.
[0072] Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention.
[0073] The aforementioned storage media include: flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, server, APP application store, and other media that can store program check codes, on which a computer program is stored. When the computer program is executed by a processor, the following method steps can be implemented:
[0074] Step 01: Obtain a port device list, which includes ports of all connected devices;
[0075] Step 02: traverse all ports based on the port device list to obtain first device information corresponding to each port;
[0076] Step 03: Scan all devices to obtain the second device information;
[0077] Step 04: Perform a consistency check based on the first device information and the second device information.
[0078] Those skilled in the art will appreciate that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0079] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. On the other hand, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0080] The basic principles of the present application have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, and effects mentioned in this application are merely illustrative and not restrictive, and it should not be assumed that these advantages, strengths, and effects are required of each embodiment of this application. In addition, the specific details disclosed above are merely illustrative and facilitating understanding, and are not restrictive. The above details do not limit this application to necessarily being implemented using the above specific details.
[0081] The block diagrams of devices, apparatuses, equipment, and systems referred to in this application are intended only as illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems may be connected, arranged, or configured in any manner.
[0082] It should also be noted that in the apparatus, device, and method of the present application, each component or each step can be decomposed and / or recombined, and such decomposition and / or recombination should be regarded as equivalent solutions of the present application.
[0083] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0084] In the description of the application, the meaning of "multiple" is at least two, for example two, three, etc., unless otherwise clearly and specifically limited. In the embodiments of the present application, all directional indications (such as up, down, left, right, front, back, top, bottom ...) are only used to explain the relative position relationship, motion situation, etc. between each component under a certain specific posture (as shown in the drawings). If this specific posture changes, this directional indication also changes accordingly. In addition, the terms "comprise" and "have" and any deformation thereof are intended to cover non-exclusive inclusion. For example, the process, method, system, product or equipment comprising a series of steps or units is not limited to the steps or units listed, but optionally also includes the steps or units not listed, or optionally also includes other steps or units inherent to these processes, methods, products or equipment.
[0085] In addition, references to "embodiments" herein mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of such phrases in various places in the specification does not necessarily refer to the same embodiment, nor does it necessarily refer to independent or alternative embodiments that are mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0086] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
[0087] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. An automated testing method, characterized in that: include: Obtain a port device list, the port device list including ports of all connected devices; Traversing all ports based on the port device list to obtain first device information corresponding to each port; Scan all devices to obtain the second device information; performing a consistency check based on the first device information and the second device information; The traversing all ports based on the port device list to obtain first device information corresponding to each port includes: Sending a command prompt string provided by the first device in the configuration file to the first port in the port device list for inquiry; receiving a first character string returned by the first device, and comparing the first character string with a confirmation character string of the first device in the configuration file; If the first character string matches the confirmation character string, determining first device information corresponding to the first port; If the first character string and the confirmation character string do not match, continue to send the command prompt character string of the next device in the configuration file for inquiry until the device information connected to the first port is confirmed or the inquiry of all devices in the configuration file is completed; The scanning all devices to obtain the second device information includes: Automatically enter the administrator account and password corresponding to the pre-generated test script into the login window to log in to the target account; If the target account is successfully logged in, scanning all devices to obtain the second device information; The step of scanning all devices to obtain the second device information includes: Verify that the port is open: If the port is open, sending a command prompt string provided by the second device in the configuration file to the second port in the port device list for inquiry; receiving a second character string returned by the second device, and comparing the second character string with a confirmation character string of the second device in the configuration file; If the second character string matches the confirmation character string, determining the second device information corresponding to the second port; If the second character string does not match the confirmation character string, continue to send the command prompt character string of the next device in the configuration file for inquiry until the information of the second device connected to the second port is determined or the inquiry of all devices in the configuration file is completed.
2. The method according to claim 1, characterized in that The obtaining of the port device list includes: calling a software development kit preset in the operating system to obtain the port list.
3. The automated testing method according to claim 1, wherein: The step of scanning all devices to obtain the second device information includes: If the port cannot be opened, checking the configuration file to determine whether the second device supports the second connection mode; If the second device supports the second connection mode, connect to the second device through the second connection mode; Receive the second device information sent by the second device through the second connection mode.
4. The automated testing method according to claim 1, wherein: The method also includes: if the second character string returned by the second device is not received within a preset time, repeatedly sending the command prompt character string provided by the second device in the configuration file to the second port and waiting for the preset time; if the second character string returned by the second device is still not received after sending the command prompt character string provided by the second device a preset number of times, then the second device information scan of the second port fails.
5. The automated testing method according to claim 1, wherein: The method further comprises: Receive the start instruction sent by the preset scheduled task; When the start instruction is received, the step of obtaining a port device list is performed.
6. The automated testing method according to claim 1, wherein: Before getting the port device list, also include: Enable or disable some ports to implement test scenarios for different device connections.
7. The automated testing method according to claim 1, wherein: Also includes: Design test scenarios and write corresponding automation scripts, and debug the written automation scripts to generate test scripts.
8. The automated testing method according to claim 1, wherein: The method further includes: after completing the test, exiting to the login window and clearing the cache.
9. An automated testing device, characterized in that: include: A serial port configuration and debugging unit is used to obtain a port device list, wherein the port device list includes ports of all connected devices; Traversing all ports based on the port device list to obtain first device information corresponding to each port; The workstation application software operates a simulation unit for scanning all devices to obtain second device information; a verification unit, configured to perform consistency verification based on the first device information and the second device information; The serial port configuration debugging unit is used for: Sending a command prompt string provided by the first device in the configuration file to the first port in the port device list for inquiry; receiving a first character string returned by the first device, and comparing the first character string with a confirmation character string of the first device in the configuration file; If the first character string matches the confirmation character string, determining first device information corresponding to the first port; If the first character string and the confirmation character string do not match, continue to send the command prompt character string of the next device in the configuration file for inquiry until the device information connected to the first port is confirmed or the inquiry of all devices in the configuration file is completed; The workstation application software operation simulation unit is used for: Automatically enter the administrator account and password corresponding to the pre-generated test script into the login window to log in to the target account; If the target account is successfully logged in, scanning all devices to obtain the second device information; The workstation application software operation simulation unit is further used for: Verify that the port is open: If the port is open, sending a command prompt string provided by the second device in the configuration file to the second port in the port device list for inquiry; receiving a second character string returned by the second device, and comparing the second character string with a confirmation character string of the second device in the configuration file; If the second character string matches the confirmation character string, determining the second device information corresponding to the second port; If the second character string does not match the confirmation character string, continue to send the command prompt character string of the next device in the configuration file for inquiry until the information of the second device connected to the second port is determined or the inquiry of all devices in the configuration file is completed.
10. The automated testing device according to claim 9, characterized in that: The serial port configuration and debugging unit is further used to enable or disable some ports to implement different device connection scenarios.
11. An electronic device, characterized in that: The system comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein when the one or more computer instructions are executed by the processor, the automated testing method as described in any one of claims 1 to 8 is implemented.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, it is used to implement the automated testing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Scanning method and device of loophole
CN106650458A
Equipment identification method and system, electronic device and storage medium
CN113300915A