Skip to main content

Starting JTHarness with ME framework

36 replies [Last post]
arturoguedez
Offline
Joined: 2007-04-17
Points: 0

Hi,

I am trying to start the JTHarness tool using the ME plugin (https://cqme.dev.java.net/) but I am not having any luck. I have gone over the whitepapers, and every document I could find online and they are all very descriptive, but none tell me how to start the harness with J2ME framework.

I know there has to be something specific in the way JTHarness has to be started to tell it to be specific to J2ME because I found this picture http://weblogs.java.net/blog/alexeyp/archive/Export.png, and it shows how the configuration editor has J2ME specific properties.

We are currently starting the harness with "java -jar javatest.jar" and it starts fine, and we can run simple tests, but when we try to test a class that creates a midlet we get a UnsatisfiedLinkException:

Exception in thread "main" java.lang.UnsatisfiedLinkError: getProperty0
at com.sun.midp.main.Configuration.getProperty0(Native Method)
at com.sun.midp.main.Configuration.getProperty(Configuration.java:33)
at com.sun.midp.midlet.Scheduler.getScheduler(Scheduler.java:142)
at com.sun.midp.midlet.MIDletState.(MIDletState.java:293)
at javax.microedition.midlet.MIDletProxy.(MIDletProxy.java:33)
at javax.microedition.midlet.MIDlet.(MIDlet.java:70)
at samples.SampleTestMidlet.(SampleTestMidlet.java:11)
at samples.FitstTest.run(FitstTest.java:42)
at samples.FitstTest.main(FitstTest.java:34)

and so we assume there has to be something about the runtime - which should be specific to J2ME.

Any help is much appreciated.

Regards,

Arturo

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
allenwqf
Offline
Joined: 2007-08-02
Points: 0

Hi Roma,
all the above is test the compatibility of our soft?
if No,how to test the compatibility about the soft?

thanks,
allen

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Dear Roma,
about the CDC/FP test,
"""set TS_HOME=enter testsuite home
%CDC_TOOLKIT_HOME%/emulator.exe ^
-classpath %TS_HOME%/lib/main_agent.jar ^
com.sun.tck.j2me.agent.AgentMain ^
-activeHost %JAVATEST_HOST% -activePort %AGENT_PORT% -trace"""

the second step how to set .
and -classpath how to set.
I can set -classpath sucessful.
and i set the TS_HOME is this:
F:\cqme_trunk\samples\meframework\SampleTestSuite.
is it right?

can you give me a clear guidance?
are the set under the DOS?
Can they set from the entironment variable in my computer?
allen.

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

Please use above guide "how to run latest jtHarness&cqMe for CDC/FP" to run tests. Test classes will be loaded automatically by AgentMain. You do not need put them to classpath of the emulator.

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Roma,
thank you very much.
It's so early you go to work. It's very thank you.

allenwqf
Offline
Joined: 2007-08-02
Points: 0

The fifths:
"sample/pkg3/index.html#Test3 sample/pkg1/Test1.class mobile/phone/soft/MyTestedClass.class"
what isthe "MyTestedClass.class"?
and whether the "mobile/phone/soft"is the directory of your soft?
thanks,
allen.

r_zelov
Offline
Joined: 2007-08-07
Points: 0

MyTestedClass.class is the example of class file that you will test. Please indicate your tested classes instead of MyTestedClass.class.

mobile/phone/soft is example of package where is located MyTestedClass. Please indicate your tested package.

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Dear Roma,
Can you give me a picture about intercept the test result which test any soft?

How to create the pkg? Need to write code?

My English is so poor.
And the fifth step,I don't understand how to let the test run on the emluator.Is that put the test on the emluator or put the *.jar file on the emluator? Can we use the jtHarness?if not how to test them ?
(I use emluator of NOKIA.)

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

Please use the following link to get information how to create own java package :

http://java.sun.com/docs/books/tutorial/index.html

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

for example ,now I have a mobile phone soft ,and i want to test it whether accord with the JSR and so on.
can you guide me?

r_zelov
Offline
Joined: 2007-08-07
Points: 0

OK. I will try to explain how to do it with SampleTestSuite.

1. You need modify build. Mobile phone soft (.class or .jar files) should be available for compilation of tests on PC side.

e.g. your mobile phone soft is located in mobile_phone_soft.jar file.

We need add path to mobile_phone.jar to compile and preverifier commands. Let's modify target "init" in SampleTestSuite/build/build.xml.

srcdir="${basedir}/tests"
destdir="${nonpreverified.classes.dir}"
bootclasspath="${midp.agent.jar}:${CLDC_CLASSES}:${MIDP_SPEC_CLASSES};c:\mobile_phone_soft.jar"
includeJavaRuntime="no"
includeAntRuntime="no"
debug="yes"
target="1.1"
source="1.2"
/>

and

...

...

2. Develop tests that will check your mobile phone soft and then build them using SampleTestSuite build.

Let's call it sample.pkg3.Test3. It will be located in SampleTestSuite/tests/sample/pkg3 directory. Also it's necessary index.html that contains description of tests. It should be located in SampleTestSuite/tests/sample/pkg3 directory.

4. Modify SampleTestSuite/build/testclasses.lst

Each test has unique identifier TestURL e.g. sample/pkg1/index.html#Test1

testclasses.lst contains information what classes are necessary for each test in test suite. You need enter necessary classes for your tests. e.g.

sample/pkg3/index.html#Test3 sample/pkg3/Test3.class

5. Now you can run tests on your mobile phone or emulator.

If mobile phone soft is not installed on mobile phone or emulator you can deliver it using jtHarness&cqME.

To do it please modify testclasses.lst. For each test please enter classes that are tested. e.g.

sample/pkg3/index.html#Test3 sample/pkg1/Test1.class mobile/phone/soft/MyTestedClass.class

Then you need modify SampleTestSuite/testsuite.jtt. Please add new entry "testclasspath".

...
testsuite=sample.suite.SampleTestSuite
testclasspath=c:\mobile_phone_soft.jar

Now all necessary classes will be remotely loaded from mobile_phone_soft.jar to tested device or emulator.

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Dear Roma,
is there has something wrong :.
I follow this,but can't build sucessful. I build it in the DOS like this: ant - .and show this there has a wrong: F:\cqme_trunk\samples\meframework\SampleTestSuite\build\build.xml:
must be followed by either attribute specifications, ">" or "/>".
when I put " " " back "/",they can build successed.
But there has no pkg3,only pkg1and pkg 2.

OH.I think I know how to test it .
But,if my soft is not a jar files,it's only other files and there has many file not one file.
How should I do?

Have a nice weekend.

Thanks .
allen

r_zelov
Offline
Joined: 2007-08-07
Points: 0

>>Dear Roma,
>>is there has something wrong :>path="${midp.agent.jar}:${CLDC_CLASSES}:${MIDP_SPEC_CLASSES}:${PREVERIFIER_EXTRA_PATH}";c:\mobile_phone_soft.jar/>.
>>I follow this,but can't build sucessful. I build it in the DOS like this: ant - .and show >>this there has a wrong: >>F:\cqme_trunk\samples\meframework\SampleTestSuite\build\build.xml:
>>must be followed by either attribute specifications, ">" or "/>".
>>when I put " " " back "/",they can build successed.

It was my error. Thanks for correction.

>>But there has no pkg3,only pkg1and pkg 2.

Alen, pkg3 is the example of new test package that you should create manually. Please
see for details second step in above guide.

>>OH.I think I know how to test it .
>>But,if my soft is not a jar files,it's only other files and there has many file not one file.
>>How should I do?

You can indicate path to your classes instead of path to jar files.

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Dear Roma,
The pkg file include two files: index.html and test.java.
You tell me the pkg file should create manually .Is this mean that I should write some code for the test.java? Is there has any example of the pkg which I need?

thanks,
allen

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Dear Roma,
I think I don't understand what's testsuite at all the time.

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

Test suite is set of tests. On hard drive it's directory with the following structure

[i]SampleTestSuite[/i]/ - root of test suite
[i]/lib[/i]
[i]/classes[/i]
[i]/tests[/i]
[i]testsuite.jtt[/i]

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Rom,
I hava another trouble .
After I check the "Listening",and startup again the jt,there has this Error:
Error when starting active agent pool.
java.net.BindException: Address already in use: JVM_Bind.
What's about it ?
is that can't open the main_agent.jar reflect on this?

Message was edited by: allenwqf

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

JVM_Bind error happens when 2 or more jtHarness were started with one port or some application locked port that is listened by jtHarness. Please check that port = value from Agent Pool Window->Port field is not locked.

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Hi Roma,
Thank you for your help.
I follow you is OK.
But I can't find TS_HOME.So not to set the value of it.

Now I have a JVM and I want to test it .How should i do?
Should I build it to as a testsuit?
How the jt identify it ?

Thanks,
allen

Message was edited by: allenwqf

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

TS_HOME is e.g. root directory of SampleTestSuite.

JVM testing is really complex task. Could you please explain what do you want to test in JVM?

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Hi Roma,
I want to test the function of the JVM.I want to know the JVM include how many class and the class is what.

and except the e.g.--testsuite,can you give me another sample?

Because our hardware has a new JVM.We need other people to empolder some programme ,we put the programme on our hardware .So we need supply the JSR of the JVM to them. So I want to know which class on the JVM.

I also have another more question to ask you .
for example ,How to contact between the test object and the JTHarness.

May I became you friend on the MSN,my MSN is: allenwqf@hotmail.com

thanks ,
allen.

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

If I understand correctly you developed own implementation of some JSR and want to port it to new platform. If it's true you are member of JCP and have access to special tool that checks signatures - SignatureTest. Please contact JCP to get this tool. SignatureTest is not available through open source.

If I understand correctly another question is how jtHarness&cqME communicates with tests. jtHarness&cqME has client-server architecture. Server works on PC side and it's responsible for test run and result management e.g. though main jtHarness window you
can select tests for running and then analyze test's result.

Client is special small program aka agent (e.g. AgentMain) works on tested devices. Agent can communicate with server part - receive information what tests should be ran, run tests and return results. Different protocols are used for communication between agent and server e.g. TCP/IP, UDP, etc. You can implement own special communication protocol if it's necessary.

For more detailed information please see documentation. Links to documentation I sent in previous topics. Latest documentation will be available soon.

Another examples of test suites are available through svn :

https://cqme.dev.java.net/source/browse/cqme/trunk/code/samples/

But if you are JCP member you probably have TCK for JSR that you want to implement. TCK is best example of using jtHarness&cqME because TCKs use the same framework for certification.

Allen about MSN let's discuss all questions here ;) because other developers might have the same questions and it will be great if this forum will contain all answers.

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Roma,
thank you for your help.
Is all the software which we test should build to testsuite?
How to build it?
I think that we don't use the simpletestsuite and we use other software,for example we use a commonly Java soft JVS ,How can i build it ? Does the JVS could be test? If can't ,we choose other, can you lead me the way?
thank you.

Is there have another way to test test the JVM? except to become the member of JCP. Oh dear , to became the JCP member is so difficulty.

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

I have question to you in order to more clearly understand your problem and help you to resolve it. Do you want to develop your own tests for your software or you need ready to use test's suite that will test your software?

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Hi ,Roma,

I do a test,and there have a Error .the error is this:
No agents available for use: AgentPool not listening.

what about this?
How should I do?

and the test need to write by myself?
Thank you.
allen

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

Agent Pool listing is necessary only for CDC/FP based implementation with TCP/IP support.

To start Agent Pool listing you need to use jtHarness menu (Windows->Open->Agent Monitor) and then check "Listening". Then you need to start com.sun.javatest.agent.AgentMain on device side from lib/main_agent.jar with appropriate parameters (jtHarnessHost, jtHarnessPort, etc.). If AgentMain starts successfully it will be shown in jtHarness Agent Pool window. Then you need to start test run from jtHarness window (Run Tests->Start).

Are you developing tests for CDC/FP based implementation or for CLDC/MIDP?

If for MIDP before starting test run you need open jtHarness configuration interview (Configure->Change Configuration->Other Values) and then select "MIDP" answer in "Implementation Base" question. Then you need to start test run from jtHarness window (Run Tests->Start) and then download and run bundle with test on tested device. Default URL for bundle with tests is http://localhost:8080/test/getNextApp.jad. Host name and port from URL can be configured via jtHarness configuration interview ("JavaTest Harness Host" and "Test Server Port" questions).

I understand that above information is a little bit confusing. But we are working on documentation now. It will be available soon ;)

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Hi Roma,
It's very thank you.I think I should call you teacher because you are so strong in java test.

