Automatic testing method for on-demand card swiping through metronome
By transforming the metronome and using Python scripts and auxiliary equipment, automated testing of card swiping equipment is achieved, and the problems of low efficiency and high cost of traditional card swiping tests are solved, the efficiency and accuracy of the test are improved, and labor costs are reduced.
Patent Information
- Application Number
- CN202411709306.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-11-27
AI Technical Summary
Traditional card swiping tests rely on manual operation, are time-consuming and labor-intensive, and are susceptible to human factors, making it difficult to guarantee the consistency and reliability of test results. The high-end automated testing equipment is costly, which limits its wide application.
By renovating the metronome, its power supply is connected to the output port of the auxiliary device, and using Python scripts to control the start and stop of the metronome, combining the network interface and output interface of the auxiliary device to achieve remote precise control of the metronome.
It realizes efficient and low-cost automated testing of card swiping equipment, significantly improves the efficiency and accuracy of the test, reduces labor costs, and supports long-term intervention-free operation.
Smart Images

Figure CN119645847A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of automated testing, in particular to an automated testing method for performing on-demand card swiping using a metronome. Background Art
[0002] In the context of rapid technological development, automated testing technology has become a key link in ensuring product quality and improving production efficiency, especially in the fields of electronic payment and access control. The accuracy and stability of card swiping equipment are directly related to the security of the system and user experience.
[0003] However, traditional card swipe tests mostly rely on manual operations, which is not only time-consuming and laborious, but also easily affected by human factors, making it difficult to ensure the consistency and reliability of test results. In addition, the use of high-end automated testing equipment, such as robotic arms with precision control systems, can improve test accuracy, but the high purchase and maintenance costs limit its widespread application, especially in small and medium-sized enterprises and in the early stages of R&D.
[0004] In view of this, it is urgent to find a card swipe testing solution that is both economical and efficient.
[0005] The metronome in the field of music is a simple and reliable mechanical device. It has the characteristics of regular swing, which provides inspiration for automated testing. The metronome can be transformed into a low-cost analog card swiping tool through appropriate modification. Its simple design and low cost bring new possibilities to the field of automated testing.
[0006] At the same time, with the popularization of programming technology, especially the widespread application of Python language in the field of automated control, it has become a reality to use scripts to control hardware equipment and process test data, providing technical support for the realization of intelligent and automated testing processes. Summary of the invention
[0007] In view of the problems of low efficiency, high cost and strong manual dependence in the testing process of existing card swiping equipment, the present invention proposes an automated testing method for on-demand card swiping using a metronome, which cleverly combines the physical movement characteristics of the metronome and the intelligent control capabilities of Python scripts to achieve efficient and low-cost card swiping testing.
[0008] The specific steps of the automated testing solution for on-demand card swiping using a metronome are as follows:
[0009] Step 1: Modify the power interface of the metronome to ensure that the negative pole of the metronome is connected to the output port of the auxiliary device, and control the power-on and power-off status of the metronome through the auxiliary device;
[0010] The auxiliary device has a network interface and an output interface, wherein the network interface is connected to a PC or a server; and the output interface is used to control the power connectivity of the metronome.
[0011] The device receives control instructions from the PC via an Ethernet cable and controls the switch state of the output port according to the instructions, thereby turning the metronome on or off.
[0012] Step 2: Develop control scripts using Python programming language;
[0013] The script should contain the following functions:
[0014] 1) Power control module: Send instructions to auxiliary devices through network protocols to accurately control the start and stop of the metronome.
[0015] Among them, the command statement to start the metronome is:
[0016] sendKeys(config_dict['assist_ip'],config_dict['assist_user'],config_dict['assist_password'],'output1=OUT1_SOS');
[0017] The command statement to stop the metronome is:
[0018] sendKeys(config_dict['assist_ip'],config_dict['assist_user'],config_dict['assist_password'],'output1=OUT1_CLR');
[0019] Where assist_ip is the IP of the auxiliary device, assist_user is the HTTP protocol authentication name for communication, assist_password is the HTTP protocol authentication password for communication, OUT1_SOS is the control metronome power-on command ID, and OUT1_CLR is the control metronome power-off command ID;
[0020] 2) Data collection and recording: The script needs to monitor the network interface or API of the device under test and automatically collect feedback information after each simulated card swipe, including the swipe time and status;
[0021] The statement for data collection is:
[0022] open_door_logs=getOpenDoorLogs('test_ip',test_user,test_password)
[0023] test_ip is the IP address of the test device; test_user is the HTTP authentication user name of the test device, and test_password is the authentication password;
[0024] 3) Result analysis: The script implements logic internally, compares the number of card swipes predicted by the metronome with the actual number of card swipe records received, and evaluates the test success rate.
[0025] 4) Loop control: According to the number of tests set by the user, the script automatically manages the test process and controls the number of card swipes by cyclically calling power-on and power-off statements; it automatically stops after reaching the specified number of times.
[0026] Step 3: Fix the NFC card on the metronome pointer and ensure that the card is close to or in contact with the reading area of the card swiping device under test during the swinging process;
[0027] If the card swiping interval supported by the test device is less than 1.5s, place the device reading area directly opposite the metronome's return position and swipe the card twice back and forth; if the card swiping interval supported by the test device is greater than or equal to 1.5s, place the test device on one side of the metronome and swipe the card once back and forth;
[0028] The speed of the pointer swing can also be used to fine-tune the swipe interval.
[0029] Step 4: Preset the key parameters required for the test in the control script or enter them through command line parameters;
[0030] Key parameters include the IP address of the device under test, the output interface of the auxiliary device, and the number of test cycles.
[0031] Step 5: Start the control script, initialize the connection between the auxiliary device and the card swiping device under test, control the metronome to simulate the card swiping according to the predetermined card swiping frequency and number, and monitor and record the test results at the same time.
[0032] Step 6: After the test is completed, the script automatically summarizes the test data and generates a test report;
[0033] The test data includes the number of successful card swipes, the number of failures, the total number of tests and the success rate.
[0034] The report should include an overview of the test process, detailed records of each card swipe, the final test conclusions, and possible fault analysis suggestions.
[0035] The advantages of the present invention are:
[0036] The invention discloses an automated testing method for swiping a card on demand by using a metronome, which realizes automated and intelligent testing of a card swiping device, significantly improves the efficiency and accuracy of the test, and greatly reduces the test cost.
[0037] The present invention discloses an automated testing method for swiping a card on demand by using a metronome, which does not require continuous monitoring by professionals and supports long-term non-intervention operation, thus providing a simple and efficient testing method for card swiping device manufacturers, system integrators and third-party testing organizations, and promoting the advancement and application of automated testing technology in this field. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 This is a flow chart of an automated testing method for on-demand card swiping using a metronome according to the present invention;
[0039] Figure 2 This is a diagram of an automated test scenario for on-demand card swiping using a metronome as described in the present invention. DETAILED DESCRIPTION
[0040] In order to facilitate those skilled in the art to understand and implement the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. Obviously, the described embodiments are only partial embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of the present invention.
[0041] The present invention proposes an automated card swiping test method by combining a metronome with a Python script, which innovatively improves traditional equipment to realize automated testing of the card swiping system. It not only overcomes the limitations of traditional testing methods and lowers the threshold of automated testing, but also significantly improves the efficiency and accuracy of the test through precise control and data analysis, meeting the market demand for high-quality, low-cost testing solutions.
[0042] The automated testing method for swiping a card on demand using a metronome is as follows: Figure 1 As shown, the specific steps are as follows:
[0043] Step 1: Modify the power interface of the metronome to ensure that the negative pole of the metronome is connected to the output port of the auxiliary device, and control the power-on and power-off status of the metronome through the auxiliary device;
[0044] The auxiliary device is an industry product of Fanvil, which has a network interface and an output interface. The network interface is connected to the PC or server; the output interface is used to control the power connectivity of the metronome.
[0045] The device receives control instructions from the PC via an Ethernet cable and controls the switch state of the output port according to the instructions, thereby turning the metronome on or off.
[0046] Step 2: Develop control scripts using Python programming language;
[0047] The script should contain the following functions:
[0048] 1) Power control module: Send instructions to auxiliary devices through network protocols to accurately control the start and stop of the metronome.
[0049] Among them, the command statement to start the metronome is:
[0050] sendKeys(config_dict['assist_ip'],config_dict['assist_user'],config_dict['assist_password'],'output1=OUT1_SOS');
[0051] The command statement to stop the metronome is:
[0052] sendKeys(config_dict['assist_ip'],config_dict['assist_user'],config_dict['assist_password'],'output1=OUT1_CLR');
[0053] Where assist_ip is the IP of the auxiliary device, assist_user is the HTTP protocol authentication name for communication, assist_password is the HTTP protocol authentication password for communication, OUT1_SOS is the control metronome power-on command ID, and OUT1_CLR is the control metronome power-off command ID;
[0054] Between each power-on and power-off of the metronome, a card swiping time is set. The setting statement is: time.sleep(2). By controlling the card swiping time, the number of times the metronome is powered on is further controlled. This number is related to the frequency of the metronome pointer swinging.
[0055] For example: After the metronome is powered on, the pointer starts working. The minimum swing of the metronome pointer is once every 1.5 seconds. Assuming that the card swiping time is set to 3 seconds, that is, the power is cut off after 3 seconds, the pointer will swing twice. If it is set to 6 seconds, the pointer will swing 4 times.
[0056] Then, after each metronome power failure, wait for a time to complete the door opening and save the door opening log: time.sleep(5); By adjusting the waiting time, the interval of the power on / off cycle can be controlled.
[0057] 2) Data collection and recording: The script actively collects the results of each simulated card swipe, including the swipe time and status, through the HTTP API interface opened by the test device;
[0058] The statement for data collection is:
[0059] open_door_logs=getOpenDoorLogs('test_ip',test_user,test_password)
[0060] test_ip is the IP address of the test device; test_user is the HTTP authentication user name of the test device, and test_password is the authentication password;
[0061] First, initialize the number of card swipes and the actual number of successful card swipes: test_count, open_success_count = 1000, 0; by adjusting the set number of card swipes, different test requirements can be met.
[0062] Then, the expected number of card swipes and configuration information are saved in a txt file, including: test device IP, authentication user name, authentication password, IP of the auxiliary device that controls the power on and off of the metronome, authentication user name, authentication password, and number of card swipes.
[0063] 3) Result analysis: The script implements logic internally, compares the number of card swipes set by the metronome with the actual card swipe records received, and evaluates the test success rate.
[0064] Get the latest door opening record open_door_logs[0][1], which is the door opening status. 0 means the door is opened successfully, and 1 means the door is opened unsuccessfully.
[0065] 4) Loop control: According to the number of tests set by the user, the script automatically manages the test process and controls the number of card swipes by cyclically calling power-on and power-off statements, and automatically stops when the specified number of times is reached.
[0066] Each time the power is on and off, the number of card swipes is set to n, the number of power-on / power-off cycles is recorded as m, and the total number of card swipes is n*m;
[0067] Step 3: Fix the NFC card on the metronome pointer and ensure that the card is close to or in contact with the reading area of the card swiping device under test during the swinging process;
[0068] If the card swiping interval supported by the test device is less than 1.5s, place the device reading area directly opposite the metronome's return position and swipe the card twice back and forth; if the card swiping interval supported by the test device is greater than or equal to 1.5s, place the test device on one side of the metronome and swipe the card once back and forth;
[0069] The speed of the pointer swing can also be used to fine-tune the swipe interval.
[0070] Step 4: Preset the key parameters required for the test in the control script or enter them through command line parameters;
[0071] Key parameters include the IP address of the device under test, the output interface of the auxiliary device, and the number of test cycles.
[0072] Step 5: Start the control script, initialize the connection between the auxiliary device and the card swiping device under test, control the metronome to simulate the card swiping according to the predetermined card swiping frequency and number, and monitor and record the test results at the same time.
[0073] Step 6: After the test is completed, the script automatically summarizes the test data and generates a test report;
[0074] The test data includes the number of successful card swipes, the number of failures, the total number of tests and the success rate.
[0075] The report should include an overview of the test process, detailed records of each card swipe, the final test conclusions, and possible fault analysis suggestions.
[0076] The present invention has the following innovations:
[0077] 1. Innovative transformation of the metronome: The present invention firstly makes a clever transformation of the traditional metronome, and through circuit design, its power supply is connected to the output port of an auxiliary control device. This design allows the start and stop of the metronome to be controlled by software rather than physical operation, which provides a basis for automated testing.
[0078] 2. Intelligent control with Python script as the core: This script can not only remotely control the output status of auxiliary equipment and realize precise on-off control of the metronome, but also adjust the frequency and number of card swiping according to the preset test plan, which greatly improves the flexibility and controllability of the test.
[0079] 3. Simulate the card swiping mechanism: Fix the NFC card on the swinging pointer of the metronome and use the regular swing of the metronome to simulate the real card swiping action. This physical simulation method is both economical and efficient, and can achieve accurate simulation of the card swiping process without introducing complex mechanical structures.
[0080] 4. Automated data collection and analysis: The script is further responsible for collecting the card swiping records of the device under test and comparing them with the start and stop times of the metronome controlled by the script. Through data comparison, the success rate of the test is automatically evaluated, thus eliminating the tedious steps of manual verification and improving the accuracy and efficiency of the test.
[0081] 5. Parameter configuration and test flexibility: The system supports highly parameterized configuration, including network information of the test equipment, control parameters of auxiliary equipment, and number of test cycles, etc., so that the present invention can adapt to different test environments and requirements, enhancing the breadth and practicality of application.
[0082] Example:
[0083] like Figure 2 As shown in the figure, it is an automated test simulation scenario of using a metronome to perform on-demand card swiping. The specific process is as follows:
[0084] 1. Modify the metronome and design auxiliary equipment:
[0085] Modification of the metronome power interface: First, modify the common metronome on the market and add an external control interface to its power circuit. During the modification, ensure that the negative pole of the metronome is connected to the output port of an auxiliary device so that the power-on and power-off status of the metronome can be controlled by the auxiliary device.
[0086] 2. Python script development and deployment:
[0087] Use Python programming language to develop a control script, including but not limited to the following functions:
[0088] Power control module: Sends instructions to auxiliary devices through network protocols to accurately control the start and stop of the metronome.
[0089] Data monitoring and recording: The script needs to monitor the network interface or API of the device under test and automatically collect feedback information after each simulated card swipe, including but not limited to the card swipe time and status (success / failure).
[0090] Result analysis: The script implements logic internally, compares the number of card swipes predicted by the metronome with the actual card swipe records received, and evaluates the test success rate.
[0091] Loop control: The script automatically manages the test process according to the number of tests set by the user and stops automatically after reaching the specified number of times.
[0092] 3. NFC card fixation and simulated card swiping
[0093] Select a standard NFC card and firmly bind it to the metronome pointer to ensure that the card can reliably approach or touch the reading area of the card swiping device under test during the swing of the metronome.
[0094] 4. Test parameter configuration and operation
[0095] Parameter setting: Preset the key parameters required for the test in the script or enter them through command line parameters, such as the IP address of the device under test, the control port number of the auxiliary device, the number of test cycles, etc.
[0096] Test execution: Start the Python script, which first initializes the connection with the auxiliary device and the device under test, then controls the metronome to simulate card swiping according to the predetermined card swiping frequency and number, while monitoring and recording the test results.
[0097] 5. Data processing and report generation
[0098] Report output: Generate a detailed test report based on the collected data. The report should include an overview of the test process, detailed records of each card swipe, final test conclusions, and possible fault analysis suggestions.
[0099] Through the above specific implementation methods, the present invention realizes automated and accurate testing of card swiping devices, greatly improves testing efficiency, reduces labor costs, and ensures the accuracy and repeatability of test results.
Claims
1. An automated testing method for on-demand card swiping using a metronome, characterized in that: The specific steps are as follows: Step 1: Modify the power interface of the metronome and connect the negative pole of the metronome to the output port of the auxiliary device; Step 2: Use Python programming language to develop control scripts to remotely control the output port status; The script should contain the following functions: 1) Power control module: sends instructions to auxiliary equipment through network protocol to accurately control the start and stop of the metronome; Among them, the command statement to start the metronome is: sendKeys(config_dict['assist_ip'],config_dict['assist_user'],config_dict['assist_password'],output1=OUT1_SOS'); The command statement to stop the metronome is: sendKeys(config_dict['assist_ip'],config_dict['assist_user'],config_dict['assist_password'],output1=OUT1_CLR'); Where assist_ip is the IP of the auxiliary device, assist_user is the HTTP protocol authentication name for communication, assist_password is the HTTP protocol authentication password for communication, OUT1_SOS is the control metronome power-on instruction ID, and OUT1_CLR is the control metronome power-off instruction ID; 2) Data collection and recording: The script needs to monitor the network interface or API of the device under test and automatically collect feedback information after each simulated card swipe, including the swipe time and status; The statement for data collection is: open_door_logs=getOpenDoorLogs('test_ip',test_user,test_password) test_ip is the IP address of the test device; test_user is the HTTP authentication user name of the test device, and test_password is the authentication password; 3) Result analysis: The script implements logic internally, compares the number of card swipes predicted by the metronome with the actual card swipe records received, and evaluates the test success rate; 4) Loop control: According to the number of tests set by the user, the script automatically manages the test process and controls the number of card swipes by cyclically calling power-on and power-off statements; it automatically stops after reaching the specified number of times; Step 3: Fix the NFC card on the metronome pointer and ensure that the card is close to or in contact with the reading area of the card swiping device under test during the swinging process; Step 4: Preset the key parameters required for the test in the control script or enter them through command line parameters; Step 5: Start the control script, initialize the connection between the auxiliary device and the card swiping device under test, control the metronome to simulate the card swiping according to the predetermined card swiping frequency and number, and monitor and record the test results at the same time; Step 6. After the test is completed, the script automatically summarizes the test data and generates a test report.
2. The automated testing method for on-demand card swiping using a metronome as claimed in claim 1, characterized in that: In the step 1, the auxiliary device has a network interface and an output interface, wherein the network interface is connected to the PC or the server; the output interface is used to control the power connectivity of the metronome, and the power-on and power-off states of the metronome are controlled by the auxiliary device; The auxiliary device receives control instructions from the PC via an Ethernet cable, and controls the switch state of the output port according to the instructions, thereby turning the metronome on or off.
3. The automated testing method for on-demand card swiping using a metronome as claimed in claim 1, characterized in that: In step three, if the card swiping interval supported by the test device is less than 1.5 seconds, place the device reading area opposite the metronome to the normal position, and swipe the card twice back and forth; if the card swiping interval supported by the test device is greater than or equal to 1.5 seconds, place the test device on one side of the metronome, and swipe the card once back and forth.
4. The automated testing method for on-demand card swiping using a metronome as claimed in claim 1, characterized in that: In step 3, the speed at which the pointer swings can be used to fine-tune the card swiping interval.
5. The automated testing method for on-demand card swiping using a metronome as claimed in claim 1, characterized in that: In step 4, the key parameters include the IP address of the device under test, the output interface of the auxiliary device and the number of test cycles.
6. The automated testing method for on-demand card swiping using a metronome as claimed in claim 1, characterized in that: In step 6, the test data includes the number of successful card swipes, the number of failures, the total number of tests and the success rate; The report should include an overview of the test process, detailed records of each card swipe, the final test conclusions, and possible fault analysis suggestions.
Citation Information
Patent Citations
Project research and development demand-based human resource determination method, device and equipment
CN116757430A
Banking system controlled responsive to data bearing records
US9224273B1