CN108197019A - Test system, test equipment, the test method of smart card - Google Patents

Test system, test equipment, the test method of smart card Download PDF

Info

Publication number
CN108197019A
CN108197019A CN201711387672.2A CN201711387672A CN108197019A CN 108197019 A CN108197019 A CN 108197019A CN 201711387672 A CN201711387672 A CN 201711387672A CN 108197019 A CN108197019 A CN 108197019A
Authority
CN
China
Prior art keywords
test
smart card
test case
read
testing tool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201711387672.2A
Other languages
Chinese (zh)
Inventor
张洁
陈超
张志红
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Datang Microelectronics Technology Co Ltd
Original Assignee
Datang Microelectronics Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Datang Microelectronics Technology Co Ltd filed Critical Datang Microelectronics Technology Co Ltd
Priority to CN201711387672.2A priority Critical patent/CN108197019A/en
Publication of CN108197019A publication Critical patent/CN108197019A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

Disclosed herein is test system, test equipment, the test methods of a kind of smart card, can at least shorten the development cycle of test case in test system, reduce maintenance cost.The test system of above-mentioned smart card may include such as lower component:Test case library, comprising the test case based on Python, the described test case is used to implement the test operation to smart card;Testing tool based on Python is configured to complete following test operation to realize the test to the smart card:For the operation of read-write equipment;APDU instructions or Python sentences are performed in Shell;Run the test case;Import the test case or the test case library.

Description