I follow you what you tell me.But the main_agent.jar can't open successfully. There has a warning about that the Main-class load fail.What should i do .
I am so poor about the java.
Then I do the developing for the CDC/FP. You only tell me the way to do CLDC/MIDP,and I want to know how to do it for CDC/FP.
can you tell me .

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Please note Agent Pool listing is necessary only for 1.1.2 cqME Framework.

I will try to explain how to run latest jtHarness&cqMe for CDC/FP.

1. Start jtHarness

java -jar lib/javatest.jar

2. Open SampleTestSuite (File->Open Test Suite ...)

3. Go to the Configure->New Configuration

4. Enter "Configuration name" and "Description" values

5. Select "CDC" in "Implementation Base" question

6. Check that answer for "Communication Type" question is "Socket based connection"

7. Enter some value in "Sample Config Property" question e.g. bla-bla-bla

8. Click "Done"

9. Start AgentMain.

I use Sun's CDC Toolkit 1.0 and the following command

rem value from "JavaTest Harness Host" jtHarness configuration interview question
set JAVATEST_HOST=localhost

rem value from "Communication Server Port" jtHarness configuration interview question
set AGENT_PORT=8188

set TS_HOME=enter testsuite home

%CDC_TOOLKIT_HOME%/emulator.exe ^
-classpath %TS_HOME%/lib/main_agent.jar ^
com.sun.tck.j2me.agent.AgentMain ^
-activeHost %JAVATEST_HOST% -activePort %AGENT_PORT% -trace

