JInjector - PLEASE lend some direction

17 views
Skip to first unread message

Herman Smith

unread,
Mar 31, 2010, 7:55:15 AM3/31/10
to jinj...@googlegroups.com, julia...@googlemail.com
Hi

About 8 months ago I moved over from web development to J2ME.  The initial transition was quite painful but I am happy to say that I am now feeling quite at home with it.

Working on a team with 2 other developers I have realized the ABSOLUTE NECESSITY to integrate our work with some form of testing at the various levels.  We are initially going forward by writing Unit tests for new work we do and as time allows will perform some refactoring of existing code to facilitate its testing as well.

I was very excited to learn about the existence of JInjector.  The presentations from Hotmobile2009 really looked like it was the perfect solution to our scenario which entailed the assertion that working code kept working even when parts of the system are changed.  This obviously meant that we would add our Unit tests (which we would have to do in J2MEUnit) and then subsequently investigate how to make use of the other forms of testing available to us by going with Jinjector.

With great enthusiasm I downloaded the TimeMIDletExample(2009-03-12).zip  (as we are still running on WTK2.5.2_01) and attempted to get going (only managed to do this after merging the contained directory with the checked out jinjector_mobile directory).  However even after this I am left with so many questions regarding what goes for what?  Is there by any change an example of how to use Jinjector that does not assume so much of what I assume is working knowledge of the subject?  I distinctly remember that in one of the presentation it mentioned initial time investment by Google totaled 200 person days but recently an individual well versed with all aspects was able to perform a complete JInjector integration in about 2.5 hours? 

What would the advised course of action be in regards to least painful way to get up to speed with using and benefitting form using Jinjector?

What I ideally would like to look at would be something that brings to light the proposed pattern of a J2ME solution designed with testing with JInjector in mind.  Is there anything like this out there or is the only route to figure it all out from scratch as I am doing it at the moment?

Any advice regarding this matter would be greatly appreciated.

Sincerely,

--
Herman Smith - Software Developer, Technologist and Adventurer
Mobile:+27 82 441 1631
Skype: herman.g.smith
Google Talk: herman...@gmail.com

Julian Harty

unread,
Apr 1, 2010, 6:40:26 PM4/1/10
to Herman Smith, jinj...@googlegroups.com
Herman,
firstly, I'm pleased you've found JInjector and made the effort to try it out. I'll try to answer as best I can, however I don't think I have any good shortcuts for you (as you'll learn...)

We originally ended up creating JInjector to address 2 related issues for developers:
  1 collecting code coverage metrics.
  2 to automate the testing of a couple of our J2ME applications.

The tool ended up being more general as it evolved, however the main development, and the primary users, were deeply experienced and competent developers of J2ME software. My role was more of project sponsor, champion, and guide, I'm not a hardcore developer, especially not for J2ME apps. We got permission to share the project as an open-source project, which we managed to do, however we didn't have much time to write extra examples (beyond the TimeMIDlet). For various unrelated reasons both Michele and I moved into other areas outside mobile phone test automation. However several people were able to download and use JInjector with varying degrees of success. The more successful efforts were by people who understand the platform and tools, J2MEUnit, and their application code. We tried to share notes and feedback via this googlegroup when people contacted us and were willing to share their work in public.

Michele would probably still be able to write automated tests for a new application within a day (he's the expert and at the time was able to write tests for an application within a couple of hours) however as far as I know he's busy with other things at the moment. I know jinjector is still being used for various projects, as I don't hear much from the project teams I assume they're coping with whatever changes they're making.

In principle I'd still like to see JInjector under active development and use, and of course more examples would help. I'm open to accepting contributions, and testing them, adding notes, etc. Personally I'm more involved in Android development in terms of mobile applications and I've decided to devote my available time to that work for the next month or so. I'd be willing to dedicate some time to JInjector later this spring if I'm aware of people being interested (i.e. demand-driven development :)

If you're willing to persevere and share your experiences I'll try to answer your questions, etc. Good Luck


Julian

Herman Smith

unread,
Apr 6, 2010, 4:25:06 AM4/6/10
to Julian Harty, jinj...@googlegroups.com
Hi

Thank you very much for your reply.

Apologies for the delayed response but I have been on leave and am only back in work-mode today.

I am very keen to get JInjector up and going on our side and would be more than willing to contribute examples etc which could assist other adopters.  What I will be attempting today is to get the jinjector_tool node of the codebase building on my local in order for me to reverse engineer what I can from it to have a better idea of how I should approach the actual integration on our own code-bases.

Regards,
H
--

Michele Sama

unread,
Apr 6, 2010, 6:06:00 PM4/6/10
to jinj...@googlegroups.com, Julian Harty, herman...@gmail.com
Herman,

sorry for my late response. As Julian mentioned I have lot's of things going on at the moment. However I will do my best to try to help you as much as I can.

The first suggestion I can give you is to understand which kind of "Jinjector user" are you:
  • If you "simply" need to instrument your J2ME application, you can use a precompiled version of the instrumentation tool, or simply use ant to compile it from source. Then you will have to create a J2ME project including the decorator which will be injected in your application.
  • If you need to extend JInjector with additional features then you also need to setup a java project to recompile the instrumentation tool with your extensions. JInjector contains a sort of plugin-like feature called adapters which allows you to load extensions at runtime.
Assuming that you are simply trying to instrument your application I suggest you to start at first with a single feature. I would start either with GUI automated testing or with code coverage. You can also try both simultaneously as we do in the TimeMidlet example. Please make sure that your properties file is configured properly. Most of the first run problems are in that file.

Another common source of problems is the ant file performing the injection, due to the number of files required. To inject for coverage you need in addition to your midlets file also the standard set of decorators (http://code.google.com/p/jinjector/source/browse/#svn/trunk/jinjector_mobile/decorators_src). To inject a suite you also need the source code of your tests. The jar to be instrumented cannot be obfuscated. I also recommend to avoid any other form of compression or optimization. I suggest to compile for 1.3 JInjector should work with java up to 1.5, but not with 1.6 due to a problem in the ASM library (which may also have been fixed).

Please let me know your progress.
Michele.


--
You received this message because you are subscribed to the Google Groups "jinjector" group.
To post to this group, send email to jinj...@googlegroups.com.
To unsubscribe from this group, send email to jinjector+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jinjector?hl=en.



--
/**
* @author -Michele Sama- aka -RAX-
*
* University College London
* Dept. of Computer Science
* Gower Street
* London WC1E 6BT
* United Kingdom
*
* Email: M.Sama (at) cs.ucl.ac.uk
*
* Group:
* Software Systems Engineering
*
*/
Reply all
Reply to author
Forward
0 new messages