How to (unit) test JavaCards?

Hi @all,
what tool do you use to test cards?
(I mean the classic expected vs. actual tests)
Is it possible to test within JCShell?
There is a command /test-suite, but I have now idea how to use it (and the manpage does not help alot)
Cheers,
Max

If you want automated tests, you can have a JUnit test suite that can communicate with either a real card or your simulator of choice and send your APDU's to the card. You can build up the test framework to the point where you can exercise all the expected behaviour of your applets. You can assert the actual response from the card against an expected raw result, or you can decode the data you get back and check that. It is quite flexible but it can be a lot of work to get the framework setup.
Cheers,
Shane

Similar Messages

  • How to unit test EJB3 without container

    I want to unit test EJB 3 outside container, ie. without deploying it in container. I want to test all the three EJBs, entity, session and MDB beans. My EJBs are complex one, one EJB injecting other EJB. Please help me out how to go for it. Looking for prompt support. Thx in advance.

    [http://ejb3unit.sourceforge.net/|http://ejb3unit.sourceforge.net/]
    ejb3unit is your friend!
    m
    nb: doesn't do MDB but you can test the logic in a pojo...

  • How to unit test pl/sql collection in the unit test ?

    There is a function SPLIT_LIST (see below) to split a string list to a collection type .
    I'm trying to use the SQLP DEVELOPER to do the unit test on this fucntion. The idea is to use lookups to give multiple string list for different inputs such as 'A,B,C' 'D', '', 'EF,,GH'. for multiple tests a time.
    the expected result (function returns) are SPLIT_TBL('A','B',C'), SPLIT_TBL('D'), SPLIT_TBL(), SPLIT_TBL('EF','','GH')
    But I have problem to use unit test to verify the result based on the lookups as the out put is the collection. anyone has a good idea to do those ?
    create or replace TYPE SPLIT_TBL AS TABLE OF VARCHAR2(32767) ;
    create or replace
    FUNCTION SPLIT_LIST (
    P_LIST VARCHAR2,
    P_DEL VARCHAR2 DEFAULT ' ' )
    RETURN SPLIT_TBL PIPELINED DETERMINISTIC
    IS
    lv_idx PLS_INTEGER;
    lv_list VARCHAR2(32767) := P_LIST;
    lv_value VARCHAR2(32767);
    BEGIN
    LOOP
    lv_idx := instr(lv_list,p_del);
    IF lv_idx > 0 THEN
    PIPE ROW(SUBSTR(lv_list,1,lv_idx-1));
    lv_list := SUBSTR(lv_list,lv_idx+LENGTH(p_del));
    ELSE
    PIPE ROW(lv_list);
    EXIT;
    END IF;
    END LOOP;
    RETURN;
    END;
    /

    I'm having a similar problem - have you solved yours yet?
    As for me, when I return a collection as an output parameter from a procedure, I can't test the result.
    Example: I'm testing a procedure defined like this: Procedure check_this (p_id number, p_result out CompResult)
    where CompResult is defined as: create or replace type CompResult is varray(100) of CompObj;
    Unit Test understands that the data type of out parameter p_result is CompResult.
    It fills in schemaName.CompResult() as the result (empty varray).
    Editing of the result does not appear to be allowed - it's read only.
    So, when the proc returns a varray that isn't empty, the test fails.

  • Unit testing in J2EE environment

    Hi All:
    We have been trying to use Junit for creating unit test scripts, and have been bit successful in unit testing DAOs and Value objects - but problem is testing of components like EJBs and Servlets or even classes like Actions or Commands. Since these components run under application server environment, I am not sure how to unit test them without either deploying them on the actual server or simulating app server and rest of the system.
    I was wondering if people could share their experience in writing unit test scripts especially for J2EE components - like Servlets, JSPs and EJBs. On the similar note, is there any similar tool or API for creating integration test scripts?
    Thanks,

    Well - we already have couple of other servers but that's for beta, QA and Integration testing. Problem is with the unit testing. In unit testing, some piece of code is tested by itself. And I am not sure how I can unit test some of the classes like Servlets, EJBs, JSPs or even dependent classes like Commands or Actions. For example, consider following Action class from Java Pet Store:
    public final class CartHTMLAction extends HTMLActionSupport {
    public Event perform(HttpServletRequest request)
    throws HTMLActionException {
    // Extract attributes we will need
    String actionType= (String)request.getParameter("action");
    HttpSession session = request.getSession();
    // get the shopping cart helper
    CartEvent event = null;
    if (actionType == null) return null;
    if (actionType.equals("purchase")) {
    String itemId = request.getParameter("itemId");
    event = new CartEvent(CartEvent.ADD_ITEM, itemId);
    else if (actionType.equals("remove")) {
    String itemId = request.getParameter("itemId");
    event = new CartEvent(CartEvent.DELETE_ITEM, itemId);
    else if (actionType.equals("update")) {
    Map quantities = new HashMap();
    Map parameters = request.getParameterMap();
    for (Iterator it = parameters.keySet().iterator();
    it.hasNext(); ) {
    String name = (String) it.next();
    String value = ((String[]) parameters.get(name))[0];
    final String ITEM_QTY = "itemQuantity_";
    if (name.startsWith(ITEM_QTY)) {
    String itemID = name.substring(ITEM_QTY.length());
    Integer quantity = null;
    try {
    quantity = new Integer(value);
    catch (NumberFormatException nfe) {
    quantity = new Integer(0);
    quantities.put(itemID, quantity);
    event = CartEvent.createUpdateItemEvent(quantities);
    return event;
    In order to unit test above class from say, JUnit test script class, I will have to pass HttpServletRequest object to its method - I will also have to store corresponding command params and store them in the request object - how will you write unit test script for the above class?

  • Unit Testing in Report Generation

    I am new to SAP-BW. looking as of how can Unit Testing be done in Reports. and any other kind of testing on reports.
    any kind of information on report testing, how is it usually done would be real helpful.
    thanks in advance

    Hi Kavi,
    As far as i have gathered knowledge in Report Unit Testing.these are the important points
    you have four kind of unit testing to be done on the reports.
    1.Security : This will include testing the functionality of the security module with regards to validation of user profile and that access to reports is provided based on user group profile. The users can be categorized into the following types and this information can be obtained from Report Technical Design Document.
    o     View a snapshot of a report generated earlier
    o     Can execute report
    o     Edit the report
    2.User Experice Testing: basically how the report looks to user, the fonts, the titles, kind of obvios but important stuff.
    3. Data Validation Testing: To see if the data we obtain in the reports is same as the data present in the Source R/3 System. This can be done by taking some raw data from source system and cross checking with the reports. This can be done manually, I dont have any idea to automate this process.I am not sure if automation can be done. This is a painful process but, very important step and crutial in unit testing.
    4. Navigational Testing: This is basically testing all the drill down function, navigational and Report to Report linkage. This info we can get from the technical design document for the reporting. and corresponding Test Scripts can be prepared from it.
    As you can see The template will be consisting of all the above said columns, Entry and Exit Criteria and corresponding people who are going to perform the test.(Onsite/offsite).
    For each case a testscript can be prepared and can be used multiple times whenever report has to be tested.
    I do have a template.BUt i need to edit it somewat before mailing.Do tell me if u need one...or is this information sufficient.
    Hope it Helps
    AKB

  • Call to a possibly undefined method displays when using static function in Unit Test

    Hello!
    This has been driving me nuts. I am setting up unit tests for a static class which manages a collection of songs. This is how my unit test class looks:
    //START CODE
    package flexUnitTests {
              import com.myapp.managers.MusicManager;
              import flash.utils.Dictionary;
              import flexunit.framework.Assert;
              public class MyAppManagerTest {
                        [Before]
                        public function setUp():void {
                                  var songData:Dictionary = new Dictionary();
                                  songData["mn0012345"] = new Dictionary();
                                  songData["mn0012345"]["title"] = "All the Pretty Little Horses";
                                  songData["mn0012345"]["description"] = "by: American Traditional | Voice, Piano | 3 pages";
                                  MusicManager.setSongData(songData);
                        [Test]
                        public function test_getAuthorsBySKU():void {
                                  var expected:String = "American Traditional";
                                  var given:String = MusicManager.getAuthorsBySKU("mn0012345");
                                  Assert.assertEquals(expected, given);
    //END OF CODE
    You will notice two calls in red above. When I leave them in the code I see a variety of errors which look like this:
    "Call to a possibly undefined method '' through a reference with a static type com.myapp..."
    And
    "Access of possible undefined property '' through a reference with static type com.myapp..."
    Then, when I comment out the two lines in red above, these errors go away. Flash Builder seems really flakey to me. Often I notice that the error list varies, how can it just no longer be an error? Where did this new access error come from, in a no related part of the code, by adding or removing a function call to a static class which remains in the import statement.
    Note that the MusicManager contains no references to any of the UI mxml that is throwing these errors. It just simply loads data into a few globals and allows you to grab info.
    How is my usage of this function making foreign objects inaccessible?
    Please help!!! I am really hoping there is an answer but I have a bad feeling the answer is just that Flash Builder is flakey.

    I did some more work on the issue above. There are functions with in the MusicManager that call the UserManager to get a user's ID. When I comment out these calls then the access errors go away. Well the user manager has some calls back to mxml that tell the class that changes where made. My best guess is this is where it stems into the code that is randomly throwing errors. But, it compiles fine and runs fine on a device. Is there something with test cases which doesn't invoke the UI?

  • Best Practices for unit testing an Xlet?

    I'd like to be able to unit test and Xlet using JUnit, but have been stumped by how this can be done correctly.
    The first inclination is that I should mock the XletContext, but that seems to be getting out of control quickly.
    Does anyone have any tips on this they can point me to?
    Thanks.

    Hi Jean-Paul Smit,
    Here is a goog article about how to unit test SQL Server 2008 database using Visual Studio 2010, please see:
    http://blogs.msdn.com/b/atverma/archive/2010/07/28/how-to-unit-test-sql-server-2008-database-using-visual-studio-2010.aspx
    Thanks,
    Eileen
    TechNet Subscriber Support
    If you are
    TechNet Subscription user and have any feedback on our support quality, please send your feedback
    here.

  • Recommended way to unit test mobile cross platform C++ in Visual Studio 2015

    Hello,
    I'm playing with the new Visual Studio 2015 to check its capabilities for cross platform development using C++ as coding language. I've seen several videos in Channel9 about this feature but I don't remember hearing in any of these a word about how
    to unit test such projects from Visual Studio 2015. Is there some recommended way to create unit tests for such projects?
    I'm not sure I can use Visual Studio test projects for C++ to test the android library or the Windows Phone 8.1. If I add a new platform ARM to a test project of those, I cannot select in the platform toolset combo the values that I have for my libraries
    (Clang 3.4 and Windows 8.1 respectively). So it seems that such test projects are not addressed for cross platform c++ in VS2015.
    I also have tried to make a second cross platform library project to contain the tests, adding there the Catch.h file from catch framework or adding the files from Google Test framework. My idea was to link each cross platform test library with their corresponding
    "production code" libraries. In both cases (catch and gtest) I have problems when trying to compile the test framework files (not sure if it is not possible or just my fault being new at C++ for mobile platforms).
    Has anyone succeeded unit testing the cross platform c++ code in VS2015? How?
    Thanks in advance,
    Jorge.

    Hi Jorge,
    Thanks you for posting in MSDN forum.
    Based on your issue, since VS2015 Preview is previews for the next major release of Visual Studio, currently we forums don’t provide support for VS2015 Preview. So the product team would accept the suggestions or feedbacks for the VS2015 now.
    So you can submit the feedback/suggestions to Microsoft Connect feedback portal:
    http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx, Microsoft engineers will evaluate them seriously. Thanks for your understanding.
    After you submit the feedback, you can post the link here which will be beneficial for other members with the similar issue. And I will help you to vote it.
    Thank you for your understanding.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I unit test my Swing application?

    Hi All,
    In my application I came across a situation where I have to automate the unit testing of my application.
    Using my application user can able to draw polylines and rectangles on a BufferedImage added to a JFrame.
    Can any one please help/suggest me, how to automate the drawing process (this process consists of drawing the polylines with mouse and few action/mouse events)?
    your help will be highly helpful to me.
    Satya

    What exactly will that unit test prove? That you can mock the drawing of lines?
    Unit test are supposed to test certain parts of your application code - I'd concentrate on unit tests that are actually useful and for example in the future can help to catch regressions.
    If anywhere you can get help creating unit tests of this magnitude, I'd look in the unit testing support for Swing applications. Google for "java swing unit test" to see what you can come up with. Probably you'll need to create some plumbing yourself to make custom painting unit-testable; perhaps you could do something with painting to a BufferedImage in stead of to a Swing component for example.

  • How can I compare the actual and expected values in Unit testing when they are XML files?

    I have created a unit test for a method in VS 2008. My expected value and actual value are XMLs. Therefore though the output is same as I expect it gives an error as I am doing string comparison now. How can I compare these 2 XMLs in expected output and
    actual output format in Unit Testing?
    mayooran99

    In unit test, when you want to validate XML files, you feed them into the class / struct that you want to feed the XML into and compare the values there (You don't just feed it in XMLReader and feed it line by line, right? But if it really is, that's how
    you should also test it in unit tests).
    In short, how you'd use the XML in your code, that's how you should test it in unit test.

  • I can't figure out how to set a breakpoint in a SenTestingKit unit test

    I'm learning Cocoa after decades of doing other languages. I'm trying to use SenTestingKit for unit tests. One of my unit tests doesn't work, and I want to set a breakpoint to figure out why. So far, I haven't figured out how to do this.
    I found Chris Hanson's instructions for how to do this, but he apparently wrote them for an earlier version of Xcode, and I don't know enough to adapt them.
    I am writing a tutorial document for writing a simple Cocoa App using Xcode 3.1, git, SenTestingKit, and OCMock. It's at http://xorandor.com/FirstCocoaApp. I've got it up to the point of trying to debug a unit test, and I'm stuck there.
    I also couldn't figure out how to have Xcode run the unit tests while building the application. Again, Chris' instructions didn't quite do it, and I don't know enough to figure out the rest.
    So, if you know how to do this, please give me some hints. I'll put those into my tutorial, so that the next people who need this can find it.
    Thanks,
    Pat

    I figured out more of my problem, but I haven't solved it yet.
    What happens is that, after I create a test case, I try to run it with a breakpoint. After I start the program, Xcode turns the breakpoint from blue (meaning active) to orange (meaning that it can't set the breakpoint).
    Several people have said to turn off the Lazy symbol loading preference. I did that, and that didn't fix the problem.
    I wrote up a detailed list of steps that I took at http://www.xorandor.com/DebugQuestion.txt
    I also put a copy of the project file at http://xorandor.com/MyProject.tar
    If anyone has any suggestions on what to try next, please let me know.
    Thanks,
    Pat

  • Flash Builder 4.6 - How can I keep unit test classes out of the finished swc?

         I have a library of code I'm building and I'm working on unit testing but I have a major issue. When my finished swc compiles no matter what I do it includes the unit test classes as part of the intellisense if you load the swc via flash. The classes aren't really in the swc since if you just try and import them they'll come up undefined. They only appear to go into the intellisense for the swc. Does anyone know how can I keep this from happening in the finished source? Currently my folder setup is like this in flash builder.
    src\main - source documents for the library to get compiled
    src\mock - mock class area for unit testing
    src\test - unit test classes
         In the project Properties panel > the first tab of my Flex Library Build path I have selected only the src\main folder for the classes to inlude in the library. No other folder paths are selected.
    The "Flex Library Build Path" doesn't change my results with any setting.
    Thanks,

    Mel Riffe,
    Here's a Help topic about compiler options in Flash Builder: http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb524b8220812e5611f28f-7fe7. html
    For information on using mxmlc, the application compiler, to compile SWF files from your ActionScript and MXML source files, you can see: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fcc.html
    Hope this helps,
    Mallika Yelandur
    Flash Builder Community Help & Learning
    Adobe Systems Incorporated

  • How to debug in dedicated unit test client

    Hello,
    We have a setup where we do all development in client 100, but have a separate client for unit tests. Since this is the client holding relevant test data, we would like to debug in this client.
    How can I achieve this in Eclipse, do I need to create two projects (one for each client) and open the object twice, or is it possible to setup using debug configurations or something similar?
    Regards

    Hi Matthias,
    in Java you need OS privileges to debug Java code running on any Java application server (and additionally set up the Java VM in debug mode and stuff like that). And once you have OS privileges, you can of course debug all Java VM processes/threads on the machine, regardless which application context they are currently running for.
    In ABAP you do NOT need any kind of OS privileges in order to debug. All you need is a user in the system/client with debug privileges, which is big advantage in terms of privilege separation. ABAP debugging on customer systems for example, which is a quite normal thing, would be much harder to realize, if we require any kind of OS privileges.
    To cut a long story short:
    As a user is required with debugging privileges in any ABAP system/client for ABAP debugging, it is not possible to realize a remote debugging in ABAPinEclipse just by specifying SID/client of the remote ABAP system.
    So you need to logon to the ABAP system/client (and set breakpoints there) in order to debug. And as the system/client logon to the ABAP backend in ABAPinEclipse is conceptually linked to a project, you need to have an open project for those ABAP system/clients you want to debug in.
    Regards,
    Christoph Stoeck, ABAP Language

  • How do you debug your unit tests?

    Hey folks,
    I'm obviously doing something wrong that I can't figure out. I've tried following Chris Hanson's instructions that he put on LJ. No matter what I do, I can't get the debugger to breakpoint in a unit test, no matter whether I put the breakpoint in the test code or the worker code. I can get it to breakpoint just fine in the worker code when I run the real app.
    How do you do this on your unit test code?
    Thanks,
    Pat

    Tried that. No joy so far. That's why I asked here; I hoped that someone here had done it successfully.
    Pat

  • How can I test for the bas unit enterd in a control?

    How can I to create a polymorphic vi where the user can enter either volume or temperature.
    how can Labwiev test for the base unit entered
    pseudocode example:
    input X
    if X.base_unit == m^3 do ....... 
    thanks for any suggestion to resolve or avoid my problem
    Solved!
    Go to Solution.

    Hi schaerm,
    you have to dig deeper.
    An idea is this one:
    The red marked word is containing the unit - in a coded way. Somewhere in the LV help you can find the description of this coding (I remember a chapter on memory representations of all LV datatypes...). (There surely is an easier or better way - but the example is done quic&dirty.)
    You can also format the number into a string and analyze the unit here...
    Message Edited by GerdW on 02-07-2010 07:21 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • Steps to migrate SQL Database to Windows/Oracle

    hi We have an SQL database in our client network and client wants to migrate it to Windows/Oracle. Currently they have multiple databases on the same SQL server. So I am curious to know if oracle also allows the same in Windows. I read that we can in

  • Fastest way to copy/import photos from cd

    Hi I have about 300 cds with an average of 200MB of photos on them.  I would like to get these photos onto my hard drive.  Is there software available to help speed up the process? Are there cd drives which are significantly faster than the MacBook P

  • How to connect with database 11g from jdk1.6

    Hi Actually i am a beginner to java, please provide some documents related to database connectivity and explain stepwise for connection to oracle database 11g using jdk1.6. Regards Dhabas

  • From-children

    I tried to use from-children in my xsl script for a transformation. I got an error back that from-children function not found. ORA-20100: Error occurred while processing: XSL-1015: Function 'from-children' not found. null

  • What happens when your contract ends?

    My contract ends on the 10th, but I want to wait until after the 17th to do anything.  (New job, different discount, etc.)