Test system, test equipment, the test method of smart card
Technical field
The present invention relates to technical field of intelligent card more particularly to a kind of test system of smart card, test equipment, test sides Method.
Background technology
IC card is now widely used for the fields such as payment (finance, traffic) and certification (identification, gate inhibition).IC card application Fast development, application of IC cards complexity, security requirement and machine card compatibility are required to improve increasingly, thus to smart card Test system also proposed higher requirement.
The test system of smart card is usually and is formed by the compiled language development such as C, C++ or java at present, test case Use the compiled language such as C, java or customized scripting language.But using compiled language such as C, java or certainly The test system that the script of definition is realized not only has certain limitation, but also user is needed to participate in manually, updates, repaiies Change and be required for recompilating, the development cycle is long, efficiency is low, maintenance cost is high, time cost is high, cumbersome, can not meet intelligence It can the growing testing requirement of card test system.
Invention content
This application provides test system, test equipment, the test methods of a kind of smart card, can at least shorten test system The development cycle of test case in system reduces maintenance cost.
This application provides following technical solutions.
A kind of test system of smart card runs on computer, and the computer is connect by read-write equipment with smart card, The test system includes such as lower component:
Test case library, comprising the test case based on Python, the described test case is used to implement to intelligence The test operation of card;
Testing tool based on Python is configured to complete following test operation to realize the survey to the smart card Examination:
Import the test case or the test case library;
Run the test case;
For the operation of read-write equipment.
Wherein, the testing tool is additionally configured to complete following test operation one or more:
Application Protocol Data Unit APDU instructions or Python sentences are performed in Shell;
The test case is debugged by Debug patterns;
Script is shown and editor;
Configuration item setting when smart card is tested;
The storage of test report is with automatically generating.
Wherein, the testing tool is arranged for carrying out the storage of test report with automatically generating, including:
Test report file is created under pre-set test report path;
According to pre-set configuration information, record test information forms the test report;
The test report file is written into the test report.
Wherein, the content of the test report includes one or more following:APDU instructions, the response of smart card of transmission As a result, time for each instruction, error message, test item.
Wherein, the testing tool is arranged to realize the storage of test report with automatically generating, further includes:It is being configured When being reported for misregistration, error reporting file is created under pre-set test report path, was performed in test case Record is with the inconsistent APDU log informations of expected result and being written the error reporting file in journey.
Wherein, the operation for read-write equipment includes one or more following:
Read-write equipment connects;
Read-write equipment disconnects;
Read-write equipment list refreshes;
Disconnect all read-write equipments;
APDU is sent to instruct and receive response;
Smart card resets;
Obtain the reset answer ATR of smart card.
Wherein, the testing tool is arranged to provide interactive interface, and grasp in response to the user on the interactive interface Make to complete the test operation to realize the test to the smart card.
Wherein, the interactive interface includes one or more following:
Engineering viewing area, for responding user's operation to realize the relevant test operation of test case;
Script shows editing area, for responding user's operation to realize the relevant test operation of script;
Shell areas, for responding user's operation to realize the relevant test operations of Shell.
Wherein, the testing tool is arranged to realize the engineering viewing area by treeview controls.
Wherein, the testing tool is arranged to realize that the script shows editing area by NoteBook controls.
Wherein, it further includes:Read-write equipment drive component;The testing tool is additionally configured to complete the test operation Before, it is established and communicated to connect by the read-write equipment drive component and the read-write equipment.
Wherein, it further includes:API component, the API component include one or more of following API:Read-write equipment operation is related API, algorithm API, APDU API;The testing tool is arranged to that the API is called to be formed described in test case and deposit Test case library.
A kind of test equipment of smart card, including:
Memory is stored with computer program;
Processor is configured to read the computer program to realize the function of above-mentioned test system.
A kind of computer readable storage medium is stored with computer program on the computer readable storage medium, described The function of above-mentioned test system is realized when computer program is executed by processor.
A kind of test method of smart card, including:
Show interactive interface;
The user's operation on the interactive interface is detected, and generates the event corresponding to the user's operation;
Under the action of the event, the testing tool based on Python completes following test operation to realize to institute State the test of smart card:
The test case or test case library are imported, the test case library includes the test case;
The test case based on Python is run, the test case is used to implement the test operation to smart card;
For the operation of read-write equipment.
Wherein, it further includes:Under the action of the event, the testing tool also completes the one or more of following test operation :
APDU instructions or Python sentences are performed in Shell;
The test case is debugged by Debug patterns;
Script is shown and editor;
Configuration item setting when smart card is tested;
The storage of test report is with automatically generating.
Wherein, the storage of the test report is with automatically generating, including:Test set by based on the user's operation Test report file is created under report path;Configuration information according to set by based on the user's operation, record test information, Form the test report;The test report file is written into the test report.
Wherein, the interactive interface includes one of following:Engineering viewing area, script show editing area, Shell areas;
Under the action of the trigger event, the testing tool based on Python completes test operation to realize to institute The test of smart card is stated, including one or more following:
In response to being directed to the user's operation of the engineering viewing area, the relevant test operation of test case is completed;
The user's operation of editing area is shown in response to being directed to the script, completes the relevant test operation of script;
In response to being directed to the user's operation in the Shell areas, the relevant test operations of Shell are completed.
Wherein, it further includes:In response to the user's operation on the interactive interface, one of following API or multinomial shapes are called Into test case and it is stored in test case library:Read-write equipment operates relevant API, algorithm API, APDU API.
The advantages of the application, includes at least:
In a kind of implementation of the application, the test system of the smart card based on Python, the survey of the smart card are provided Test system can support the test case that operation Python is write, and support different types of read-write equipment, and test is facilitated to use Example iteration, reduces development cycle and the maintenance cost of test case, greatly improves testing efficiency, can meet growing Testing requirement.
In the another implementation of the application, the test of smart card is realized by interactive interface, forms a kind of interactive volume Journey experience and different situations under quick-adjustsing ability, not only realize more simple, flexible, but also simplify and can only block test When user's operation, user experience is more preferable, testing efficiency also higher.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification It obtains it is clear that being understood by implementing the present invention.The purpose of the present invention and other advantages can be by specification, rights Specifically noted structure is realized and is obtained in claim and attached drawing.
Description of the drawings
Attached drawing is used for providing further understanding technical solution of the present invention, and a part for constitution instruction, with this The embodiment of application technical solution for explaining the present invention together, does not form the limitation to technical solution of the present invention.
Fig. 1 is schematic diagram the application example that intelligent card test system is connect with computer correlation function library in the relevant technologies The configuration diagram of property application environment;
Fig. 2 is the structure of the test system of one smart card of embodiment and its schematic diagram for implementing framework;
Fig. 3 is the exemplary flow schematic diagram of testing tool implementation procedure in embodiment one;
Fig. 4 is the schematic diagram of an exemplary interactive interface of one testing tool of embodiment;
Fig. 5 is the schematic diagram of the another exemplary interactive interface of one testing tool of embodiment;
Fig. 6 is the example arrangement schematic diagram of one treeview controls of embodiment;
Fig. 7 is the flow diagram of the test method of five smart card of embodiment.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application Feature mutually can arbitrarily combine.
Step shown in the flowchart of the accompanying drawings can be in the computer system of such as a group of computer-executable instructions It performs.Also, although logical order is shown in flow charts, it in some cases, can be to be different from herein suitable Sequence performs shown or described step.
The schematic diagram being connect as shown in Figure 1 for intelligent card test system in the relevant technologies with computer correlation function library.Its In, test system is an application software operated under computer Windows operating system, test system operation when need with The dynamic link library of computer Windows operating system, api function connection use.Dynamic base and api function are Windows The function library of operating system itself, test system can realize the defeated of various data by relevant function in call function library Enter, export.Computer is connect with card reader, card reader is equipped with smart card to be measured, and operation can be written and read to smart card. The test system of smart card is usually to be formed by the compiled language development such as C, C++ or java, and test case uses C, java etc. Compiled language either customized scripting language.
In the relevant technologies, intelligent card test system is primarily present following problem:
(1) generally using the compiled language such as C, java either customized scripting language's test case.It uses C, the test case that the compiled language such as java is write, need to first be compiled, it is impossible to which modification immediately performs immediately.Using making by oneself The test case of the scripting language of justice, library function is not abundant enough, and the function of support is less, there is certain limitation.
(2) the test system realized using the either customized script of the compiled language such as C, java, needs to use Journal file, which is manually operated, in family in test case could record test log.
(3) testing tool realized using the either customized script of the compiled language such as C, java, some surveys Trial work tool needs to develop interpreter to parse customized script, some in exploitation using compiled language, need compared with More codes realize some or certain functions (and the function can be realized using a small amount of code in Python), or both have both at the same time; And in tool renewal, need to recompilate generation, and update entire kit.It is long so as to cause the testing tool development cycle, Complexity is high, and maintenance cost is high.
For the above problem of the relevant technologies, the following technical solutions are proposed by the application, which provides one kind and be based on The test system of the smart card of python, the test system of the smart card can support the test that operation python language is write to use Example, support different types of read-write equipment, facilitate test case iteration, reduce test case development cycle and safeguard into This, greatly improves testing efficiency, can meet growing testing requirement.In addition to this, it can also support to automatically generate survey Examination report, further promotes testing efficiency, meets growing testing requirement.
Term is explained as follows in the application:
A. about smart card
Smart card (Smart Card) is also known as integrated circuit card (IC card, Integrated Circuit Card).Intelligence Card is by different criteria for classifications, and there are many different types, in the application, smart card refers to the smart card with CPU.It carries The smart card (with chip form presence) of CPU is internal can be including (but not limited to) microprocessor unit (for example, CPU), storage Unit (for example, RAM, ROM, EEPROM etc.), input/output interface unit.Wherein, RAM can be used in storage calculating process Intermediate data, curing has chip operating system (COS, Card Operating System) in ROM, and EEPROM can be used for depositing It puts the personal information of holder and issues unit for information about.
B. about Python
Python is a kind of explanation type computer programming language of object-oriented.Python supports the wind of object-oriented Lattice or code wrap are in the programming technique of object.Not needing to other language using python language development maintenance test use-cases must The intermediate steps such as the compiling and link that need.
Python interpreters are a kind of programs that python programs is allowed to behave.When having write one section of Python program, Python interpreters will read the Python programs, and be performed according to order therein, obtain a result.In fact, interpreter is Software logic layer between code and the computer hardware of machine.
C. about IDLE
IDLE is the Integrated Development Environment that Python software packages carry, and can easily be created using it, run, surveys Examination and debugging Python programs.
D. about test system, testing tool
Testing tool involved by technical scheme is the Integrated Development Environment based on python interpreters, it can be with Smart card is connected by read-write equipment, the test to smart card can be realized by testing results use-case (i.e. python programs). The test system mentioned in the application includes (but not limited to) testing tool, common self-defined api interface, dynamic link library And test case.
The realization method of technical scheme is illustrated below.
Embodiment one
As shown in Fig. 2, the present embodiment provides a kind of test system of smart card, computer is run on, the computer leads to Read-write equipment (for example, card reader or other similar there is the equipment of smart card reader) is crossed to connect with smart card, the survey Test system can include such as lower component:
Test case library 21, comprising the test case based on Python, the described test case is used to implement to intelligence The test operation that can block;
Testing tool 22 based on Python is configured to complete following test operation to realize to the smart card Test:Import the test case or the test case library;Run the test case;For the operation of read-write equipment.
In the present embodiment, the test case of operation python scripting languages is supported.Python provides powerful Basic function, script durability is strong, and script amount significantly reduces, be greatly improved test case write and maintenance in terms of matter Amount and efficiency.
In the present embodiment testing tool be based on Python interpreters, using python language developments, and testing tool It supports the script of operation python language, without developing script language interpreter, compiling link process is needed not move through, if there is new Python language versions publication, also can easily and fast be synchronized on the testing tool.In addition, it is only needed during publication testing tool Modification or newly-increased .py files are issued, facilitates update and the iteration of testing tool.
The above-mentioned test system of the present embodiment can also include:Read-write equipment drive component 23, the read-write equipment driving group Part is used to implement the communication between testing tool and read-write equipment.The testing tool 22, is also configured as described in completion Before test operation, established and communicated to connect by the read-write equipment drive component 23 and the read-write equipment, read with will pass through Write device tests smart card.
The above-mentioned test system of the present embodiment can also include:API component 24, the API component 24 can include Common API, for example, one or more of following API can be included:Read-write equipment operates relevant API, algorithm API, APDU API.The testing tool 22 is configurable to that the API is called to form test case and is stored in the test case library.Pass through API component, test system can provide the self defined interfaces such as abundant smart card relevant interface, algorithm interface, such as read-write is set Standby special purpose interface library, algorithm interface library etc., fast and easy realizes application function, improves the versatility of test system, reduces Size of code.In a kind of realization method, API component 24 can include the API of Python.In another realization method, API groups Part 24 can include the API of Python and the API of non-Python.
The above-mentioned test system of the present embodiment can also include:Dynamic link library 25, the dynamic link library can include non- The API of Python;The testing tool 22 is also configured as calling the API in the dynamic link library to be formed described Test case.The function of testing tool can be extended (for example, further types of read-write is supported to set by dynamic link library It is standby), also allow for update, the iteration of testing tool.In practical application, which can be independently arranged, and can also close And arrive API component 24.
As shown in Fig. 2, testing tool can be supported to export test report, smart card survey automatically in the test system of the present embodiment The functions such as debugging of configuration item setting (not shown), test case during examination.Specifically, a kind of realization method of the present embodiment In, the testing tool 22, be also configured as completing following test operation one or more:Application protocol is performed in Shell Data cell APDU is instructed or Python sentences;The test case is debugged by Debug patterns;Script is shown and editor;Intelligence Configuration item setting during test can be blocked;The storage of test report is with automatically generating.
In concrete application, the above-mentioned test system of the present embodiment can be the software of an operation on computers.Into During row test, need smart card and read-write equipment by contacting or cordless connection, read-write equipment are connect with computer. Read-write equipment carries out communications and data interaction by read-write equipment driving with testing tool.In practical application, when being tested, It needs to imported into testing tool based on the test case library that Python is write, testing tool is loaded into test case library Script (i.e. py files) and parse, the file (for example, pyc files) after parsing by Python interpreters is performed, is being held Implementing result is shown in row.After the completion of execution, can also test report be automatically generated by testing tool 22.Write test case When, customized common API and the dynamic link library 25 of realization specific function in API component 24 can be called.
In the above-mentioned realization method of the present embodiment, the testing tool 22 is specifically configurable to realize test report Storage with automatically generating, including:Test report file is created under pre-set test report path;According to pre-setting Configuration information, record test information, form the test report;The test report file is written into the test report. Here, the content of the test report can include one or more following:The APDU instructions of transmission, the response knot of smart card Fruit, time for each instruction, error message, test item.In addition to this, the testing tool 22 is specifically configurable to realize and survey The storage of report is tried with automatically generating, can also be included:When being configured to misregistration report, in pre-set test report Error reporting file is created under path, record and the inconsistent APDU log informations of expected result in test case implementation procedure And the error reporting file is written.It is appreciated that the storage of test report can also include other with automatically generating, in this regard, It not limits herein.
By above-mentioned realization method, the testing tool of the present embodiment can be supported to export test report automatically, and user only need to be The storing path of test report is set on tool GUI, other operations are automatically performed by testing tool, including automatically generating test Report, record Application Protocol Data Unit (APDU, ApplicationProtocol data unit) (APDU be smart card with The information unit transmitted between the card reader of smart card) and its response, count every APDU time for each instructions and total when performing Between, statistical test item, form error listing etc. so that user can focus more on the exploitation of test case.Meanwhile it also supports Customized test log is written in test case, customized test log can be recorded in test report for testing tool, Facilitate the analysis and positioning of problem in test process.
In a kind of realization method of the present embodiment, the operation for read-write equipment can include one or more following:It reads Write device connects;Read-write equipment disconnects;Read-write equipment list refreshes;Disconnect all read-write equipments;APDU is sent to instruct and receive Response;Smart card resets;Obtain the reset answer (ATR) of smart card.
In a kind of realization method of the present embodiment, the testing tool 22 is specifically configurable to provide interactive interface, and By realizing the test to the smart card in response to the above-mentioned test operation of the user's operation completion on the interactive interface. In this way, quick-adjustsing ability under a kind of interactive programming experience and different situations is formd by interactive interface, with reference to Grammer succinct Python and powerful built-in tool reduce the complexity of code, when realizing identical function, this implementation The test system of example is more simple, compact compared to the test system for C, C++ and Java being used to realize in the relevant technologies, also cleverer It is living, so as to improve test case exploitation maintenance efficiency.
In above-mentioned realization method, the interactive interface can include one or more following:Engineering viewing area, for ringing User's operation is answered to realize the relevant test operation of test case;Script show editing area, for respond user's operation with Realize the relevant test operation of script;Shell areas, for responding user's operation to realize the relevant tests of Shell Operation.In addition to this, which can also include other parts, such as menu area etc..For the specific cloth of interactive interface Office's mode, not limits herein.
In above-mentioned realization method, the testing tool 22 is specifically configurable to by described in the realization of treeview controls Engineering viewing area.In above-mentioned realization method, the testing tool 22 specifically is configurable to realize by NoteBook controls The script shows editing area;Wherein, a page of the NoteBook controls is a text control, for showing one Script file, each text controls set the page that his father is NoteBook controls.
The example implementations that system is tested in the present embodiment are illustrated below.
Example 1
In this example, the function that the testing tool in test system is realized can include:Card reader operating function, Shell It is middle execution APDU instruction or Python sentences, testing results use-case, Debug patterns debugging test case, import test case or Testing engineering, script are shown and editor, testing tool functional configuration, the storage of test report and automatic generation function, self-defined Interface function.In practical application, testing tool realizes above-mentioned function in its implementation procedure.
Fig. 3 is the exemplary flow of testing tool implementation procedure.As shown in figure 3, testing tool implementation procedure is exemplary Flow may include steps of:
Step 301, after the icon for clicking test software, flow starts;
Step 302, start host process, initialize and draw gui interface.
Step 303, socket (socket) is created, creates subprocess, subprocess entrance function is set, starts subprocess.
Step 304, subprocess start, and create sub-line journey, and sub-line journey is set as ready state.
Step 305, subprocess main thread enter its cyclic program, wait pending specific Python sentences.
Step 306, the sub-line journey of subprocess create socket, and connect host process.
Whether step 307, detection sub-line journey connection main thread succeed;When the sub-line journey of subprocess and host process successful connection When, enter step 308;When the sub-line journey of subprocess is with host process connection failure, 309 are entered step;
Step 308, when the sub-line journey of subprocess and host process successful connection, into the cyclic program of sub-line journey, wait for Host process message is simultaneously returned the result to host process.
Step 309, when the sub-line journey of subprocess and host process connection failure, show error message.
Whether step 310, detection host process within a specified time receive the connection of all subprocess;When host process is specified The connection of all subprocess is received in time, enters step 311;When host process is within a specified time not received by all sons The connection of process, enters step 312;
Step 311, when host process within a specified time receives the connection of all subprocess, host process enters its and recycles journey Sequence waits for testing tool trigger event and makes a response, and continue step 313;
Step 312 is within a specified time not received by the connection of all subprocess when host process, host process pop-up prompting Frame shows software anomaly, and software is closed, and flow terminates.
Step 313 detects whether to click exit button;It detects that the clicking operation of exit button enters step 314, does not examine Measure the clicking operation of exit button then return to step 311;
Step 314, after the clicking operation of exit button is detected, host process receives the event of exiting, at this point, closing All subprocess, and terminate test software, flow terminates.
It should be noted that the execution flow in this example is merely illustrative realization method, it will be understood that in concrete application Testing tool also can be used other execution flows and realize its function.
Example 2
In this example, testing tool realizes its function by interactive interface.
Fig. 4, Fig. 5 are respectively the illustrative interfaces fig. of the interactive interface of testing tool.As shown in Figure 4, Figure 5, interaction circle Face increases common button area (including menu bar, toolbar etc.), engineering viewing area, foot on the basis of IDLE shell interfaces This display editing area.That is, the interactive interface on the basis of with Shell areas, also add common button area (including Menu bar, toolbar etc.), engineering viewing area, script show editing area.
Separately below to interactive interface each section and by interactive interface how to realize the various functions of testing tool into Row explanation.
A, engineering viewing area
The test case library write using Python forms a test case library, often by multiple modules (script) A module realizes different function.In order to preferably embody this organizational form, the test system in the present embodiment increases engineering Viewing area.
Show that engineering is realized by treeview controls.The initialization of the control and function realization have invoked ttk modules Method in Treeview classes.It is illustrated in figure 6 the example arrangement of treeview controls.
B, script shows editing area
Realize that file shows that the difficult point of editing area is how to include multiple files in the same window, NoteBook controls Part can support a page (page) in multiple tabss, therefore NoteBook controls has been selected to realize in the present embodiment and have been somebody's turn to do Function.Each page is a text control, shows a file.Text controls are realized by EditWindow classes, each text Control cannot be an individual window (TopLevel), it is necessary to set the page that his father is NoteBook controls.
File shows that editing area supports automatic retraction, grammer to be highlighted function.Automatic retraction function can determine cursor Position, when keying in the corresponding keyword of control structure, will start automatic contracting at the specified Ullage of next line after pressing enter key Into function;Grammer, which is highlighted, to be shown element different in code using different colors, can be more easily discriminated not Same syntactic element, so as to improve readability, at the same time also reduces the possibility of error.
It should be noted that the layout type of interactive interface is not limited to above-mentioned Fig. 4, other layout type also can be used.
C, card reader (a kind of example of read-write equipment i.e. described above) operating function
Smart card testing tool supports all card reader for following PCSC specifications, for all such card reader, tests work Tool with Direct Recognition and can use.Other do not follow the card reader of PCSC specifications, as long as providing corresponding dynamic link library and interface Function (i.e. API) can carry out Function Extension by changing in testing tool to the function that card reader operates.
Here, card reader operating function can include:Card reader connection disconnects, card reader list refreshing, disconnects all readings Card device, send APDU instruct and receives response, the reset of smart card, acquisition smart card ATR.
Functions of card reader is illustrated below.
1st, card reader connection, break function, there are two types of modes.
(1) it specifies card reader connection, disconnect:It is commonly used in interface shown in Fig. 4 in button area under menu bar " Reader " Draw in menu, show the card reader of current PC machine identification, can select the card reader for it is expected to connect herein, click be attached or It disconnects;
(2) testing tool connects, disconnects card reader automatically:Click Card Reader on the toolbar that button area is commonly used in interactive interface Device prompt operation button is attached or opening operation, this mode can be connected automatically in the card reader that can be connected, and works as presence It is multiple can connect card reader when, the card reader first searched for can be connected.
2nd, card reader list refresh function, can be by clicking under menu bar in interactive interface shown in Fig. 4 " Reader " " Refresh Reader List " item is realized.
3rd, all functions of card reader are disconnected, " all Card Readers are disconnected in toolbar by clicking in interactive interface shown in Fig. 4 Device " button is realized, can disconnect all card reader connected at present.
4th, card resets, the reset answer (ATR) of acquisition smart card, transmission APDU are instructed and received response function, passes through The function that software is realized is performed in shell (Shell) or script to realize.Send functions transmission APDU is performed to instruct and return to sound Should, it performs cardReset functions and realizes the reset of smart card, and obtain the ATR of smart card.
In practical application, aforesaid way is practiced without limitation to card reader operation, can also be realized by other means.Than Such as, PyScard libraries can also be used to carry out card reader operation.
D. test report is automatically generated
The support of smart card testing tool automatically generates test report, convenient for the positioning and analysis of contingency question, and can remember Record test case executive condition.It, can be in the menu bar " Options " on interactive interface as shown in Figure 4 in practical application In " Configuration " dialog box, the storage of test report can be configured, corresponding configuration item can include:It is It is no in LOG files record APDU, whether misregistration report, test report store path.The first two configuration item can select Select "Yes" or "No".Whether " in LOG files record APDU " indicates whether the APDU performed in test process instructions is automatic It is recorded in test report;Whether " misregistration report " indicates whether to automatically generate error reporting after test.For Occur the situation with being expected not being inconsistent in test process, can be automatically logged into test report, without being controlled by above-mentioned configuration item.
(1) when performing test script, host process creates test report file under specified test report path, for depositing Store up test report.For example, test report file name can be " date-time _ test case name ", and opened in test report file Head position write-in current time of day and script path, position convenient for subsequent query.
(2) test report file is operated by host process, according to configuration information, record test information forms test report, interior Appearance can include:The APDU instructions of transmission, card (i.e. smart card) response results, time for each instruction, error message, test item Deng.If calling testing tool custom function printLog in script, the information specified in function can be written together Test report file.
(3) test script perform terminate or because with expectation state it is inconsistent cause test script perform interruption after, in master Test report file handle is closed in process.
(4) if the log content of above-mentioned test report file write-in is more, file is caused to be more than preset threshold value (for example, 5M), can automatically save current log file, then create new test report file and carry out log recording, facilitate day Will is analyzed.
(5) when configuration item " whether misregistration report " is "Yes", host process meeting under specified test report path Error reporting file is created, is recorded and the inconsistent APDU log informations of expected result automatically in test case implementation procedure.
(6) test case perform complete or because with expectation state it is inconsistent cause perform interruption after, testing tool is united automatically Meter script performs total time and is recorded in test report file.
It should be noted that test log file designation, the log content of record and recording method are not limited to the above method, It can also realize by other means.For example, it can also be realized using logging libraries.
E. the test case is debugged by Debug patterns
In practical application, it can be operated by the Debug areas of the rightmost side in the interactive interface of testing tool as shown in Figure 5 To realize the debugging of test case.Wherein, which can be with display protocol stack (stack), global variable (Globals), office The information such as portion's variable (Locals).
Example 3
This example illustrates the API component in test system.
For some common functions is avoided to repeat to realize in test case engineering (that is, test case library), in this example Test system is integrated with common API for users to use in its API component, be broadly divided into card reader processing API, algorithm API, APDU API and some other common API.As the following table 1 lists part API:
Table 1
It should be noted that test case is often not limited to API shown in table 1, the API of other expansible functions.In this regard, It not limits herein.
Example 4
This example illustrates the test case for testing system.
In test system, test case uses python language developments.Python is a kind of very flexible script Language has powerful grammatical function, the abundant library and durability is strong, favorable expandability of increasing income, easy to use, greatly shortens It the development cycle of test case, reduces upgrade maintenance cost, lays the foundation to promote testing efficiency.
According to multiple rows such as financial application, EDEP applications, social security application, residents ' health application, educational applications, traffic applications The requirement of industry application, the various universal commands using in specification or function is abstracted, as test frame.In this frame On the basis of, it by Python Object Oriented Characteristics, realizes test case and test point, forms testing engineering.During test, Ke Yi Selection needs the test point tested in testing engineering, directly performs testing engineering and is tested.Different regions are to existing application Specification has some personalized customization or has new sector application to occur, and can be based on the basis of existing test frame Python object oriented language characteristics increasing, deleting, changing test point, facilitate the iteration of test script.
The test system of the present embodiment, is applicable to all types of read-write equipment for smart card, including conventional card reader, intelligence It can card dedicated tester MP300TCL1 and large-scale intelligent card issuing equipment etc..
Embodiment three
A kind of test equipment of smart card, including:
Memory is stored with computer program;
Processor is configured to read the computer program to realize the test system of smart card described in example one.
The other technologies details of the present embodiment can refer to example one.
In practical application, which can be any computing device that can realize corresponding function.For example, the calculating Equipment can be embodied as (but not limited to) server computer, work station, desktop computer, laptop computer, notes It this computer, mobile computing device and/or is configured as performing any other calculating of the function of test system described herein and sets It is standby.In a kind of realization method, which can be the computer in framework shown in Fig. 2.
Example IV
A kind of computer readable storage medium is stored with computer program on the computer readable storage medium, described The function of the test system of smart card described in embodiment one is realized when computer program is executed by processor.
The other technologies details of the present embodiment can refer to example one.
In a kind of realization method, which can be that the storage of framework Computer shown in Fig. 2 is situated between Matter.
In practical application, above computer readable storage medium storing program for executing can be it is permanent and non-permanent, removable and it is non-can Mobile memory medium can realize that information stores by any method or technique.Information can be computer-readable instruction, data Structure, the module of program or other data.The computer readable storage medium can include but is not limited to:Phase transition internal memory (PRAM), static RAM (SRAM), dynamic random access memory (DRAM), other kinds of arbitrary access are deposited Reservoir (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), fast flash memory bank or other in Deposit technology, CD-ROM read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic box type magnetic Band, disk storage or other magnetic storage apparatus or any other non-transmission medium can be visited available for storage by computing device The information asked.
Embodiment five
A kind of test method of smart card is realized by testing system described in embodiment one, as shown in fig. 7, can include:
Step 601, interactive interface is shown;
Step 602, the user's operation on the interactive interface is detected, and generates the event corresponding to the user's operation;
Step 603, under the action of the event, testing tool based on Python complete following test operation with Realize the test to the smart card:The test case or test case library are imported, the test case library includes the survey Example on probation;The test case based on Python is run, the test case is used to implement the test operation to smart card;Needle Operation to read-write equipment.
Wherein, the event corresponding to user's operation can be trigger event or other kinds of event, for the thing The concrete type of part not limits herein.
In a kind of realization method, the test method of the present embodiment can also include:Under the action of the trigger event, institute State testing tool also complete following test operation one or more:APDU instructions or Python sentences are performed in Shell;Pass through Debug patterns debug the test case;Script is shown and editor;Configuration item setting when smart card is tested;Test report It stores and automatically generates.
In a kind of realization method, the storage of the test report can include with automatically generating:It is grasped based on the user Make to create test report file under set test report path;Match confidence according to set by based on the user's operation Breath, record test information, forms the test report;The test report file is written into the test report.
In the present embodiment, the interactive interface can include one or more following:Engineering viewing area, script display editor Area, Shell areas.Correspondingly, under the action of the trigger event, the testing tool based on Python completes test operation To realize the test to the smart card, one or more following can be included:In response to being directed to the use of the engineering viewing area Family operates, and completes the relevant test operation of test case;The user's operation of editing area is shown in response to being directed to the script, Complete the relevant test operation of script;In response to being directed to the user's operation in the Shell areas, the relevant institutes of Shell are completed State test operation.
In the present embodiment, above-mentioned test method can also include:In response to the user's operation on the interactive interface, call One of following API or multinomial formation test case are simultaneously stored in test case library:Read-write equipment operates relevant API, algorithm API、APDU API。
The other technologies details of the present embodiment can refer to embodiment one.
The application the various embodiments described above can at least obtain one or more of following technique effect:
(1) the application shortens the development cycle of test case, reduces maintenance cost.
A, the characteristic of speech sounds based on Python can easily build test frame and test case library, and with need The application function to be tested is different, and the test case library for meeting new opplication requirement can be customized with fast and easy, completes iteratively faster, Rate of code reuse is improved, shortens the structure time of test case library.
B, compiling, link etc. are intermediate necessary to not needing to other language using python language development maintenance test use-cases Step can be immediately performed test case, and the effect after test case is able to immediately see after changing code and is changed forms one kind Interactive programming is experienced and quick-adjustsing ability under different situations.And the succinct grammers of Python and powerful built-in work Tool reduces the complexity of code, when realizing identical function, with Python programs than using C, C++ and written in Java Program is more simple, compact, also more flexible, so as to improve test case exploitation maintenance efficiency.
C, the relevant custom function library of abundant smart card, such as read-write equipment special purpose interface are provided in test system Library, algorithm interface library etc., fast and easy realize application function, reduce size of code.
D, testing tool support automatically generates test report, including test event, APDU and its response, error message etc., Therefore it is not required to extra process test log in test case;In addition, to show that editing area supports that automatic retraction, grammer highlight aobvious for file The functions such as show.These functions mean the syntax format of care code that user can be less, focus more on opening for test case Hair with it is perfect.
(2) testing tool exploitation and upgrading used in this application are more convenient, flexible.
A, the exploitation of testing tool takes full advantage of the object-oriented of python language, supports multi-process, powerful library work Tool, the features such as grammer is flexible, the development cycle is shortened on the basis of correctness is ensured, also reduces subsequent maintenance cost.
B, testing tool need not develop script language interpreter, need not move through compiling link process, when issuing testing tool It only needs to issue modification or newly-increased py files, it, also can be conveniently fast subsequently if there is new python language versions are issued Being synchronized on the testing tool for speed, is easy to develop, update, iteration.
Although disclosed herein embodiment as above, the content only for ease of understanding the present invention and use Embodiment is not limited to the present invention.Technical staff in any fields of the present invention is taken off not departing from the present invention Under the premise of the spirit and scope of dew, any modification and variation, but the present invention can be carried out in the form and details of implementation Scope of patent protection, still should be subject to the scope of the claims as defined in the appended claims.