10. Click "Run Tests"->"Start" in jtHarness window

10. Results :

sample/pkg1/index.html#Test1 - passed
sample/pkg2/index.html#Test2 - failed

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

more error about this:
Cannot restore tool "0" from saved desktop file: Problem while starting Test Manager.
Cannot create interview for test suite F:\cqme_trunk\samples\meframework\SampleTestSuite-build\SampleTestSuite.
com.sun.javatest.TestSuite$Fault: Error initializing the interview: Cannot find help data: sample/suite/help/j2metck.

what about it?

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Hello Allen,

Do you use the following bundle? :

http://download.java.net/mobileembedded/cqme/meframework/PreRel/me_frame...

If yes, this bundle has bug. Fix is available in latest version of cqME. Please checkout it from svn repository and build manually.

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Hello Roma'
It's very thank you ,I follow you what you told me.and It's OK.
Thank you very much.
Do you have any test guide about the JTHarness with ME framework?
can you give me on copy?
Thanks,
allen

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Allen,

Yes, sure.

cqME framework docs :
http://java.sun.com/javame/reference/apis.jsp#meframework

jtHarness docs :
https://jtharness.dev.java.net/jt_docs.html

Thanks,
Roma

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Roma,
It's very thank you .
I find the guide.
thank you.
allen.

