CN111190830B - Method and device for automatically identifying computer port state and starting test program - Google Patents
Method and device for automatically identifying computer port state and starting test program Download PDFInfo
- Publication number
- CN111190830B CN111190830B CN201911425831.2A CN201911425831A CN111190830B CN 111190830 B CN111190830 B CN 111190830B CN 201911425831 A CN201911425831 A CN 201911425831A CN 111190830 B CN111190830 B CN 111190830B
- Authority
- CN
- China
- Prior art keywords
- characteristic data
- return value
- equipment
- port
- button
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Abstract
The invention discloses a method and a device for automatically identifying the state of a computer port and starting a test program, wherein the method comprises the following steps: a. transmitting a command for acquiring the port connection state and obtaining a corresponding return value; b. judging whether the port is connected with equipment to be tested or not according to the return value; if the port is connected with the equipment to be tested, executing the step c; c. analyzing the characteristic data of the obtained return value and comparing the characteristic data with the first characteristic data of the hardware ID which is identified when the equipment is connected for the first time and the second characteristic data of the hardware ID which is identified when the equipment is connected for the second time and stored in the configuration file; if the characteristic data of the return value accords with the first characteristic data, executing the step d, and if the characteristic data of the return value accords with the second characteristic data, returning to the step a; d. determining the position of a button according to the information of the button of the test program stored in the configuration file; e. and c, controlling the mouse to move to the position of the button and clicking, and returning to the step a after clicking is completed.
Description
Technical Field
The present invention relates to the field of device testing technologies, and in particular, to a method and an apparatus for automatically identifying a computer port state and starting a test program.
Background
At present, when equipment such as a mobile phone is connected to a test computer to perform operations such as testing, the connection state of the equipment is usually determined manually, and corresponding buttons of test software are clicked according to the determination result of the connection state to perform operations such as corresponding testing or number writing. In order to solve the above problem, a test program is clicked according to a fixed time, however, the test program is easy to be clicked automatically without inserting equipment, and the test program is wrongly reported, and a lot of manual participation is still needed.
Disclosure of Invention
The invention aims to provide a method and a device for automatically identifying the state of a computer port and starting a test program and a readable storage medium, which are beneficial to reducing the manufacturing cost.
In order to achieve the above object, the present invention provides a method for automatically identifying the status of a computer port and starting a test program, comprising the steps of:
a. transmitting a command for acquiring the connection state of the port to a corresponding processing module and obtaining a corresponding return value, wherein when the port is connected with equipment to be tested, the return value is the hardware ID of the equipment;
b. judging whether the port is connected with equipment to be tested or not according to the return value; if the port is connected with the equipment to be tested, executing the step c;
c. analyzing the obtained characteristic data of the return value and comparing the characteristic data with the first characteristic data of the hardware ID which is identified when the equipment is connected for the first time and the second characteristic data of the hardware ID which is identified when the equipment is connected for the second time and stored in the configuration file; if the characteristic data of the return value accords with the first characteristic data, executing step d, and if the characteristic data of the return value accords with the second characteristic data, returning to step a;
d. determining the position of a button of the test program according to the information of the button of the test program stored in the configuration file; a kind of electronic device with high-pressure air-conditioning system
e. And c, controlling the mouse to move to the position of the button and clicking, and returning to the step a after clicking is completed.
Preferably, in the step c, the "characteristic data of the return value obtained by analysis" specifically includes:
storing the return value into a variable in the form of a list and calculating to obtain the length value of the list as characteristic data of the return value;
the first characteristic data is a length value of a list obtained according to the hardware ID identified when the device is connected for the first time, and the second characteristic data is a length value of a list obtained according to the hardware ID identified when the device is connected again.
Preferably, step d comprises:
searching the picture of the button on a desktop according to the picture path of the button stored in the configuration file and obtaining a return value comprising picture position information or a return value indicating that the picture is not found; a kind of electronic device with high-pressure air-conditioning system
When a picture of the button is found, center coordinates of the picture of the button are calculated according to the return value including the picture position information.
In order to achieve the above object, the present invention further provides an apparatus for automatically identifying a status of a computer port and starting a test program, comprising:
a processor;
a memory; and
a computer program stored on the memory and executable on the processor, the program comprising means for performing the method of automatically identifying computer port status and initiating a test program as described above.
In order to achieve the above object, the present invention also provides a readable storage medium having stored thereon a program which, when executed by a processor, implements the method of automatically recognizing a computer port state and starting a test program as described above.
Compared with the prior art, the method and the device can automatically judge whether the port is connected with the equipment to be tested, so that the test program is controlled to automatically test according to the judging result, the efficiency is improved, the fatigue of personnel is avoided, and the situation that the equipment is not connected but the equipment is clicked by mistake does not occur. More importantly, when the port is connected with the equipment to be tested, the invention can utilize the characteristic data of the hardware ID returned when the current connection is compared with the preset first characteristic data and second characteristic data, thereby judging whether the current connection is the connection when the equipment is connected with the port for the first time and ready for testing or the reconnection after the disconnection of the final stage of the equipment testing (restarting after the final stage of the testing), further controlling the operation of executing the subsequent button positioning and clicking only when the connection of the equipment is the first connection, effectively avoiding the occurrence of repeated clicking situations and guaranteeing the reliability of the automatic testing of the testing program in the invention.
Drawings
FIG. 1 is a flowchart of a method for automatically identifying the status of a computer port and initiating a test procedure according to an embodiment of the present invention.
FIG. 2 is a schematic block diagram of an apparatus for automatically recognizing the status of a computer port and initiating a test procedure in accordance with the present invention.
Detailed Description
In order to describe the technical content and constructional features of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
Referring to fig. 1, the invention discloses a method for automatically identifying the status of a computer port and starting a test program, which comprises the following steps:
a. and sending a command for acquiring the port connection state to a corresponding processing module and obtaining a corresponding return value, wherein when the port is connected with the equipment to be tested, the return value is the hardware ID of the equipment.
b. Judging whether the port is connected with equipment to be tested or not according to the return value; and c, if the port is connected with the equipment to be tested, executing the step c. And when judging that the port is not connected with the equipment to be tested according to the return value, waiting for the connection of the equipment to be tested.
c. Analyzing the characteristic data of the obtained return value and comparing the characteristic data with the first characteristic data of the hardware ID which is identified when the equipment is connected for the first time and the second characteristic data of the hardware ID which is identified when the equipment is connected for the second time and stored in the configuration file; if the characteristic data of the return value matches the first characteristic data, step d is performed, and if the characteristic data of the return value matches the second characteristic data, step a is returned.
d. And determining the position of the button according to the information of the button of the test program stored in the configuration file.
e. And c, controlling the mouse to move to the position of the button and clicking, and returning to the step a after clicking is completed.
The invention can automatically judge whether the port is connected with the equipment to be tested, thereby being convenient for controlling the testing program to automatically test according to the judging result, being beneficial to improving the efficiency, avoiding the fatigue of personnel and avoiding the occurrence of the situation that the equipment is not connected but the equipment is clicked by mistake. More importantly, when the port is connected with the equipment to be tested, the invention can utilize the characteristic data of the hardware ID returned when the current connection is compared with the preset first characteristic data and second characteristic data, thereby judging whether the current connection is the connection when the equipment is connected with the port for the first time and ready for testing or the reconnection after the disconnection of the final stage of the equipment testing (restarting after the final stage of the testing), further controlling the operation of executing the subsequent button positioning and clicking only when the connection of the equipment is the first connection, effectively avoiding the occurrence of repeated clicking situations and guaranteeing the reliability of the automatic testing of the testing program in the invention.
When each device is tested, a restart, i.e., a disconnection followed by a reconnection, is performed to the final stage of the test. In order to prevent repeated clicking actions when the same device is reconnected, the invention uses the principle that when the device is connected to the port each time, the computer recognizes different hardware IDs to judge whether the current connection is the first connection of the device or the reconnection of the device in the final stage of the test. That is, each time the same device is connected, the return values obtained by the program are different, and accordingly, different characteristics of the two return values can be analyzed to accurately determine whether the current connection is the first connection of the device or the reconnection of the last stage of the test, thereby deciding whether to continue to perform the subsequent button positioning and clicking steps or return to step a. It will be appreciated that the hardware ID identified when each device to be tested is first connected has the same characteristics as the hardware ID identified when it is reconnected.
In some embodiments, in step c, "characteristic data of the return value obtained by analysis" is specifically:
storing the return value into a variable in the form of a list and calculating to obtain the length value of the list of the characteristic data serving as the return value;
the first characteristic data is a length value of a list obtained from a hardware ID identified when the device is connected for the first time, and the second characteristic data is a length value of a list obtained from a hardware ID identified when the device is connected again.
Because the length of the list is different when the hardware ID identified during each connection of the equipment is stored in the variable in the form of the list, the list length value corresponding to the hardware ID when the equipment is currently connected is compared with the list length value corresponding to the hardware ID when the preset equipment is first connected and the list length value corresponding to the hardware ID when the equipment is second connected, so that whether the current connection of the equipment is the first connection or the reconnection after the disconnection of the last stage of the equipment test can be accurately obtained, and the occurrence of repeated clicking is effectively avoided.
In some embodiments, step d comprises:
searching the picture of the button on the desktop according to the picture path of the button stored in the configuration file and obtaining a return value comprising picture position information or a return value indicating that the picture is not found; a kind of electronic device with high-pressure air-conditioning system
When a picture of the button is found, center coordinates of the picture of the button are calculated from the return value including the picture position information.
The center coordinates of the pictures of the buttons are calculated in the mode, and the script of the test program does not need to be changed.
The composition or acquisition of the picture position information is prior art in the art and will not be described in detail here. For example, the picture position information returned in a particular case may include the abscissa and ordinate of the lower right corner thereof and the height and width of the picture.
Of course, the present invention is not limited to the positions of the buttons determined according to the above manner, and the related information of the buttons stored in the configuration file may be information of other aspects.
Referring to fig. 2, the invention also discloses a device for automatically identifying the status of a computer port and starting a test program, which comprises:
a processor 10;
a memory 20; and
a computer program on the memory 20 and executable on the processor 10 is stored, the program comprising means for performing the method of automatically identifying the status of a computer port and initiating a test program as described above.
In addition, the present invention also provides a readable storage medium having a program stored thereon, which when executed by the processor 10 implements the method for automatically identifying the status of a computer port and starting a test program as described above.
The foregoing disclosure is only illustrative of the preferred embodiments of the present invention and is not to be construed as limiting the scope of the invention, which is defined by the appended claims.
Claims (4)
1. A method for automatically identifying the status of a computer port and initiating a test procedure, comprising the steps of:
a. transmitting a command for acquiring the connection state of the port to a corresponding processing module and obtaining a corresponding return value, wherein when the port is connected with equipment to be tested, the return value is the hardware ID of the equipment;
b. judging whether the port is connected with equipment to be tested or not according to the return value; if the port is connected with the equipment to be tested, executing the step c;
c. analyzing the obtained characteristic data of the return value and comparing the characteristic data with the first characteristic data of the hardware ID which is identified when the equipment is connected for the first time and the second characteristic data of the hardware ID which is identified when the equipment is connected for the second time and stored in the configuration file; if the characteristic data of the return value accords with the first characteristic data, executing step d, and if the characteristic data of the return value accords with the second characteristic data, returning to step a;
d. determining the position of a button of the test program according to the information of the button of the test program stored in the configuration file; a kind of electronic device with high-pressure air-conditioning system
e. C, controlling the mouse to move to the position of the button and clicking, and returning to the step a after clicking is completed;
in step c, the characteristic data of the return value obtained by analysis specifically includes:
storing the return value into a variable in the form of a list and calculating to obtain the length value of the list as characteristic data of the return value;
the first characteristic data is a length value of a list obtained according to the hardware ID identified when the device is connected for the first time, and the second characteristic data is a length value of a list obtained according to the hardware ID identified when the device is connected again.
2. The method of automatically identifying a status of a computer port and initiating a test procedure as recited in claim 1, wherein step d comprises:
searching the picture of the button on a desktop according to the picture path of the button stored in the configuration file and obtaining a return value comprising picture position information or a return value indicating that the picture is not found; a kind of electronic device with high-pressure air-conditioning system
When a picture of the button is found, center coordinates of the picture of the button are calculated according to the return value including the picture position information.
3. An apparatus for automatically identifying a status of a computer port and initiating a test procedure, comprising:
a processor;
a memory; and
a computer program stored on said memory and executable on said processor, said program comprising means for performing the method of automatically identifying a computer port status and initiating a test program as claimed in claim 1 or 2.
4. A computer readable storage medium having a program stored thereon, wherein the program when executed by a processor implements the method of automatically identifying a computer port state and initiating a test program as claimed in claim 1 or 2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911425831.2A CN111190830B (en) | 2019-12-31 | 2019-12-31 | Method and device for automatically identifying computer port state and starting test program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911425831.2A CN111190830B (en) | 2019-12-31 | 2019-12-31 | Method and device for automatically identifying computer port state and starting test program |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111190830A CN111190830A (en) | 2020-05-22 |
CN111190830B true CN111190830B (en) | 2023-05-16 |
Family
ID=70708121
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911425831.2A Active CN111190830B (en) | 2019-12-31 | 2019-12-31 | Method and device for automatically identifying computer port state and starting test program |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111190830B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000267951A (en) * | 1999-03-16 | 2000-09-29 | Nec Eng Ltd | Data transfer control system and its method |
US7082598B1 (en) * | 2002-07-17 | 2006-07-25 | Vmware, Inc. | Dynamic driver substitution |
CN105866574A (en) * | 2016-03-29 | 2016-08-17 | 东莞华贝电子科技有限公司 | Auxiliary identifying method and auxiliary identifying system for automated testing |
CN108631955A (en) * | 2018-05-15 | 2018-10-09 | 网易(杭州)网络有限公司 | It is a kind of to ensure that message sends reachable mthods, systems and devices |
CN109213669A (en) * | 2017-06-29 | 2019-01-15 | 武汉斗鱼网络科技有限公司 | A kind of page method for testing performance and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002013000A2 (en) * | 2000-06-13 | 2002-02-14 | Pact Informationstechnologie Gmbh | Pipeline configuration unit protocols and communication |
-
2019
- 2019-12-31 CN CN201911425831.2A patent/CN111190830B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000267951A (en) * | 1999-03-16 | 2000-09-29 | Nec Eng Ltd | Data transfer control system and its method |
US7082598B1 (en) * | 2002-07-17 | 2006-07-25 | Vmware, Inc. | Dynamic driver substitution |
CN105866574A (en) * | 2016-03-29 | 2016-08-17 | 东莞华贝电子科技有限公司 | Auxiliary identifying method and auxiliary identifying system for automated testing |
CN109213669A (en) * | 2017-06-29 | 2019-01-15 | 武汉斗鱼网络科技有限公司 | A kind of page method for testing performance and device |
CN108631955A (en) * | 2018-05-15 | 2018-10-09 | 网易(杭州)网络有限公司 | It is a kind of to ensure that message sends reachable mthods, systems and devices |
Also Published As
Publication number | Publication date |
---|---|
CN111190830A (en) | 2020-05-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8443381B2 (en) | API evaluation system in embedded device | |
CN106982368B (en) | Video response speed detection method and system | |
CN109606880B (en) | Labeling condition detection method and device based on image recognition and labeling control system | |
CN111782492A (en) | Page first screen loading duration testing method and device, computer equipment and medium | |
CN109359043B (en) | Mobile game automatic testing method based on machine learning | |
CN110806965A (en) | Automatic test method, device, equipment and medium | |
CN105100852B (en) | Voice remote control method, the apparatus and system of terminal | |
CN111190830B (en) | Method and device for automatically identifying computer port state and starting test program | |
CN113821433A (en) | Method, device, equipment, medium and product for testing cloud mobile phone application program | |
CN110830796A (en) | Television application testing method, television application testing device and readable storage medium | |
CN111722997B (en) | Abnormality detection method for automated test and computer-readable storage medium | |
CN112289345B (en) | Visual intelligent terminal voice diagnosis method | |
CN115904883A (en) | RPA flow execution visualization abnormity monitoring method, device and medium | |
CN115827435A (en) | Front-end performance testing method, electronic device and computer-readable storage medium | |
CN114721968A (en) | Test method, test device and storage medium | |
CN114756448A (en) | Automatic testing system and method for reduction degree of user interface | |
CN113360414A (en) | Software testing method, device, readable storage medium and computer program product | |
CN106775701B (en) | Client automatic evidence obtaining method and system | |
CN116781771B (en) | Automatic screen capturing picture analysis method of station machine by using OCR technology | |
CN106685754B (en) | Test method, test equipment and test system for terminal file transmission | |
CN109685151B (en) | Circuit board material number identification method and device and computer readable storage medium | |
CN114266994A (en) | Application program starting speed detection method and device and electronic equipment | |
CN113743701A (en) | Office equipment positioning method and device based on big data and computer equipment | |
CN115250260A (en) | Method and system for detecting unilateral deleted friends of social application, storage medium and computer equipment | |
CN117851230A (en) | Interface testing method, device, terminal equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |