Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Card Unit Testing

I'd like to run my Java Card applications in some kind of emulated/simulated environment to be able to run JUnit (or any other unit test framework) tests on them. Does anyone know of such a tool? I'd prefer some open source project.

like image 211
AO. Avatar asked Feb 27 '10 20:02

AO.


1 Answers

Special for this purpose our team developed jCardSim: open-source JavaCard Simulator - http://code.google.com/p/jcardsim/.

//1. create simulator
Simulator simulator = new Simulator();
//2. install applet
simulator.installApplet(appletAID, HelloWorldApplet.class);
//3. select applet
simulator.selectApplet(appletAID);
//4. send apdu
ResponseAPDU response = simulator.transmitCommand(new CommandAPDU(0x01, 0x01, 0x00,   0x00));
//5. check response
assertEquals(0x9000, response.getSW());

Unit-test example : http://code.google.com/p/jcardsim/source/browse/trunk/src/test/java/com/licel/jcardsim/base/SimulatorTest.java

It's fully emulate the real NXP-chip JavaCard. Try use it. Any comments and ideas are welcome! We will be grateful if you share link to the project!

like image 184
MikhailDudarev Avatar answered Sep 24 '22 14:09

MikhailDudarev