Date control testing method and device, electronic equipment and computer storage medium
By receiving the expected date in automated tests, determining the operation information, and obtaining the size information and preset position coordinates of the date control elements, the problem that date control tests are affected by screen resolution in the prior art is solved, and a more efficient testing process is achieved.
Patent Information
- Application Number
- CN202411634383.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-07
AI Technical Summary
In the automated testing of the prior art, when selecting date controls by scrolling, they are greatly affected by the screen resolution, the operation takes a long time, and it is difficult to effectively reduce this impact.
By receiving the expected date, determining the operation information based on the expected date and the default date, obtaining the size information of the date control element and the preset position coordinates, determining the coordinates of the target control point, and testing according to the operation information to generate test results.
Reduces the screen resolution impact of date controls during testing and improves testing efficiency.
Smart Images

Figure CN119576772A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of software testing, and in particular to a testing method, device, electronic equipment and computer storage medium for a date control. Background Art
[0002] The date control is a common function that allows users to select dates, such as birthdays, certificate validity periods, etc. A common way to interact with date controls is: click to pop up a selection box at the bottom, and select the year, month, and day by scrolling. After selecting, click to confirm and close the pop-up window. When performing automated testing, if there is a scrolling date selection control, and you want to scroll to the expected date, the input parameters of the existing technology require the input of fixed Bounds coordinates (Bounds is used to represent a rectangular area, usually defined by the coordinates of the upper left and lower right corners). Each time you slide, you need to look for the expected year control to see if the control exists. This method is greatly affected by the screen resolution, and the starting and end points of different resolutions are different. At the same time, the operation takes a long time. Summary of the invention
[0003] In view of this, the present application provides a test method, device, electronic device and computer storage medium for a date control, which reduce the impact of screen resolution on the date control during the test process and improve the test efficiency.
[0004] The first aspect of the present application provides a method for testing a date control, comprising:
[0005] Receiving an expected date; wherein the expected date includes an expected year, an expected month, and an expected day;
[0006] Determine the operation information of this test according to the expected date and the default date; wherein the default date includes a default year, a default month and a default day; and the operation information of this test includes year operation information, month operation information and day operation information;
[0007] For each element control in the date control to be tested, obtain the size information of the element control and the coordinates of the preset position of the element control; wherein the element control includes a year element control, a month element control and a day element control;
[0008] Determine the target control point coordinates of the element control according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control;
[0009] Performing a test at the target control point coordinates of the element control according to the operation information of this test to obtain a test result of the element control;
[0010] The test result of the date control to be tested is generated according to the test results of all the element controls.
[0011] Optionally, determining the operation information of this test according to the expected date and the default date includes:
[0012] Determine the year operation information according to the difference between the expected year and the default year; wherein the year operation information includes the target control point of the year element control in this test and the number of clicks on the target control point of the year element control; the target control point of the year element control is the upper control point of the year element control or the lower control point of the year element control;
[0013] Determine the month operation information according to the difference between the expected month and the default month; wherein the month operation information includes the target control point of the month element control in this test and the number of clicks on the target control point of the month element control; the target control point of the month element control is the upper control point of the month element control or the lower control point of the month element control;
[0014] The daily operation information is determined based on the difference between the expected day and the default day; wherein the monthly operation information includes the target control point of the daily element control of this test and the number of clicks on the target control point of the daily element control; the target control point of the daily element control is the upper control point of the daily element control or the lower control point of the daily element control.
[0015] Optionally, determining the target control point coordinates of the element control according to the operation information of this test, the size information of the element control, and the coordinates of the preset position of the element control includes:
[0016] Determine the coordinates of all target positions of the element control according to the size information of the element control and the coordinates of the preset position of the element control;
[0017] Determine the coordinates of the center point of the element control according to the coordinates of all target positions of the element control and the coordinates of the preset position of the element control;
[0018] According to the operation information of this test and the center point coordinates of the element control, the target control point coordinates of the element control are determined.
[0019] Optionally, the default date is the current system date.
[0020] The second aspect of the present application provides a testing device for a date control, comprising:
[0021] A receiving unit, configured to receive an expected date; wherein the expected date includes an expected year, an expected month and an expected day;
[0022] A first determining unit is used to determine the operation information of this test according to the expected date and the default date; wherein the default date includes a default year, a default month and a default day; and the operation information of this test includes year operation information, month operation information and day operation information;
[0023] An acquisition unit, used for acquiring, for each element control in the date control to be tested, size information of the element control and coordinates of a preset position of the element control; wherein the element controls include a year element control, a month element control and a day element control;
[0024] A second determining unit is used to determine the coordinates of the target control point of the element control according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control;
[0025] A testing unit, used for testing the target control point coordinates of the element control according to the operation information of this test to obtain the test result of the element control;
[0026] A generating unit is used to generate the test result of the date control to be tested according to the test results of all the element controls.
[0027] Optionally, the first determining unit includes:
[0028] A year operation information determination unit, used to determine the year operation information according to the difference between the expected year and the default year; wherein the year operation information includes the target control point position of the year element control in this test and the number of clicks on the target control point position of the year element control; the target control point position of the year element control is the upper control point position of the year element control or the lower control point position of the year element control;
[0029] A month operation information determination unit, used to determine the month operation information according to the difference between the expected month and the default month; wherein the month operation information includes the target control point of the month element control in this test and the number of clicks on the target control point of the month element control; the target control point of the month element control is the upper control point of the month element control or the lower control point of the month element control;
[0030] The daily operation information determination unit is used to determine the daily operation information according to the difference between the expected day and the default day; wherein the monthly operation information includes the target control point of the daily element control of this test and the number of clicks on the target control point of the daily element control; the target control point of the daily element control is the upper control point of the daily element control or the lower control point of the daily element control.
[0031] Optionally, the second determining unit includes:
[0032] A first coordinate determining unit, configured to determine the coordinates of all target positions of the element control according to the size information of the element control and the coordinates of the preset position of the element control;
[0033] A second coordinate determining unit, configured to determine the coordinates of the center point of the element control according to the coordinates of all target positions of the element control and the coordinates of the preset position of the element control;
[0034] The third coordinate determination unit is used to determine the target control point coordinates of the element control according to the operation information of this test and the center point coordinates of the element control.
[0035] Optionally, the default date is the current system date.
[0036] A third aspect of the present application provides an electronic device, including:
[0037] one or more processors;
[0038] a storage device having one or more programs stored thereon;
[0039] When the one or more programs are executed by the one or more processors, the one or more processors implement the date control testing method as described in any one of the first aspects.
[0040] A fourth aspect of the present application provides a computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the date control testing method as described in any one of the first aspects is implemented.
[0041] As can be seen from the above scheme, the present application provides a test method, device, electronic device and computer storage medium for a date control. After receiving the expected date, the operation information of this test is determined according to the expected date and the default date; then, for each element control in the date control to be tested, the size information of the element control and the coordinates of the preset position of the element control are obtained; then, according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control, the target control point coordinates of the element control are determined; finally, the target control point coordinates of the element control are tested according to the operation information of this test to obtain the test results of the element control; according to the test results of all element controls, the test results of the date control to be tested are generated. This reduces the impact of screen resolution on the date control during the test process and improves the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0043] Figure 1 A specific flow chart of a method for testing a date control provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of a date control provided by another embodiment of the present application;
[0045] Figure 3 A flowchart of a method for determining target control point coordinates of an element control provided by another embodiment of the present application;
[0046] Figure 4 A schematic diagram of a test device for a date control provided in another embodiment of the present application;
[0047] Figure 5 A schematic diagram of an electronic device for implementing a method for testing a date control provided in another embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0050] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0051] It should be noted that the concepts such as "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0052] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0053] The present application embodiment provides a method for testing a date control, such as Figure 1 As shown, the specific steps include:
[0054] S101. Receive expected date.
[0055] Among them, the expected date includes the expected year, expected month and expected day.
[0056] S102. Determine the operation information of this test according to the expected date and the default date.
[0057] The default date includes a default year, a default month, and a default day; the operation information of this test includes yearly operation information, monthly operation information, and daily operation information.
[0058] In the specific implementation process of this application, the default date can be the current system date, that is, the default date displayed when the date control is opened, which is generally the current date at the time of operation. You can use Python's datetime module and date class to obtain the current date through datetime.date.today(), which is not limited here.
[0059] Optionally, in another embodiment of the present application, an implementation of step S102 includes:
[0060] The year operation information is determined based on the difference between the expected year and the default year; the month operation information is determined based on the difference between the expected month and the default month; and the day operation information is determined based on the difference between the expected day and the default day.
[0061] Among them, the year operation information includes the target control point of the year element control in this test and the number of clicks on the target control point of the year element control; the target control point of the year element control is the upper control point of the year element control or the lower control point of the year element control.
[0062] like Figure 2 As shown, it is a schematic diagram of a date control provided in an embodiment of the present application, and the dotted part is the year element control.
[0063] Among them, the moon operation information includes the target control point of the moon element control in this test and the number of clicks on the target control point of the moon element control; the target control point of the moon element control is the upper control point of the moon element control or the lower control point of the moon element control.
[0064] Among them, the monthly operation information includes the target control point of the day element control in this test and the number of clicks on the target control point of the day element control; the target control point of the day element control is the upper control point of the day element control or the lower control point of the day element control.
[0065] In the specific implementation process of the present application, taking the determination of year operation information based on the difference between the expected year and the default year as an example, if the difference between the expected year and the default year is positive, the target control point of the year element control is determined to be the upper control point of the year element control; if the difference between the expected year and the default year is positive, the target control point of the year element control is determined to be the lower control point of the year element control; the absolute value of the difference between the expected year and the default year is the number of clicks on the target control point of the year element control.
[0066] For the implementation method of determining the monthly operation information according to the difference between the expected month and the default month, and determining the daily operation information according to the difference between the expected day and the default day, please refer to the implementation method of determining the year operation information according to the difference between the expected year and the default year, which will not be repeated here.
[0067] S103. For each element control in the date control to be tested, obtain size information of the element control and coordinates of a preset position of the element control.
[0068] The element control includes a year element control, a month element control and a day element control. The coordinates of the preset position can be the coordinates of the upper left corner, the coordinates of the upper right corner, the coordinates of the lower left corner, etc., which are not limited here.
[0069] It is understandable that, in the process of testing the date control to be tested, each element control should be tested, and the process of testing each element control can be performed synchronously or sequentially, which is not limited here.
[0070] Specifically, the way to obtain the size information of the element control may be, but is not limited to, driver.get_window_size(). This method returns a dictionary containing two keys, width and height, which respectively represent the width and height of the element control on the mobile phone screen. Specifically, driver.get_window_size()['width'] and driver.get_window_size()['height'] are used to obtain the width and height of the element control on the mobile phone screen, that is, the size information of the element control.
[0071] In the specific implementation process of this application, the coordinates of the preset position of the element control can be obtained through but not limited to the location attribute in Python, and the x and y coordinates of the upper left corner can be returned in the form of a dictionary.
[0072] S104: Determine the coordinates of the target control point of the element control according to the operation information of this test, the size information of the element control, and the coordinates of the preset position of the element control.
[0073] Optionally, in another embodiment of the present application, an implementation of step S104 is as follows: Figure 3 As shown, including:
[0074] S301. Determine the coordinates of all target positions of the element control according to the size information of the element control and the coordinates of the preset position of the element control.
[0075] The target position is a position set in advance, which may be, but is not limited to, the coordinates of the lower left corner, the lower right corner, the upper left corner, etc., and is not limited here.
[0076] Taking the coordinates of the preset position as the coordinates of the upper left corner (x, y), and the coordinates of the target position as the coordinates of the lower left corner, the lower right corner, and the upper right corner as an example, then the coordinates of the upper right corner are (x+width, y), the coordinates of the lower right corner are (x+width, y+height), and the coordinates of the lower left corner are (x, y+height).
[0077] S302: Determine the coordinates of the center point of the element control according to the coordinates of all target positions of the element control and the coordinates of the preset position of the element control.
[0078] Continuing with the above example, the coordinates of the center point are (x+width / 2, y+height / 2).
[0079] S303: Determine the target control point coordinates of the element control according to the operation information of this test and the center point coordinates of the element control.
[0080] Continuing with the above example, if the target control point of the element control in the operation information of this test is the upper control point of the element control, the horizontal coordinate of the target control point coordinate of the element control is the same as the center point coordinate of the current element control (x+width / 2, y+height / 2), and the vertical coordinate can be calculated by (y+height*3 / 2).
[0081] S105. Perform a test at the target control point coordinates of the element control according to the operation information of this test to obtain a test result of the element control.
[0082] Continuing with the above example, at (x+width / 2, y+height*3 / 2), click according to the number of clicks on the target control point of the element control in the operation information of this test to simulate the effect of sliding down the page.
[0083] Take the year as an example. Assuming that the year of birth is 1993, you need to slide from the default year to 1993: first use xpath to locate the year element, and use driver.get_window_size() to get the width of the year element on the screen as 282 and the height as 102. Use the location attribute to return the upper left corner coordinates of the year element x: 39, y: 1683; then judge the expected year and the default year. The default year is generally the current year at the time of operation. Use datetime.date.today().year to get the year of the current date. If the expected year is less than the default year, you need to click the upper coordinates of the current year element to simulate the effect of sliding down the page. The horizontal coordinates of the upper coordinates are the same as the center coordinates of the current year element (x+width / 2, y+height / 2), and the vertical coordinates can be obtained by calculating (y+height*3 / 2); click the upper coordinates in a loop, and the number of clicks is the absolute value of |1993-2024|.
[0084] S106. Generate test results of the date control to be tested according to the test results of all element controls.
[0085] As can be seen from the above scheme, the present application provides a test method for a date control. After receiving the expected date, the operation information of this test is determined according to the expected date and the default date; then, for each element control in the date control to be tested, the size information of the element control and the coordinates of the preset position of the element control are obtained; then, according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control, the target control point coordinates of the element control are determined; finally, the target control point coordinates of the element control are tested according to the operation information of this test to obtain the test results of the element control; based on the test results of all element controls, the test results of the date control to be tested are generated. This reduces the impact of screen resolution on the date control during the test process and improves the test efficiency.
[0086] The present application embodiment provides a test device for a date control, such as Figure 4 As shown, specifically including:
[0087] The receiving unit 401 is configured to receive an expected date.
[0088] Among them, the expected date includes the expected year, expected month and expected day.
[0089] The first determining unit 402 is used to determine the operation information of this test according to the expected date and the default date.
[0090] The default date includes a default year, a default month, and a default day; the operation information of this test includes yearly operation information, monthly operation information, and daily operation information.
[0091] In another embodiment of the present application, the default date is the current system date, which will not be described in detail here.
[0092] Optionally, in another embodiment of the present application, an implementation of the first determining unit 402 includes:
[0093] The year operation information determination unit is used to determine the year operation information according to the difference between the expected year and the default year.
[0094] Among them, the year operation information includes the target control point of the year element control in this test and the number of clicks on the target control point of the year element control; the target control point of the year element control is the upper control point of the year element control or the lower control point of the year element control.
[0095] The monthly operation information determination unit is used to determine the monthly operation information according to the difference between the expected month and the default month.
[0096] Among them, the moon operation information includes the target control point of the moon element control in this test and the number of clicks on the target control point of the moon element control; the target control point of the moon element control is the upper control point of the moon element control or the lower control point of the moon element control.
[0097] The daily operation information determining unit is used to determine the daily operation information according to the difference between the expected day and the default day.
[0098] Among them, the monthly operation information includes the target control point of the day element control in this test and the number of clicks on the target control point of the day element control; the target control point of the day element control is the upper control point of the day element control or the lower control point of the day element control.
[0099] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here.
[0100] The acquisition unit 403 is used to acquire the size information of each element control and the coordinates of the preset position of the element control for each element control in the date control to be tested.
[0101] Among them, the element controls include year element controls, month element controls and day element controls.
[0102] The second determining unit 404 is used to determine the coordinates of the target control point of the element control according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control.
[0103] Optionally, in another embodiment of the present application, an implementation of the second determining unit 404 includes:
[0104] The first coordinate determining unit is used to determine the coordinates of all target positions of the element control according to the size information of the element control and the coordinates of the preset position of the element control.
[0105] The second coordinate determining unit is used to determine the coordinates of the center point of the element control according to the coordinates of all target positions of the element control and the coordinates of the preset position of the element control.
[0106] The third coordinate determination unit is used to determine the coordinates of the target control point of the element control according to the operation information of this test and the coordinates of the center point of the element control.
[0107] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 3 As shown, no further description is given here.
[0108] The testing unit 405 is used to perform a test at the target control point coordinates of the element control according to the operation information of this test to obtain the test result of the element control.
[0109] The generating unit 406 is used to generate the test result of the date control to be tested according to the test results of all element controls.
[0110] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 1 As shown, no further description is given here.
[0111] As can be seen from the above scheme, the present application provides a test device for a date control. After the receiving unit 401 receives the expected date, the first determining unit 402 determines the operation information of this test according to the expected date and the default date; then, the acquiring unit 403 acquires the size information of the element control and the coordinates of the preset position of the element control for each element control in the date control to be tested; then, the second determining unit 404 determines the target control point coordinates of the element control according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control; finally, the testing unit 405 performs a test at the target control point coordinates of the element control according to the operation information of this test to obtain the test result of the element control; the generating unit 406 generates the test result of the date control to be tested according to the test results of all element controls. This reduces the influence of the screen resolution on the date control during the test and improves the test efficiency.
[0112] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0113] Another embodiment of the present application provides an electronic device, such as Figure 5 As shown, including:
[0114] One or more processors 501 .
[0115] The storage device 502 stores one or more programs.
[0116] When the one or more programs are executed by the one or more processors 501, the one or more processors 501 implement the date control testing method as described in any one of the above embodiments.
[0117] Another embodiment of the present application provides a computer storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the date control testing method as described in any one of the above embodiments is implemented.
[0118] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0119] It should be noted that the computer-readable medium mentioned above in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0120] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0121] Another embodiment of the present application provides a computer program product, which, when executed, is used to execute the above-mentioned date control testing method.
[0122] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment of the present application are executed.
[0123] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in this application is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing this application.
[0124] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present application. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.
[0125] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.
Claims
1. A method for testing a date control, characterized in that: include: Receiving an expected date; wherein the expected date includes an expected year, an expected month, and an expected day; Determine the operation information of this test according to the expected date and the default date; wherein the default date includes a default year, a default month and a default day; and the operation information of this test includes year operation information, month operation information and day operation information; For each element control in the date control to be tested, obtain the size information of the element control and the coordinates of the preset position of the element control; wherein the element control includes a year element control, a month element control and a day element control; Determine the target control point coordinates of the element control according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control; Performing a test at the target control point coordinates of the element control according to the operation information of this test to obtain a test result of the element control; The test result of the date control to be tested is generated according to the test results of all the element controls.
2. The date control testing method according to claim 1, characterized in that: Determining the operation information of this test according to the expected date and the default date includes: Determine the year operation information according to the difference between the expected year and the default year; wherein the year operation information includes the target control point of the year element control in this test and the number of clicks on the target control point of the year element control; the target control point of the year element control is the upper control point of the year element control or the lower control point of the year element control; Determine the month operation information according to the difference between the expected month and the default month; wherein the month operation information includes the target control point of the month element control in this test and the number of clicks on the target control point of the month element control; the target control point of the month element control is the upper control point of the month element control or the lower control point of the month element control; The daily operation information is determined based on the difference between the expected day and the default day; wherein the monthly operation information includes the target control point of the daily element control of this test and the number of clicks on the target control point of the daily element control; the target control point of the daily element control is the upper control point of the daily element control or the lower control point of the daily element control.
3. The date control testing method according to claim 1, characterized in that: Determining the target control point coordinates of the element control according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control includes: Determine the coordinates of all target positions of the element control according to the size information of the element control and the coordinates of the preset position of the element control; Determine the coordinates of the center point of the element control according to the coordinates of all target positions of the element control and the coordinates of the preset position of the element control; According to the operation information of this test and the center point coordinates of the element control, the target control point coordinates of the element control are determined.
4. The method for testing a date control according to claim 1, characterized in that: The default date is the current system date.
5. A test device for a date control, characterized in that: include: A receiving unit, configured to receive an expected date; wherein the expected date includes an expected year, an expected month and an expected day; A first determining unit is used to determine the operation information of this test according to the expected date and the default date; wherein the default date includes a default year, a default month and a default day; and the operation information of this test includes year operation information, month operation information and day operation information; An acquisition unit, used for acquiring, for each element control in the date control to be tested, size information of the element control and coordinates of a preset position of the element control; wherein the element controls include a year element control, a month element control and a day element control; A second determining unit is used to determine the coordinates of the target control point of the element control according to the operation information of this test, the size information of the element control and the coordinates of the preset position of the element control; A testing unit, used for testing the target control point coordinates of the element control according to the operation information of this test to obtain the test result of the element control; A generating unit is used to generate the test result of the date control to be tested according to the test results of all the element controls.
6. The date control testing device according to claim 5, characterized in that: The first determining unit includes: A year operation information determination unit, used to determine the year operation information according to the difference between the expected year and the default year; wherein the year operation information includes the target control point position of the year element control in this test and the number of clicks on the target control point position of the year element control; the target control point position of the year element control is the upper control point position of the year element control or the lower control point position of the year element control; A month operation information determination unit, used to determine the month operation information according to the difference between the expected month and the default month; wherein the month operation information includes the target control point of the month element control in this test and the number of clicks on the target control point of the month element control; the target control point of the month element control is the upper control point of the month element control or the lower control point of the month element control; The daily operation information determination unit is used to determine the daily operation information according to the difference between the expected day and the default day; wherein the monthly operation information includes the target control point of the daily element control of this test and the number of clicks on the target control point of the daily element control; the target control point of the daily element control is the upper control point of the daily element control or the lower control point of the daily element control.
7. The date control testing device according to claim 5, characterized in that: The second determining unit includes: A first coordinate determining unit, configured to determine the coordinates of all target positions of the element control according to the size information of the element control and the coordinates of the preset position of the element control; A second coordinate determining unit, configured to determine the coordinates of the center point of the element control according to the coordinates of all target positions of the element control and the coordinates of the preset position of the element control; The third coordinate determination unit is used to determine the target control point coordinates of the element control according to the operation information of this test and the center point coordinates of the element control.
8. The testing device for date control according to claim 5, characterized in that: The default date is the current system date.
9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the date control testing method as claimed in any one of claims 1 to 4.
10. A computer storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the date control testing method as claimed in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Automated test method and apparatus as well as computing device
CN105740143A
Method and device for selecting time during test script recording
CN110457219A
Date selection method and device, computer equipment and storage medium
CN117784994A
Date-based retrieval method and device, electronic equipment and storage medium
CN118013061A