m_gorshenev
Offline
Joined: 2006-10-12
Points: 0

Hello Arturo,

welcome to the forum!

In order to run MIDP-based tests you need to make sure to install
both JT Harness and ME Framework and to create a Java ME test suite.

Check out the Java ME test samples in the cqme subversion repository:
https://cqme.dev.java.net/source/browse/cqme/trunk/samples/meframework/

There are two sample test suites. You should be able to use them as a starting point.
There is a small readme file in each test suite which explains how to set them up.

One potential problem you may encounter is that of MIDlet creation.
In your stack trace output I see that MIDlet constructor is called from the test code.
MIDP spec prohibits creation of MIDlets by anything but the AMS.
ME Framework executes Java ME code via the test agent MIDlet.
You cannot currently create and test additional MIDlets.

thank you,
Mikhail Gorshenev

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Dear friend :
I have a graveness programe, I can't use the cqme and jtharness.
oh ,I want to make a test,but I don't know how to make the cqME insert to my JTHarness. Can you give me a answer? please tell me How to do it .if you have a picture about it ,can you send it to me?
if you want to answer me ,please send it to my email.
my email is :allenwqf@hotmail.com
thank you ;
good luck for you .
allen
2007.8.7

r_zelov
Offline
Joined: 2007-08-07
Points: 0

Hello Allen,

The following file contains instructions how to integrate cqME framework with jtHarness
for SampleTestSuite :

https://cqme.dev.java.net/source/browse/cqme/trunk/samples/meframework/S...

Thanks,
Roma Zelov

allenwqf
Offline
Joined: 2007-08-02
Points: 0

Hello Roma,
Thank you very much.It's very happy that I follow that what did you tell me.and It's build succed.But I have another question.
when I open the testsuite there will have a error .The error is :Cannot open test suite: Error initializing the interview: Cannot find help data: sample/suite/help/j2metck.
what about this? is there I have no the tool about j2metck? or other?
if I have no j2metck ,please tell me how can i get it .
Could you tell me the solve way?
thank you .
You also can give me a email.my email is :allenwqf@hotmail.com
allen
2007.8.8