Date control packaging method and system, readable storage medium and equipment
By using type parameters and a two-layer verification mechanism, the problems of complex date control packaging methods and insufficient data verification in the prior art are solved, and the coverage and data accuracy of all operation scenarios are improved.
Patent Information
- Application Number
- CN202510517620.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-04-24
AI Technical Summary
The existing date control encapsulation method has a small granularity for different operation scenarios, resulting in complex code and high overlap, and it is impossible to effectively verify the data generated in the process, especially the inability to realize complex styles, time zones, etc.
By using two type parameters to indicate the operation scenario of the date control, determine its data type, and adopt a two-layer verification mechanism to perform multiple verifications on the return results of the date control, including value checksum style verification, taking into account date offset and client time zone.
It achieves comprehensive coverage of all date control operation scenarios, reduces the difficulty of automated writing, improves user experience, and ensures the accuracy and legality of data through a dual verification mechanism.
Smart Images

Figure CN120045245A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of component encapsulation, and particularly relates to a method, system, readable storage medium and device for encapsulating a date control. Background Art
[0002] The statements in this part only provide background technical information related to the present invention and do not necessarily constitute prior art.
[0003] A date control is a control used to specify or select a date / time value. In actual business, it plays an important role. Encapsulating or processing the date control can provide users with richer functions and better user experiences, and enhance the function expansion of the date control.
[0004] However, for the existing encapsulation or processing of date controls, on the one hand, the granularity of each control behavior is small. For example, clicking on the date control, date selection, date popup paging, and date popup clearing are all different usage scenarios / methods. The number of code lines corresponding to each use case is large and the code overlap degree of different use cases is high. When corresponding testers develop, they need to have an in-depth understanding of the development documents and the code workload is also large. On the other hand, the existing encapsulation verification generally only mechanically executes the operation process and only verifies whether the process is correct, and cannot verify whether the data generated by the process is correct.
[0005] Although some research scholars have proposed verification of the data generated by the process. For example, the Chinese invention patent with the invention publication number CN118170357A and the invention name of time control generation method, device, storage medium and electronic device mentions whether the time accuracy and range of the control content are within the preset accuracy and range, but this kind of verification is a relatively simple threshold comparison and cannot implement more complex verifications such as styles and time zones. Summary of the Invention
[0006] In order to solve the above problems, the present invention proposes a method, system, readable storage medium and device for encapsulating a date control. The present invention uses two type parameters to indicate the current operation scenario of the date control, determines the data type of the date control for different operation scenarios, can cover all scenarios, and performs multiple verifications on the return result of the date control, effectively improving its accuracy.
[0007] According to some embodiments, the present invention adopts the following technical solutions: A method for encapsulating a date control includes the following steps: Obtain test time data and the test return result of the date control in the operation scenario, and perform the first verification and the second verification on the test return result in sequence; The process of the first verification is as follows: calculate the original expected value according to the test time data and the pre-configured date offset, correct the original expected value according to the time zone where the client to which the date control belongs, and determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes; if not, determine whether the corrected expected value is correct. If it is correct, the first verification fails; otherwise, it passes. The process of the second verification is to determine whether the optional status of the test return result is consistent with the optional status of the operation scenario. If so, the second verification passes; otherwise, the second verification fails.
[0008] As an alternative implementation, the operation scenario includes: the first operation scenario, the second operation scenario, and the third operation scenario. Among them, if the data type is a date type and the optional status is optional, it is the first operation scenario. In the first operation scenario, the date data is determined by selecting the data in the date pop-up panel. If the data type is a date type and the optional status is not optional, it is the second operation scenario. In the second operation scenario, the date data is determined by inputting the data. If the data type is a non-date type and the optional status is optional, it is the third operation scenario. In the third operation scenario, the date data is determined by selecting a shortcut key. Determine the operation scenario according to the type and optional status of the test time data.
[0009] As an alternative implementation, preprocess the test return result of the date control in the operation scenario. Split the data in the test return result into an array of numeric types and an array of non-numeric types. Concatenate the elements of the array of numeric types into a complete character, judge the length of the complete character, and judge the preliminary date type according to the length of the complete character. Extract the characters in the array of non-numeric types, correct the preliminary date type according to the character type and quantity, and obtain the final test return result through mask formatting processing.
[0010] As a further implementation, judging the preliminary date type according to the length of the complete character includes: if the length of the complete character is 4, it is considered as year-type data; if the length of the complete character is 6, it is considered as year-month type data or time type data; if the length of the complete character is 8, it is considered as year-month-day type data; if the length of the complete character is 14, it is considered as year-month-day and time type data; if the length of the complete character is 16, it is considered as date range data or data with time zone; If the length of the complete character is other lengths, it is considered as illegal data or error data.
[0011] As a further implementation, the process of correcting the preliminary date type according to the character type and quantity includes that if the characters are the same delimiter, the number of delimiters exceeds one and the delimiter is not the predetermined delimiter, combining the preliminary date type, and dividing the complete characters from left to right according to the principle that the year occupies four digits, the month occupies two digits, and the day occupies two digits, to obtain the final test return result; If the characters are different delimiters and one of them contains the predetermined delimiter, combining the preliminary date type, and dividing the complete characters from left to right according to the principle that the year occupies four digits, the month occupies two digits, the day occupies two digits, the hour occupies two digits, the minute occupies two digits, and the second occupies two digits, to obtain the final test return result.
[0012] As an alternative implementation, the process of according to the test time data and the pre-configured date offset includes: if the date offset is zero, using the original expected value as the expected value after introducing the date offset; if the date offset is greater than zero, using the value obtained by adding the date offset to the original expected value as the expected value after introducing the date offset; if the date offset is less than zero, using the value obtained by subtracting the date offset from the original expected value as the expected value after introducing the date offset.
[0013] As a further implementation, the process of correcting the original expected value according to the time zone where the client to which the date control belongs includes: recording the time of operating the date control, determining the time stamp of the Coordinated Universal Time (UTC) at this time, and combining the time zone where the client where the date control is located to correct the time zone of the expected value after introducing the date offset.
[0014] As an alternative implementation, the process of determining whether the corrected expected value is correct includes: determining whether the corrected expected value is illegal data, if so, considering the corrected expected value to be incorrect; determining whether the linkage result between the corrected expected value and the date data of operating the date control is correct, if not, considering the corrected expected value to be incorrect.
[0015] A date control encapsulation system includes: A data acquisition module, configured to acquire test time data and the test return result of the date control in an operation scenario; A double-layer verification module, configured to perform a first verification and a second verification on the test return result in sequence; The process of the first verification is to calculate the original expected value based on the test time data and the pre-configured date offset, correct the original expected value according to the time zone where the client to which the date control belongs is located, and determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes; if not, it is determined whether the corrected expected value is correct. If it is correct, the first verification fails; otherwise, it passes. The process of the second verification is to determine whether the optional status of the test return result is consistent with the optional status of the operation scenario. If so, the second verification passes; otherwise, the second verification fails.
[0016] A computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the steps in the above method are completed.
[0017] An electronic device includes a memory, a processor, and computer instructions stored on the memory and running on the processor. When the computer instructions are run by the processor, the steps in the above method are completed.
[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: Through two parameters, namely the type and status of data, the present invention can determine the operation scenario / method of the date control, and ensure comprehensive coverage of the operation scenarios of all date controls, greatly reducing the difficulty of automated writing and improving the user experience.
[0019] The present invention provides a data verification process for test encapsulation, utilizes a double-layer / double verification mechanism, and introduces a date offset and the time zone where the client is located during verification to correct the expected value. During the verification process, it does not mechanically perform result verification, fully considering the legality and relevance of data, and ensuring the accuracy of the verification result.
[0020] The present invention places the first verification in the first layer and the second verification in the second layer, which can ensure that the most important part is verified first, and gives the second verification process time to obtain elements related to the optional status, which can improve the verification efficiency and save time in the overall verification process.
[0021] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following specific preferred embodiments are given, and in conjunction with the accompanying drawings, the detailed description is as follows. Description of the Drawings
[0022] The specification drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention.
[0023] Figure 1It is a schematic flowchart of a method for encapsulating a date control in an embodiment; Figure 2 It is a schematic diagram of the process for determining the operation scenario of a date control in an embodiment; Figure 3 It is a schematic diagram of the process for identifying the test return result in an embodiment; Figure 4 It is a schematic diagram of a two - fold verification process in an embodiment; Figure 5 It is a schematic diagram of the system structure for encapsulating a date control in an embodiment; Figure 6 It is a schematic diagram of an electronic device in an embodiment. Detailed implementation manners
[0024] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0025] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs.
[0026] It should be noted that the terms used herein are only for describing specific implementation manners and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0027] In the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
[0028] Embodiment 1 A method for encapsulating a date control, as Figure 1 shown, includes the following steps: S1. Obtain the test time data and the test return result of the date control in the operation scenario, and perform the first verification and the second verification on the test return result in sequence; S2. The process of the first verification is to calculate the original expected value according to the test time data and the pre - configured date offset, correct the original expected value according to the time zone where the client to which the date control belongs is located, and determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes; if they are not consistent, determine whether the corrected expected value is correct. If it is correct, the first verification fails; otherwise, it passes; S3. The process of the second verification is to determine whether the optional status of the test return result is consistent with the optional status of the operation scenario. If so, the second verification passes; otherwise, the second verification fails.
[0029] Considering that in the business system, the scenarios where users use the date control mainly include the following: (1) Selection: In general operations, click on the date control, and on the control page, switch the year, month, and day components to select the desired date; or click on the date control and select the shortcut keys on the control page, such as Today, Beginning of Month, Beginning of Quarter, etc.
[0030] (2) Input: Directly input specific dates, including legal and illegal dates.
[0031] On the other hand, from the analysis of the control types, there are the following two types of date controls: (1) Single-date control, that is, there is only one pop-up window after clicking the date control, which is often used for data entry.
[0032] (2) Interval date control, that is, there are two date control pop-up windows after clicking the date control, and a range of dates can be selected, such as 2024-01-01 - 2024-12-31. After selection, two dates are returned, which is often used for querying.
[0033] From a more detailed function division, these two types of controls have several different display effects: (1) Different mask formats, such as YYYY-MM-DD, YYYY year MM month DD day.
[0034] (2) For some dates restricted by business, they cannot be actually selected after clicking the pop-up window, such as only being able to select the dates of the current month.
[0035] (3) Different date types, such as year type (taking 2024 as an example), month type (taking 2024-01 as an example), year-month-day type (taking 2024-01-01 as an example), date-time type (taking 2024-01-01 12:00:00 as an example), time type (taking 10:59:59 as an example), time zone data (taking 2025-04-11T08:04:31.55Z as an example).
[0036] (4) Dynamic dates, which need to be calculated dynamically based on the current date. For example, when testing, it is necessary to test the date selection at some special time points, such as February 28th, February 29th, etc. At this time, the server time needs to be adjusted to the baseline time, which will cause a deviation from the actual time. When it is necessary to select a date based on a special date as the baseline (the day after February 28th), the selection results for leap years and non-leap years will be inconsistent.
[0037] In summary, considering the actual business situation, there is a possibility of combinations among these types, which makes the behavior of the date component complex. If a method is encapsulated for each type, it will result in a very poor user experience for test developers using UI automation for coding and make the code difficult to maintain later, bringing extremely high maintenance costs. The solution provided in this embodiment can handle a control with as few methods or operation scenarios as possible. Such methods should not contain code for locating elements, reducing the difficulty of UI automation coding and providing a solid foundation for later supporting the generation of UI automation code by large models.
[0038] In this embodiment, if the type of test data is the date type and the selectable status is selectable, it is the first operation scenario, that is, the date_select method scenario; If the type of test data is the date type and the selectable status is unselectable, it is the second operation scenario, that is, the date_input method scenario; If the type of test data is non-date type and the selectable status is selectable, it is the third operation scenario, that is, the date_btn_select method scenario.
[0039] The test data is determined by the tester's use case. For example, date_fast_select(id, '2025-05-16','selectable') means clicking the date control with this id. By parsing the test data and selectable parameters, it is known that the control of year-month-day type should be clicked to select, and the code will click the date data of 2025-05-16. Or, date_fast_select(id, 'February 30, 2025', 'unselectable') is to input the value of February 30, 2025 in the date control; date_fast_select(id, 'Today','selectable') is to select the shortcut key of today in the date control. Parsing the date format is for the code to perform the corresponding DOM element click.
[0040] This embodiment divides the usage scenarios of the date control through two parameters, with a total of three scenarios: the method scenario for selecting a specific date (date_select), the method scenario for selecting a shortcut key (date_btn_select), and the method scenario for inputting in the date control (date_input).
[0041] After analysis, the three scenarios have the following characteristics: passing in specific date data with the selectable status being "selectable"; passing in specific date data with the selectable status being "unselectable"; passing in the name of a specific "shortcut key" with the selectable status being "selectable".
[0042] In this embodiment, two parameters, namely data type and status, are used for judgment. As Figure 2 shown, it can achieve rapid identification of specific application scenarios, and the above two parameters can cover possible operation scenarios.
[0043] More specifically, for the first operation scenario, that is, the date_select method scenario, the date data is determined by selecting the data in the date pop-up panel.
[0044] Different date types will generate different pop-up panels, and the corresponding positioning elements are also different. For example, the year type panel, the month type panel, and the year-month-day type panel; for different masks, the same type will generate different formats of data, such as 2024-01-01, January 1, 2024; moreover, for the same type and the same mask, different data will be generated according to different time zones.
[0045] By summarizing the possible data results, it can be found that the date data of different masks and types can basically be divided into two types. One is the data containing numbers and characters, where the characters include special characters, Chinese characters, or / and English characters, such as 2024-01-01, 2024, 2024 / 12, 2025-04-11T08:04:31.55Z, etc., and the other is the data containing only numbers, such as 20240101, 2024.
[0046] In summary, as Figure 3 shown, the data can be divided into pure digital data and data with characters. If the special characters or Chinese characters in the non-time zone data of different mask formats are removed, the results are the same, and the delimiter characters can be used as the basis for judgment. The lengths of different types are different after removing special characters. For example, the year type is 4 digits long, such as 2024, the year-month type is 6 digits long, such as 202412, the year-month-day type is 8 digits long, such as 20241217, and the year-month-day and time type is 14 digits long, such as 20241217092057.
[0047] Taking the above into comprehensive consideration, in this embodiment, the data in the test return result of the first operation scenario is split into an array of digital types and an array of non-digital types. The elements of the array of digital types are concatenated into a complete character, the length of the complete character is judged, and the preliminary date type is judged according to the length of the complete character; the characters in the array of non-digital types are extracted, and the preliminary date type is corrected according to the character type and quantity to obtain the final test return result.
[0048] If the length of the complete character is 4, it is considered as year-type data; if the length of the complete character is 6, it is considered as year-month type data or time-type data; if the length of the complete character is 8, it is considered as year-month-day type data; if the length of the complete character is 14, it is considered as year-month-day and time-type data; if the length of the complete character is 16, it is considered as date range data or time zone data; If the length of the complete character is other lengths, it is considered as illegal data or error data, such as 202, 2023101108, etc.
[0049] According to the character type and quantity, the process of correcting the preliminary date type includes that if the characters are the same separator, the number of separators exceeds one and the separator is not the predetermined separator. The predetermined separator in this embodiment is ":". Combining the preliminary date type, according to the principle that the year occupies four digits, the month occupies two digits, and the day occupies two digits, the complete character is divided from left to right, and through mask formatting processing, the final test return result is obtained; If the characters are different separators and one of them contains the predetermined separator, combining the preliminary date type, according to the principle that the year occupies four digits, the month occupies two digits, the day occupies two digits, the hour occupies two digits, the minute occupies two digits, and the second occupies two digits, the complete character is divided from left to right, and through mask formatting processing, the final test return result is obtained.
[0050] If the complete character of pure numbers is 20241217092057 and the separators are "-,-,:", then according to the above principle, the final test return result represents 2024-12-17 09:20:57.
[0051] If the complete character of pure numbers is 20241217092057 and the separators are " / , / ,:,:", then according to the above principle, the final test return result represents 2024 / 12 / 17 09:20:57.
[0052] The original data is UTC time: 2025-10-12T14:30:00Z, the complete character of pure numbers is 20251012143000, and the separators are "-,-,T, :, :,.,Z". Then according to the above principle, it is determined whether there is a predetermined separator "T" or "Z" or other separators indicating the time zone. If it is determined that there is, the final test return result combined with the user's client time zone (East Eighth District) is expressed as 2025-10-12 22:30:00.
[0053] If the complete character consisting of pure numbers is 2025041120250422 and the delimiters are " / , / , -, / , / ", then according to the above principle, determine whether there is a predetermined delimiter "T" or "Z" or other delimiters representing time zones. If it is determined that there is none, the final test return result is expressed as 2025 / 04 / 12 – 2025 / 04 / 22.
[0054] Of course, the above recognition process can also be used in other scenarios or methods.
[0055] In the second operation scenario, that is, the date_input method scenario, by inputting data, the date data is determined, which only includes three behaviors: clicking the control, inputting data, and losing focus.
[0056] In the third operation scenario, that is, the date_btn_select method scenario, by selecting shortcut keys, the date data is determined, where the shortcut keys include today, confirm, beginning of month, beginning of quarter, beginning of year, beginning of fiscal year, and end of fiscal year, etc. After obtaining the corresponding elements, they are encapsulated into a dictionary, and the corresponding click event can be triggered.
[0057] In this embodiment, two parameters are used to cover the date control from three dimensions: usage scenario, control type, and data type, and all scenarios can be processed.
[0058] In addition, this embodiment adds a double verification mechanism, that is, the first verification (also called value verification) and the second verification (also called style verification), as Figure 4 shown.
[0059] This embodiment adopts a verification method that combines data and style to verify the correctness of the data. The method parameters include the actual data, the expected selected data, and whether it meets the expectations.
[0060] Specifically, value verification includes whether the value after the control is selected, the value input by the control, the value automatically corrected by the control, the value assigned to the control by the code, and the data with inconsistent time zone data selection results is consistent with the expected value; Style verification includes whether the control itself changes the selectable and unselectable states due to business logic linkage, whether data from the previous month or the next month cannot be selected in the control pop-up window, and whether the style or unselectable state of data for special dates that cannot be selected is consistent with the expected value.
[0061] The final verification is considered to pass only when both layers of verification pass.
[0062] First, it is the verification of values. Calculate the original expected value based on the original data and the pre-configured date offset. Correct the original expected value according to the time zone where the client to which the date control belongs is located. Determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes. If they are inconsistent, determine whether the corrected expected value is correct. If it is correct, the first verification fails; otherwise, it passes.
[0063] Among them, the process of calculating the original expected value based on the original data and the pre-configured date offset includes: if the date offset is zero, use the original expected value as the expected value after introducing the date offset; if the date offset is greater than zero, use the value obtained by adding the date offset to the original expected value as the expected value after introducing the date offset; if the date offset is less than zero, use the value obtained by subtracting the date offset from the original expected value as the expected value after introducing the date offset.
[0064] Simply put, that is, based on the currently displayed value of the date control (or the date data of the setting operation), combined with the date offset in the scenario and the time zone of the client where the operation scenario is executed, dynamically calculate the expected value, and then verify it with the test return result.
[0065] The currently displayed value of the date control (or the date data of the setting operation, which can also be called the value selected by the date control) can be obtained through front-end js code. The date offset in the test scenario can be set through a configuration file, and the time zone data can be obtained through a client function. Through these three parameters, a dynamic expected value can be obtained instead of a fixed value. There are the following three situations for the comparison between the specific returned result and the expected value: (1) The returned value is consistent with the expected value and meets the expectation; (2) The returned value is inconsistent with the expected value but meets the expectation; (3) The returned value is inconsistent with the expected value and does not meet the expectation.
[0066] It should be noted that the above-mentioned expected value and expectation in this embodiment do not refer to the same parameter.
[0067] There are many scenarios, such as test scenarios, where the business logic of some special dates needs to be tested, such as fiscal year settlement, account closing, etc. At this time, it is necessary to change the actual time to simulate the scenario, and then a large date deviation will occur. Then the expected result cannot be the original expected value, but the value after introducing the offset date.
[0068] Illustrated with a typical embodiment, the value selected by the date control (that is Figure 4The displayed value of the control in it is April 10, 2025. The date offset in the scenario is +20 days, that is, the date control is extended by 20 days before performing the test operation. When not considering the client time zone, after the date control performs the operation, there is a test return result, that is, April 30, 2025.
[0069] Then, according to the process of calculating the original expected value based on the original data and the pre-configured date offset, the expected value is April 30, 2025, which is consistent with the return value, and the verification passes. If the return value is not April 30, 2025, the verification fails.
[0070] However, the value selected by the date control is April 11, 2025, and the date offset is +20 days, that is, the date control is extended by 20 days before performing the test operation. When not considering the client time zone, after the date control performs the operation, there is a test return result, that is, May 1, 2025. However, the expected value with the introduced offset calculated simply should be April 31, 2025.
[0071] Then the return value and the calculated expected value are inconsistent. At this time, it is necessary to check whether the expected value with the introduced offset is correct. Obviously, the expected value with the introduced offset is illegal data and is incorrect. At this time, it is considered that the return value passes the verification and meets the expectations.
[0072] On the other hand, whether the data rebounded after the user's selection is the data wanted is likely to occur in a scenario where the client and the server are not in the same time zone. In this way, it is necessary to simulate the time zone where the user (i.e., the client) is located for operation. For example, the server time zone is set to the eighth time zone east, but the operation is performed in the eighth time zone west. The rebounded data has an offset from the tester's time, and it is very difficult to verify the expected result for the dynamically calculated date. The time zone data must include the year, month, day, hour, minute, second and special characters. After operating the date control, the time zone where the operation is initiated can be identified, the original UTC timestamp can be recorded, and then the new UTC can be calculated through the target time zone to ensure the verification of the data correctness.
[0073] Therefore, after calculating the original expected value according to the original data and the pre-configured date offset, it is also necessary to correct the expected value with the introduced date offset according to the time zone where the client is located.
[0074] Then, it is necessary to determine whether the corrected expected value is correct, that is, to determine whether the corrected expected value is illegal data. If so, it is considered that the corrected expected value is incorrect, and it is necessary to determine whether the linkage result between the corrected expected value and the date data of the operated date control is correct. If not, it is considered that the corrected expected value is incorrect.
[0075] This can solve the situation where the calculated expected value is illegal data as presented in the above typical embodiments. At the same time, this solution can also verify whether illegal data is correctly processed. For example, when entering February 30th, whether it will be automatically corrected to February 29th or February 28th.
[0076] It can also verify whether the linkage results between different date controls in the user's business logic are correct. For example, it is pre-configured that the contract effective date must be after the signing date, and the operation start date should be less than or equal to the end date, etc.
[0077] After the first verification passes, obtain the optional status of the test return result of the date control that has passed the first verification, and determine whether the optional status is consistent with the optional status of the operation scenario. If so, the second verification passes; otherwise, the second verification fails.
[0078] That is, the user operation needs to be ensured to be correct due to business logic or operation control of special dates. For example, if certain dates cannot be selected, the corresponding date control pop-up window style should be in a non-selectable state.
[0079] The operation scenario is derived from use case design, that is, the desired date data is obtained by automatically operating the date control through UI. The selected value for the second verification is obtained by operating the date control, that is, the test return result of the date control. By comparing the two styles, the style verification can be completed.
[0080] In summary, in the previous date selection method, the incoming selection parameters can be obtained, that is, selectable and non-selectable. Focus on verifying the non-selectable status. The corresponding elements can be verified whether they are selectable by checking the readonly or disabled attributes of HTML elements, checking CSS styles (such as pointer-events), and checking whether the JavaScript event handler blocks the input, etc.
[0081] There are a total of four results: (1) The selection method / operation scenario is "selectable", and the style of the test return result is "selectable"; (2) The selection method / operation scenario is "non-selectable", and the style of the test return result is "non-selectable" (3) The selection method / operation scenario is "non-selectable", and the style of the test return result is "selectable" (4) The selection method / operation scenario is "selectable", and the style of the test return result is "non-selectable".
[0082] For the results of (1) and (2), the verification passes; for the results of (3) and (4), the verification fails.
[0083] In some scenarios, it can be selected in the date control, but it is set as non-selectable in the code. In this way, the operation scenario / input method will be executed. It can pass the value verification, but when it comes to the style verification, since it is set as non-selectable in the code while the return result indicates it is selectable, the verification will fail. Therefore, an additional step can be added, that is, to verify the expectation to determine whether the expectation meets the pre-setting. If so, the style verification is also considered to pass.
[0084] In some embodiments, numerical values can be used to represent the results of double verification. For example, 1 represents passing the verification and 0 represents failing the verification. In this way, the four states of 00, 01, 11, and 10 are used to represent the results of double verification, which is relatively simple and clear.
[0085] After both layers / two-fold verifications pass, it is considered that the corresponding automated test case passes, which not only ensures the data correctness but also guarantees the user experience.
[0086] Embodiment 2 A date control encapsulation system, as Figure 5 shown, includes: A data acquisition module, configured to acquire test time data and the test return result of the date control in the operation scenario; A double-layer verification module, configured to perform a first verification and a second verification on the test return result in sequence; The process of the first verification is to calculate the original expected value according to the test time data and the pre-configured date offset, correct the original expected value according to the time zone where the client to which the date control belongs is located, and determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes; if not, it is determined whether the corrected expected value is correct. If it is correct, the first verification fails; otherwise, it passes. The process of the second verification is to determine whether the selectable state of the test return result is consistent with the selectable state of the operation scenario. If so, the second verification passes; otherwise, the second verification fails.
[0087] The execution processes of the above modules can refer to the process of this step in Embodiment 1, and will not be elaborated here.
[0088] It can be understood that the above-mentioned individual units / modules can be separately or all combined into one or several other units / modules to form, or some of them can be further split into multiple smaller units with more specific functions to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application.
[0089] The above modules of the present system are divided based on logical functions. In actual applications, the functions of one module can also be implemented by multiple modules, or the functions of multiple modules can be implemented by one module. For example, the double-checking module in this embodiment may include, in other embodiments: An expected value calculation module, configured to calculate an original expected value, calculate the original expected value according to the original data and a pre-configured date offset, and correct the expected value with the date offset introduced according to the time zone where the client is located; A first judgment module, configured to judge whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first check passes; if not, the second judgment module is called; A second judgment module, configured to judge whether the corrected expected value is correct. If it is correct, the first check fails; otherwise, it passes.
[0090] Similarly, in other embodiments of the present application, the system may also include other units / modules. In actual applications, these functions can also be assisted by other units and can be implemented through the cooperation of multiple units.
[0091] According to another embodiment of the present application, the system described in this embodiment can be constructed and the method of Embodiment 1 can be implemented by running a computer program (including program code) that can execute the respective steps involved in the corresponding method described in Embodiment 1 on a general computing device such as a computer including processing elements and storage elements such as a central processing unit (CPU), a random access memory (RAM), and a read-only memory (ROM). The computer program can be recorded on, for example, a computer-readable recording medium, loaded into the above computing device through the computer-readable recording medium, and run therein.
[0092] Embodiment 3 A computer-readable storage medium (Memory), which is a memory device in an electronic device for storing programs and data. It can be understood that the computer-readable storage medium here can include both the built-in storage medium in the electronic device and, of course, the extended storage medium supported by the electronic device. The computer-readable storage medium provides a storage space that stores the processing system of the electronic device.
[0093] Moreover, one or more instructions suitable for being loaded and executed by a processor are stored in this storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory; optionally, it can also be at least one computer-readable storage medium located far from the aforementioned processor.
[0094] In one embodiment, one or more instructions are stored in the computer-readable storage medium; the processor loads and executes one or more instructions stored in the computer-readable storage medium to implement the following process: Obtain the test time data and the test return result of the date control in the operation scenario, and perform a first verification and a second verification on the test return result in sequence; The process of the first verification is to calculate the original expected value according to the test time data and the pre-configured date offset, correct the original expected value according to the time zone where the client to which the date control belongs is located, and determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes; if they are not consistent, determine whether the corrected expected value is correct. If it is correct, the first verification fails; otherwise, it passes; The process of the second verification is to determine whether the optional state of the test return result is consistent with the optional state of the operation scenario. If so, the second verification passes; otherwise, the second verification fails.
[0095] Embodiment 4 An electronic device, as Figure 6 shown, the electronic device includes a processor 1001, a communication interface 1002, and a computer-readable storage medium 1003. Among them, the processor 1001, the communication interface 1002, and the computer-readable storage medium 1003 can be connected through a bus or other means.
[0096] Among them, the communication interface 1002 is used to receive and send data, the computer-readable storage medium 1003 can be stored in the memory of the electronic device, the computer-readable storage medium 1003 is used to store a computer program, the computer program includes program instructions, and the processor 1001 is used to execute the program instructions stored in the computer-readable storage medium 1003.
[0097] The processor 1001 (or CPU (Central Processing Unit, central processor)) is the computing core and control core of the electronic device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function.
[0098] The processor 1001 is configured to execute the following process: Obtain the test time data and the test return result of the date control in the operation scenario, and perform a first verification and a second verification on the test return result in sequence; The process of the first verification is to calculate the original expected value according to the test time data and the pre-configured date offset, correct the original expected value according to the time zone where the client to which the date control belongs, and determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes; if they are not consistent, determine whether the corrected expected value is correct. If it is correct, the first verification fails; otherwise, it passes; The process of the second verification is to determine whether the optional status of the test return result is consistent with the optional status of the operation scenario. If so, the second verification passes; otherwise, the second verification fails.
[0099] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD - ROM optical memory, etc.).
[0100] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for realizing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0101] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means realizes the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are executed on the computer or other programmable apparatus to generate a computer-implemented process, thereby providing instructions for implementing the steps of the function specified in one process or a plurality of processes and / or boxes Figure 1 one process or a plurality of processes and / or boxes Figure 1 in one box or a plurality of boxes.
[0103] The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made by those skilled in the art without creative efforts within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A date control packaging method, characterized in that: The following steps are involved: Acquire the test time data and the test return result of the date control in the operation scenario, and perform a first check and a second check on the test return result in sequence; The first verification process is to calculate the original expected value according to the test time data and the pre-configured date offset, and to correct the original expected value according to the time zone of the client to which the date control belongs, and to determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes. If they are inconsistent, it is determined whether the corrected expected value is correct. If it is correct, the first verification fails, otherwise it passes. The second verification process is to determine whether the optional state of the test return result is consistent with the optional state of the operation scenario. If so, the second verification passes, otherwise the second verification fails.
2. A date control packaging method as claimed in claim 1, characterized in that: The operation scenarios include: a first operation scenario, a second operation scenario and a third operation scenario, wherein if the data type is a date type and the optional state is optional, it is a first operation scenario, and the first operation scenario determines the date data by selecting the data in the date pop-up window panel; If the data type is a date type and the optional state is not selectable, it is a second operation scenario, and the second operation scenario determines the date data by inputting data; If the data type is non-date type and the optional state is optional, it is the third operation scenario, and the third operation scenario determines the date data by selecting a shortcut key; Determine the operation scenario based on the type and optional status of the test time data.
3. A date control packaging method as claimed in claim 1, characterized in that: The test return results of the date control in the operation scenario need to be preprocessed. The preprocessing process includes: splitting the data in the test return results into an array of digital type and an array of non-digital type, splicing the elements of the digital array into complete characters, determining the length of the complete characters, and determining the preliminary date type according to the length of the complete characters; extracting characters from the non-digital array, correcting the preliminary date type according to the character type and quantity, and obtaining the final test return results through mask formatting.
4. A date control packaging method as claimed in claim 3, characterized in that: Judging the preliminary date type according to the length of the complete character includes: if the length of the complete character is 4, it is considered to be year type data; if the length of the complete character is 6, it is considered to be year-month type data or time type data; if the length of the complete character is 8, it is considered to be year-month-day type data; if the length of the complete character is 14, it is considered to be year-month-day and time type data; if the length of the complete character is 16, it is considered to be date interval data or data with time zone; If the length of the complete character is any other length, it is considered to be illegal data or erroneous data.
5. A date control packaging method as claimed in claim 3, characterized in that: The process of correcting the preliminary date type according to the character type and number includes: if the characters are the same separator, the number of separators is more than one and the separator is not the predetermined separator, combining the preliminary date type, dividing the complete characters from left to right according to the principle that the year occupies four digits, the month occupies two digits, and the day occupies two digits, to obtain the final test return result; If the characters are different types of separators, and they include predetermined separators, combined with the preliminary date type, the complete characters are divided from left to right according to the principle that the year occupies four digits, the month occupies two digits, the day occupies two digits, the hour occupies two digits, the minute occupies two digits, and the second occupies two digits to obtain the final test return result.
6. A date control packaging method as claimed in claim 1, characterized in that: The process according to the test time data and the pre-configured date offset includes: if the date offset is zero, the original expected value is used as the expected value after the date offset is introduced; if the date offset is greater than zero, the original expected value plus the date offset is used as the expected value after the date offset is introduced; if the date offset is less than zero, the original expected value minus the date offset is used as the expected value after the date offset is introduced.
7. A date control packaging method as claimed in claim 1, characterized in that: The process of judging whether the revised expected value is correct includes: determining whether the revised expected value is illegal data, if so, the revised expected value is considered incorrect, and determining whether the linkage result between the revised expected value and the date data of the operating date control is correct, if not, the revised expected value is considered incorrect.
8. A date control packaging system, characterized in that: include: A data acquisition module is configured to acquire test time data and test return results of the date control in an operation scenario; A double-layer verification module, configured to perform a first verification and a second verification on the test return result in sequence; The first verification process is to calculate the original expected value according to the test time data and the pre-configured date offset, and to correct the original expected value according to the time zone of the client to which the date control belongs, and to determine whether the test return result of the date control is consistent with the corrected expected value. If they are consistent, the first verification passes. If they are inconsistent, it is determined whether the corrected expected value is correct. If it is correct, the first verification fails, otherwise it passes. The second verification process is to determine whether the optional state of the test return result is consistent with the optional state of the operation scenario. If so, the second verification passes, otherwise the second verification fails.
9. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the steps of the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: The method comprises a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the steps in the method according to any one of claims 1 to 7 are completed.
Citation Information
Patent Citations
Time control generation method and device, storage medium and electronic equipment
CN118170357A
Satellite Radio Wave Receiving Device, Radio Controlled Timepiece, Method Of Outputting Date And Time Information, And Recording Medium
CN107203127A
Verification method of NANDFlash controller empty page test method
CN116185701A
Data processing method and system
CN116342199A
Method and device for calling environment time, electronic equipment and storage medium
CN117270939A