dandycheung / jinjector Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/jinjector
Automatically exported from code.google.com/p/jinjector
/* Copyright 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ JInjector is composed of two different codebases. Which one you need depends on how you intend to use JInjector. The folder "jinjector_mobile" contains the binary of JInjector and the source code of additional classes, called "decorators" which will be included in your application during the instrumentation. If you intend to use JInjector this is probably the source folder that you need to download. The folder "jinjector_tool" contains the sources of JInjector, an instrumentation tool for Java-based code. The code is Java 6 compatible and it has been tested using the OpenJdk 1.6. You will need to download this sources *only and only if* you intend to extend or modify JInjector. If you intend to add you own custom instrumentation modules to JInjector *without* changing JInjector itself you do NOT need this source. You can simply import the jar in your project and include your modules in the properties file. JInjector will load them at runtime automatically. See the properties file for more details.
JInjector is using ASM in COMPUTE_FRAME. However ASM has a
bug/missing-feature which may cause the instrumentation to fail. This
generally do not happen with code compiled for java 1.3 or older (e.g. J2ME
code).
It is necessary to switch to COMPUTE_MAX mode
What steps will reproduce the problem?
1. Compile a bunch of classes with code compatibility 1.5
2. Instrument them.
What is the expected output? What do you see instead?
A SEVER error in the instrumentation log
Please use labels and text to provide additional information.
Original issue reported on code.google.com by michele.sama
on 4 Mar 2009 at 1:12
I would love to see jinjector doing this..
The creating of test suite could be injected at build time..
e.g
public Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new TestTimeMIDlet("system tests"){
public void runTest() throws InterruptedException {
testGetTime();
}
});
return suite;
}
All such methods could be injected at build time by using the desktop jdk
to introspect (using reflection) the byte code of TestTimeMIDlet and such
method would have been generated.
Also, many reflection related info required by test automation framework
could be automatically given to these limited java support devices by way
properties/api etc.. and these properties could be filled at build time by
desktop jdk doing the reflection at build time and adding these properties.
e.g if JavaME test framework needs list of public methods and their
parameters, at build time,each class would be using desktop jdk and
respective properties could have be put as a properties file..
This approach could really make testing very efficient rather than current
approach of we writing all these meta information.
Over all I am extremely happy to see JInjector approach as the best
possible approach as available today for embedded devices.
Regards,
Raja Nagendra Kumar,
C.T.O
www.tejsoft.com
-Embedded Enterprise Applications Test Automation Excellence
Original issue reported on code.google.com by [email protected]
on 26 Apr 2010 at 2:54
The code is instrumented with COMPUTE_MAXS and frames are not computed.
Compute frames in each method visitor.
Original issue reported on code.google.com by michele.sama
on 22 Mar 2009 at 3:40
What steps will reproduce the problem?
1. Override and instrument a Canvas
2. invoke CanvasWrapper.invokeKeyPressed(0);
What is the expected output? What do you see instead?
The event is only fired to the superclass and not to the derived class.
This will prevent implementation processing the event in the derived class
to handle the event.
Original issue reported on code.google.com by michele.sama
on 13 Mar 2009 at 4:19
Hi Hello
Please add one more test case in your Latest Project Source code.
Can J Injector test cases run with independently? Like Robotium.
can I send send the key Events like Down(),Up(),Right(),Left()?
When i am trying to run all test cases with suites i am getting this
error(Please see the Image)
Original issue reported on code.google.com by [email protected]
on 18 Nov 2010 at 7:57
Attachments:
What steps will reproduce the problem?
1. Implement a MIDlet without overriding the destroyApp() method
2. Instrument it for coverage
3. Collect the coverage
The coverage will not be collected because the missing method will not be
instrumented. The class adapter should realize that destroyApp is missing
and should add it to the class including code to collect the coverage.
Original issue reported on code.google.com by michele.sama
on 11 Mar 2009 at 9:39
Hello hai
I have customized my test cases like these..
void fire_CMD_SUBMIT() throws InterruptedException {
JINJMEUtil.fireCommand(mainScreen,
ResBundle.getI18NMessage(AppLang.CMD_SUBMIT));
Thread.sleep(1000L);
}
void fire_CMD_REGISTER() throws InterruptedException {
JINJMEUtil.fireCommand(mainScreen,
ResBundle.getI18NMessage(AppLang.CMD_REGISTER));
Thread.sleep(1000L);
}
void create_FormWrapper() {
mainScreen = JINJMEUtil.waitAndGetDisplayableOfType(midlet, Form.class);
form = (FormWrapper) mainScreen;
}
void create_ListWrapper() {
mainScreen = JINJMEUtil.waitAndGetDisplayableOfType(midlet, List.class);
list = (ListWrapper) mainScreen;
}
void create_AlertWrapper() {
mainScreen = JINJMEUtil.waitAndGetDisplayableOfType(midlet,
Alert.class);
alert = (AlertWrapper) mainScreen;
}
void create_TextFiledWrapper1() {
tfw1 = (TextFieldWrapper) form.get(0);
}
void create_TextFiledWrapper2() {
tfw2 = (TextFieldWrapper) form.get(1);
}
void create_TextFiledWrapper3() {
tfw3 = (TextFieldWrapper) form.get(2);
}
void create_TextFiledWrapper4() {
tfw4 = (TextFieldWrapper) form.get(3);
}
void create_TextFiledWrapper5() {
tfw5 = (TextFieldWrapper) form.get(4);
}
public void testRegisterInvalid1() throws InterruptedException {
create_FormWrapper();
fire_CMD_REGISTER();
create_FormWrapper();
create_TextFiledWrapper1();
tfw1.setString(MOCK_REGISTER_DATA[0]);
create_TextFiledWrapper2();
tfw2.setString(MOCK_REGISTER_DATA[1]);
create_TextFiledWrapper3();
tfw3.setString(MOCK_REGISTER_DATA[0]);
create_TextFiledWrapper4();
tfw4.setString(MOCK_REGISTER_DATA[0]);
create_TextFiledWrapper5();
tfw5.setString(MOCK_REGISTER_DATA[0]);
fire_CMD_SUBMIT();
create_AlertWrapper();
assertEquals(ResBundle.getI18NMessage(AppLang.MESSAGE_INVALID_EMAIL),
alert.getString());
}
In this test case each and every time i have to make one textfiled in the
register form.Now i dont want to be that for writing of unit tests in
fasterway..
Now i want to write like baby code...
Want to make methods that has to do like .down .up .left .right like
roboitum framework for android....
can JInjector support in that way?
regards,
a.t.obulreddy
Tejasoft
Original issue reported on code.google.com by [email protected]
on 12 Nov 2010 at 7:54
What steps will reproduce the problem?
1. Instrument TimeMIDlet app with attached jinjector properties file
2. Run resulting jar
3. Run genhtml on resulting .lcov1 file (attached)
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 25 Mar 2009 at 11:35
Attachments:
Currently when a J2ME application has been instrumented for code coverage
with JInjector, an unhandled exception is reported when running the
instrumented code on a device (e.g. the N95) or in both the S40 (6th
Edition) and S60 (3rd Edition Feature Pack 1) emulators.
We suspect the exception is related to getResourceAsStream() call which is
used to load the code coverage data file.
We are investigating the cause and hope to publish an update this week.
Julian.
Original issue reported on code.google.com by julianharty
on 9 Mar 2009 at 3:58
Purpose of code changes on this branch:
Make a parameter configurable for BlackBerry JInjector usage. BlackBerry
applications always have classes that extend UiApplication as the "main"
class of the program. Additionally, it is possible to exit an application
through other means than just shutting down the event thread (System.exit,
throw an uncaught exception on the event thread, etc...) and so we need to
be able to tell JInjector when to log the coverage information.
Previously, the location was hard coded. Now, the class can be specified.
The contract for the class is that it must have a void run() method.
Implementing Runnable makes sense but is not necessary. When the run()
method *begins* executing, the coverage information will be logged, thus
something like an EndOfTestListener/Runnable would be the ideal target
here.
When reviewing my code changes, please focus on:
After the review, I'll merge this branch into:
/trunk
Original issue reported on code.google.com by [email protected]
on 17 May 2010 at 4:44
What steps will reproduce the problem?
1. Implement a MIDlet which invokes notifyDestroyed() to close itself.
2. Instrument it for code coverage.
3. Collect the coverage.
Coverage information will not be covered because the instrumented
destroyApp() method will not be executed.
This bug can be fixed by adding the code coverage calls before any
invocation of MIDlet.notifyDestroyed().
Original issue reported on code.google.com by michele.sama
on 11 Mar 2009 at 9:43
What steps will reproduce the problem?
1. In jinjector.[myproject].properties, set coverageInclusionList to the
package name i.e. "+com/mymidlet"
2. Instrument the code
3. Run the resulting .jar
What is the expected output? What do you see instead?
I would expect this to behave the same as if a '/' were appended to the
package path. Instead, I get an ArrayIndexOutOfBoundsException when I run.
NOTE: I haven't reproduced this in TimeMIDlet. If you are unable to repro
it, I'll try to spend some time finding a non-proprietary repro scenario.
Let me know.
Original issue reported on code.google.com by [email protected]
on 25 Mar 2009 at 10:48
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.