Passing config data to JMUnit test case

  • artfish

    artfish - 2008-06-04

    Is there any way to pass config data to a JMUnit test case
    or prompt the user upfront before kicking off test suite.
    I have written JMUnit test cases that do functional testing to
    a Gateway system. A URL has to be given to the Gateway system that
    the midlet test cases contact. Currently I have this hardcoded in the test code.
    I would like the ability to be able to prompt the user or pass in as argument
    or a config parameter this URL before executing the test cases. Is there any way
    to do this with JMUnit? Is so, could you provide the means on how to do this.


    • CA Meijer

      CA Meijer - 2008-06-04

      Hmm.  There are a couple of crude alternatives.

      Option 1.
      One workaround might be to create two MIDlets in the same MIDlet suite: 1)Your test MIDlet and 2) a MIDlet that gets the URL from the user.  The MIDlet that gets the URL writes it to the RecordStore.  The test suite MIDlet reads the URL from the RecordStore.

      Option 2.
      Instead of hardcoding it, you could store the URL in a resource file that your test suite reads?  You'd still need to rebuild every time you want to change the URL so this might not offer any advantage from your perspective (especially if you're testing on real devices rather than the emulator).

      Both of the above might be too crude for your purposes though :)



Log in to post a comment.