Claims (19)

1. a kind of test system of smart card runs on computer, the computer is connect by read-write equipment with smart card, It is characterized in that, the test system includes such as lower component:
Test case library, comprising the test case based on Python, the described test case is used to implement to smart card Test operation;
Testing tool based on Python is configured to complete following test operation to realize the test to the smart card:
Import the test case or the test case library;
Run the test case;
For the operation of read-write equipment.
2. test system according to claim 1, which is characterized in that the testing tool is additionally configured to complete to survey as follows Try one or more of operation:
Application Protocol Data Unit APDU instructions or Python sentences are performed in Shell;
The test case is debugged by Debug patterns;
Script is shown and editor;
Configuration item setting when smart card is tested;
The storage of test report is with automatically generating.
3. test system according to claim 2, which is characterized in that the testing tool is arranged for carrying out test report Storage with automatically generating, including:
Test report file is created under pre-set test report path;
According to pre-set configuration information, record test information forms the test report;
The test report file is written into the test report.
4. test system according to claim 2, it is characterised in that:
The content of the test report includes one or more following:The APDU instructions of transmission, the response results of smart card, instruction Perform time, error message, test item.
5. test system according to claim 2, which is characterized in that the testing tool is arranged to realize test report The storage of announcement is further included with automatically generating:
When being configured to misregistration report, error reporting file is created under pre-set test report path, is being tested Record is with the inconsistent APDU log informations of expected result and being written the error reporting file in use-case implementation procedure.
6. test system according to claim 1, it is characterised in that:
The operation for read-write equipment includes one or more following:
Read-write equipment connects;
Read-write equipment disconnects;
Read-write equipment list refreshes;
Disconnect all read-write equipments;
APDU is sent to instruct and receive response;
Smart card resets;
Obtain the reset answer ATR of smart card.
7. test system according to any one of claims 1 to 6, which is characterized in that the testing tool is arranged to carry The test operation is completed to realize to the smart card for interactive interface, and in response to the user's operation on the interactive interface Test.
8. test system according to claim 7, which is characterized in that the interactive interface includes one or more following:
Engineering viewing area, for responding user's operation to realize the relevant test operation of test case;
Script shows editing area, for responding user's operation to realize the relevant test operation of script;
Shell areas, for responding user's operation to realize the relevant test operations of Shell.
9. test system according to claim 8, which is characterized in that the testing tool is arranged to pass through Treeview controls realize the engineering viewing area.
10. test system according to claim 8, which is characterized in that the testing tool is arranged to pass through NoteBook controls realize that the script shows editing area.
11. test system according to claim 1, which is characterized in that
It further includes:Read-write equipment drive component;
The testing tool is additionally configured to before the test operation is completed, passes through the read-write equipment drive component and institute It states read-write equipment and establishes communication connection.
12. test system according to claim 1, which is characterized in that
It further includes:API component, the API component include one or more of following API:Read-write equipment operates relevant API, calculation Method API, APDU API;
The testing tool is arranged to that the API is called to form test case and is stored in the test case library.
13. a kind of test equipment of smart card, which is characterized in that including:
Memory is stored with computer program;
Processor is configured to read the computer program to realize the work(of any one of claim 1 to the 12 test system Energy.
14. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium Program realizes the function of any one of claim 1 to the 12 test system when computer program is executed by processor.
15. a kind of test method of smart card, including:
Show interactive interface;
The user's operation on the interactive interface is detected, and generates the event corresponding to the user's operation;
Under the action of the event, the testing tool based on Python completes following test operation to realize to the intelligence The test that can block:
The test case or test case library are imported, the test case library includes the test case;
The test case based on Python is run, the test case is used to implement the test operation to smart card;
For the operation of read-write equipment.
16. test method according to claim 15, which is characterized in that further include:
Under the action of the event, the testing tool also completes one or more of following test operation:
APDU instructions or Python sentences are performed in Shell;
The test case is debugged by Debug patterns;
Script is shown and editor;
Configuration item setting when smart card is tested;
The storage of test report is with automatically generating.
17. test method according to claim 16, which is characterized in that the storage of the test report with automatically generating, Including:
Test report file is created under based on the test report path set by the user's operation;
Configuration information according to set by based on the user's operation, record test information, forms the test report;
The test report file is written into the test report.
18. according to claim 15 to 17 any one of them test method, it is characterised in that:
The interactive interface includes one of following:Engineering viewing area, script show editing area, Shell areas;
Under the action of the trigger event, the testing tool based on Python completes test operation to realize to the intelligence The test that can block, including one or more following:
In response to being directed to the user's operation of the engineering viewing area, the relevant test operation of test case is completed;
The user's operation of editing area is shown in response to being directed to the script, completes the relevant test operation of script;
In response to being directed to the user's operation in the Shell areas, the relevant test operations of Shell are completed.
19. test method according to claim 15, which is characterized in that further include:
In response to the user's operation on the interactive interface, call one of following API or multinomial formation test case and be stored in Test case library:Read-write equipment operates relevant API, algorithm API, APDUAPI.
CN201711387672.2A 2017-12-20 2017-12-20 Test system, test equipment, the test method of smart card Pending CN108197019A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711387672.2A CN108197019A (en) 2017-12-20 2017-12-20 Test system, test equipment, the test method of smart card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711387672.2A CN108197019A (en) 2017-12-20 2017-12-20 Test system, test equipment, the test method of smart card

Publications (1)

Publication Number Publication Date
CN108197019A true CN108197019A (en) 2018-06-22

Family

ID=62577022

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711387672.2A Pending CN108197019A (en) 2017-12-20 2017-12-20 Test system, test equipment, the test method of smart card

Country Status (1)

Country Link
CN (1) CN108197019A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109558915A (en) * 2018-10-24 2019-04-02 大唐微电子技术有限公司 A kind of smart card operation method and apparatus
CN109918338A (en) * 2019-03-11 2019-06-21 北京智芯微电子科技有限公司 Safety chip operating system testing device
CN109933480A (en) * 2019-03-15 2019-06-25 捷德(中国)信息科技有限公司 A kind of blind tune method of COS embedded development, system, equipment and storage medium
CN110442487A (en) * 2019-08-13 2019-11-12 东信和平科技股份有限公司 A kind of smart card communication protocol test method, device, system and readable medium
CN110544503A (en) * 2019-08-28 2019-12-06 深圳忆联信息系统有限公司 test method for evaluating total write-in quantity of SSD and computer equipment
CN112416324A (en) * 2020-11-24 2021-02-26 歌尔光学科技有限公司 Script function implementation method based on python language, terminal equipment and storage medium
CN117929973A (en) * 2024-03-21 2024-04-26 星汉智能科技股份有限公司 Smart card aging test method, smart card aging test device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1791258A (en) * 2005-12-29 2006-06-21 北京握奇数据系统有限公司 Smart card testing method
CN101094484A (en) * 2006-11-24 2007-12-26 广州市宜通世纪科技有限公司 Interactive testing device for data of smart card, and method for testing quality of network by using the smart card
CN106908709A (en) * 2015-12-23 2017-06-30 上海华虹集成电路有限责任公司 The system and method for electromagnetic distu during detection intelligent card non-contact communication

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1791258A (en) * 2005-12-29 2006-06-21 北京握奇数据系统有限公司 Smart card testing method
CN101094484A (en) * 2006-11-24 2007-12-26 广州市宜通世纪科技有限公司 Interactive testing device for data of smart card, and method for testing quality of network by using the smart card
CN106908709A (en) * 2015-12-23 2017-06-30 上海华虹集成电路有限责任公司 The system and method for electromagnetic distu during detection intelligent card non-contact communication

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
常连城: "基于Python的智能卡自动测试平台", 《万方数据知识服务平台:HTTP://D.WANFANGDATA.COM.CN/THESIS/Y2002720》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109558915A (en) * 2018-10-24 2019-04-02 大唐微电子技术有限公司 A kind of smart card operation method and apparatus
CN109918338A (en) * 2019-03-11 2019-06-21 北京智芯微电子科技有限公司 Safety chip operating system testing device
CN109918338B (en) * 2019-03-11 2024-01-23 北京智芯微电子科技有限公司 Safety chip operating system testing device
CN109933480A (en) * 2019-03-15 2019-06-25 捷德(中国)信息科技有限公司 A kind of blind tune method of COS embedded development, system, equipment and storage medium
CN109933480B (en) * 2019-03-15 2023-04-21 捷德(中国)科技有限公司 COS embedded development blind tone method, system, equipment and storage medium
CN110442487A (en) * 2019-08-13 2019-11-12 东信和平科技股份有限公司 A kind of smart card communication protocol test method, device, system and readable medium
CN110544503A (en) * 2019-08-28 2019-12-06 深圳忆联信息系统有限公司 test method for evaluating total write-in quantity of SSD and computer equipment
CN112416324A (en) * 2020-11-24 2021-02-26 歌尔光学科技有限公司 Script function implementation method based on python language, terminal equipment and storage medium
CN112416324B (en) * 2020-11-24 2024-02-09 歌尔科技有限公司 Script function implementation method based on python language, terminal equipment and storage medium
CN117929973A (en) * 2024-03-21 2024-04-26 星汉智能科技股份有限公司 Smart card aging test method, smart card aging test device and storage medium

Similar Documents

Publication Publication Date Title
CN108197019A (en) Test system, test equipment, the test method of smart card
CN106844217B (en) Method and device for embedding point of applied control and readable storage medium
CN108885545B (en) Tools and methods for real-time dataflow programming languages
CN105912473B (en) Mobile APP automatically testing platform and test method based on BDD
US9946514B1 (en) Systems and methods for generating functional application designs
CN103984626B (en) A kind of method and device for generating test case script
CN109669688A (en) Based on visual software development methodology, device, terminal device and storage medium
US20230273775A1 (en) Remote application modernization
Yu et al. Social modeling for requirements engineering: An introduction
CN101206570B (en) Method and system for generating user interface
CN107644286A (en) Workflow processing method and device
CN106126424B (en) A kind of visual automated testing method of script, device and mobile terminal
WO2006130684A2 (en) Systems and methods for automated testing
CN102915242A (en) Method for implementing code programming by graphical operations
CN104866416B (en) The method and apparatus for realizing application program capacity analysis
CN109840205A (en) Applied program testing method, device, readable storage medium storing program for executing and terminal device
US20240086165A1 (en) Systems and methods for building and deploying machine learning applications
CN106874208A (en) The processing method of test script, device and electronic equipment
CN107678949A (en) Realize the automated testing method of embedded device different communication mode
CN106294172B (en) App self-testing methods based on terminal device and device
CN110287106A (en) Adjustment method, device, electronic equipment and the storage medium of shader code
CN108874649A (en) Generation method, device and its computer equipment of automatic test script
Mao et al. User behavior pattern mining and reuse across similar Android apps
CN114185874A (en) Big data based modeling method and device, development framework and equipment
US11372750B2 (en) Test script for application under test having abstracted action group instantiations

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180622