Skip to main content

asm.jar - which version?

30 replies [Last post]
bernhasc
Offline
Joined: 2008-11-11

In attempts to switch my testsuite.jtt file from using the Std class finder to using the JUnit Annotation Class finder, I'm getting a class not found exception for ClassFinder (whose .class file I found in asm.jar). I've downloaded the asm-3.0.jar as well as asm-2.2.2.jar and (1 at a time) stored them as asm.jar in the same directory as javatest.jar (${cwd}/lib/asm.jar). I converted my working testsuite.jtt file to use junit per the instructions in the junit.html file included in the distro.zip. The error occurs when I select the test suite.

I tried using java -jar lib/javatest.jar as well as java -cp $(pwd)/lib/asm.jar -jar lib/javatest.jar and get the same error. I've also tried (with and without) including lib/asm.jar in the classpath entry in the testsuite.jtt file. I tried both prepending and appending the classpath w/ asm.jar as well with no luck. Is this an asm.jar versioning issue, or a PEBKAC error on my part?

Many thanks.

Message was edited by: bernhasc

null

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bernhasc
Offline
Joined: 2008-11-11

Bah. closer, me thinks.... Ok. I Created my own test Finder class (derived from JUnitAnnotationTestFinder) overriding the protected method scanFile(File file). I added the line:
[i]tdValues.put("executeClass", "com.sun.javatest.junit.JUnitTestRunner");[/i]
after the "keywords" entry. Test failed, but no exception dump, or any other kind of output to console or JTH GUI (Test Run Messages tab, all entries were [i](empty)[/i]).

I did see the new executeClass tag under the Test Description tab.

Message was edited by: bernhasc

bkurotsu
Offline
Joined: 2004-12-13

Oh, no, it's not supposed to be com.sun.javatest.junit.JUnitTestRunner. It's supposed to be the class of the test to run.

Hum, it's not easy to reuse the code the way it is. Three choices -
1) You can cut and paste the superclass code in JUnitAnnotationTestFinder into your impl of scanFile(). And get the ClassReader to give you the classname to put into the executeClass field.
2) You can modify JUnitAnnotationTestFinder, rebuild the harness and then offer the code back to us as a contribution.
3) I can make the change and you can rebuild the harness. But it will take a day to do the code review.

I think it would be great if you could at least do #1, which is probably easiest for you if you aren't already building the harness.

And if that works, it sounds like we need to file a defect. Not sure why my test config works though - I'd have to go investigate that.

Let me know how it goes, thanks!

Brian

bernhasc
Offline
Joined: 2008-11-11

What's the best way to get the [new|modified] code back to you? (tarball as an e-mail?) I have a few additional classes, some mods (minor and otherwise) and other odds and ends.

Also, I'm still working on trying to capture the JUnit failure notifications so they can be reported in the GUI instead of simply a pass/fail.

Many thanks for all the help you all gave me to get this thing working. /Salute.
Cool tool.

bkurotsu
Offline
Joined: 2004-12-13

Followup to my suggested course of action - the critical piece that might be missing is the code contained in JUnitTestRunner which generates the test args and multitest class for actual execution.

The main() entry point can work, but you need to add the javaTestExecuteClass property into the environment.

bernhasc
Offline
Joined: 2008-11-11

Ok. if I set the tests= directory to test (the dir containing the .java files), I get a laundry list of :
java -cp $CP com.sun.javatest.tool.Main
classFile does not exist: /home/bernhasc/Work/CxLCS/DocumentEditor_junit/test/documenteditor/DocumentEditorAboutBoxTest.class
classFile does not exist: /home/bernhasc/Work/CxLCS/DocumentEditor_junit/test/documenteditor/DocumentEditorAboutBoxTestJTH.class
classFile does not exist: /home/bernhasc/Work/CxLCS/DocumentEditor_junit/test/documenteditor/DocumentEditorAppTest.class
classFile does not exist: /home/bernhasc/Work/CxLCS/DocumentEditor_junit/test/documenteditor/DocumentEditorAppTestJTH.class

Those classes were compiled to build/test/classes. If I set tests=build/test/classes, I get no error, but I also dont get any test cases.

Moving the compiled class files into test/documenteditor directory, tests show up, but I get the following error when trying to run one of them :
% java -cp $CP com.sun.javatest.tool.Main
Exception in thread "Harness:Worker" java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.sun.javatest.junit.JUnitAnnotationMultiTest.setup(JUnitAnnotationMultiTest.java:85)
at com.sun.javatest.junit.JUnitAnnotationMultiTest.run(JUnitAnnotationMultiTest.java:49)
at com.sun.javatest.junit.JUnitTestRunner.runTests(JUnitTestRunner.java:63)
at com.sun.javatest.Harness.runTests(Harness.java:712)
at com.sun.javatest.Harness.access$000(Harness.java:44)
at com.sun.javatest.Harness$1.run(Harness.java:566)

Jonathan Gibbons

I'd be curious to know if asm.jar has a Class-Path entry into its
manifest file. If it does, it *may* be sufficient just to put the asm-
commons-3.1.jar in the right place (probably in the same lib/
directory.) If it *does* have the Class-Path entry, but it is not
picked up automatically when it is in the right place, that would be a
bug against JDK ClassLoader, IMO.

-- Jon

On Nov 17, 2008, at 10:28 AM, jtharness@mobileandembedded.org wrote:

> Jon may get a gold star for good guesses.
>
> Some notes of mine show that lib/asm-commons-3.1.jar is also
> required on the classpath.
>
> Brian
> [Message sent by forum member 'bkurotsu' (bkurotsu)]
>
> http://forums.java.net/jive/thread.jspa?messageID=317101
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jtharness.dev.java.net
> For additional commands, e-mail: interest-help@jtharness.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jtharness.dev.java.net
For additional commands, e-mail: interest-help@jtharness.dev.java.net

Brian Kurotsuchi

It does not have it.

BTW - if you reply to the mailing list, your messages are not being recorded in
the forum. For better or worse...

Brian

Jonathan Gibbons wrote:
> I'd be curious to know if asm.jar has a Class-Path entry into its
> manifest file. If it does, it *may* be sufficient just to put the
> asm-commons-3.1.jar in the right place (probably in the same lib/
> directory.) If it *does* have the Class-Path entry, but it is not
> picked up automatically when it is in the right place, that would be a
> bug against JDK ClassLoader, IMO.
>
> -- Jon
>
>
> On Nov 17, 2008, at 10:28 AM, jtharness@mobileandembedded.org wrote:
>
>> Jon may get a gold star for good guesses.
>>
>> Some notes of mine show that lib/asm-commons-3.1.jar is also required
>> on the classpath.
>>
>> Brian
>> [Message sent by forum member 'bkurotsu' (bkurotsu)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=317101
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jtharness.dev.java.net
For additional commands, e-mail: interest-help@jtharness.dev.java.net

Jonathan Gibbons

Does asm.jar require any additional jar files? Sometimes a class will
fail to load because although it can be found, something it depends on
cannot be found.

-- Jon

On Nov 17, 2008, at 9:36 AM, jtharness@mobileandembedded.org wrote:

> Thanks, Brian. I think I'm loosin it over here. Hmm. on 2nd
> thought... maybe I already have? ;)
>
> I gave the command a whirl and got the same error. Just in case
> something left over was honkin' things up, I tried adding -
> newdesktop. I tried both commands (w/ and w/o -newdesktop) w/
> asm-3.0.jar and asm-2.2.2.jar (copied to lib/asm.jar).
>
>
> ----------------
> java -cp $CP com.sun.javatest.tool.Main -newdesktop
> Exception in thread "AWT-EventQueue-0"
> java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
> 124)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> [Message sent by forum member 'bernhasc' (bernhasc)]
>
> http://forums.java.net/jive/thread.jspa?messageID=317082
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jtharness.dev.java.net
> For additional commands, e-mail: interest-help@jtharness.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jtharness.dev.java.net
For additional commands, e-mail: interest-help@jtharness.dev.java.net

bernhasc
Offline
Joined: 2008-11-11

I got passed the asm*jar issue.
There was a copy of javatest.jar (and jh.jar, jt-junit.jar) located in
/usr/java/jdk1.6.0.10/jre/lib/ext directory, but asm*jar was not. When I ran w/ the verbose class loader option, I noticed all the javatest class files were being loaded from jre/lib/ext directory, not ./lib. and no asm*.jar classes were being created. I removed the JTH related jar files from jre/lib/ext and ran it again. It picked up the javatest classes from ./lib as well as jt-junit and classes w/in asm*-3.1.jar. I'm thinkin b/c jt-junit was located in the jre directory and asm was not, it wasn't going to load asm.jar (I copied asm*jar into jre/lib/ext and ran it and it worked, then removed them all and it worked again (except picking up from ./lib instead of jre/lib/ext)).

Just in case it got lost, I'll repost the [new] exception I'm getting.

% java -cp $CP com.sun.javatest.tool.Main
Exception in thread "Harness:Worker" java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.sun.javatest.junit.JUnitAnnotationMultiTest.setup(JUnitAnnotationMultiTest.java:85)
at com.sun.javatest.junit.JUnitAnnotationMultiTest.run(JUnitAnnotationMultiTest.java:49)
at com.sun.javatest.junit.JUnitTestRunner.runTests(JUnitTestRunner.java:63)
at com.sun.javatest.Harness.runTests(Harness.java:712)
at com.sun.javatest.Harness.access$000(Harness.java:44)
at com.sun.javatest.Harness$1.run(Harness.java:566)

I get the same exception if I try to run the test after starting up the JTH GUI w/ java -jar lib/javatest.jar

bkurotsu
Offline
Joined: 2004-12-13

Whew, almost there.

I assume you looked that that line of code. It's trying to load the test class specified in the test description, which came from the finder.

How does the test description data look when you browse it in the GUI?

Oh! I see the problem. It is executing using the main() entry point. Quoting the javadoc there:
* Entry point for direct exection, not used by the harness.
:)

Do you have a JTR file yet in the workdir that you can paste here? Also, let's see some troubleshooting values from View|Properties. What is the TestSuite class and TestRunner class (if you have your own, what are their superclasses)?

Root cause of the exception is that the wrong entry point is being used and the environment values needed (name of class to execute) is missing. The supplied library code normally does this for you, but we're missing a piece somewhere here.

Brian

bernhasc
Offline
Joined: 2008-11-11

I'm trying to use all canned stuff. I do NOT have a JTR file anywhere (that I can see). just a JTT and JTI, and JTL file.

testsuite.jtt :
# The presentation name of the test suite
name=Test Project 1.0 Test Suite (JUnit Tests)
id=JUnit_1.0
# tests=test
tests=build/test/classes

# The test finder to use
# finder=com.sun.javatest.finder.TagTestFinder
# Note: Added -scanClasses per JTH forum answer
finder=com.sun.javatest.junit.JUnitAnnotationTestFinder -scanClasses

# testsuite=com.sun.javatest.TestSuite
testsuite=com.sun.javatest.junit.JUnitTestSuite

# The test script to use
# script=com.sun.javatest.lib.StdTestScript

# The jar file containing the test suite's JavaTest plug in classes
# classpath=lib/javatest.jar lib/asm-3.1.jar lib/asm-commons-3.1.jar lib/jt-junit.jar lib/junit.jar lib/jh.jar

classpath=lib/javatest.jar lib/asm-3.1.jar lib/asm-commons-3.1.jar lib/jt-junit.jar lib/junit.jar lib/jh.jar build/test/classes build/classes test

# The configuration interview to use
# Note to self: Try the LCSInterviewParameters for the JUnit Test once it honks out on those classes
# interview=com.sun.javatest.interview.LCSInterviewParameters
interview=com.sun.javatest.junit.JUnitBaseInterview

# No keywords
# keywords=
-----------------------------------------

(bernhasc)tyr(~/Work/CxLCS/DocumentEditor_junit) find junit_harness -type f -print
junit_harness/jtData/ResultCache2.jtw
junit_harness/jtData/testsuite
junit_harness/jtData/configHistory.jtl
junit_harness/jtData/log.txt
junit_harness/jtData/harness.trace
junit_harness/jtData/lastRun.txt
junit_harness/logfile.log

(bernhasc)tyr(~/Work/CxLCS/DocumentEditor_junit) ant clean >/dev/null 2>&1 ; ls -CF1
build.xml
coverage/
glean/
junit_harness/
junit_testsuite.jti
lib/
manifest.mf
nbproject/
setup.zsh
src/
test/
testsuite.jtt
-------------------------------------
View|Properties dialog box displays the following intel:

Test Suite:
Path: /home/bernhasc/Work/CxLCS/DocumentEditor_junit
Name: Test Project 1.0 Test Suite (JUnit Tests)
ID: JUnit_1.0

Work Directory:
Path: /home/bernhasc/Work/CxLCS/DocumentEditor_junit/junit_harness

Configuration:
Path: /home/bernhasc/Work/CxLCS/DocumentEditor_junit/junit_testsuite.jti
Name: junitenv
Description: (Unset)
State: Completed
Template: (Unset)

Plug-Ins:
Test Suite: com.sun.javatest.junit.JUnitTestSuite
Test Finder: com.sun.javatest.junit.JUnitAnnotationTestFinder
Test Runner: com.sun.javatest.junit.JUnitTestRunner
Interview: com.sun.javatest.junit.JUnitBaseInterview

bkurotsu
Offline
Joined: 2004-12-13

Can you click on one of the tests and tell us what the Test Description lists? Does it have a executeClass property? I have something else due right now, so can't investigate too deeply right now.

Root cause is still that executeClass is missing from the test description. Not sure why my implementation works correctly - in the end though, the test's TestDescription does not contain the executeClass property. You could try to arrange this in a test finder:
tdValues.put("executeClass", "...");
if you have time to investigate right now.

I'll poke around ASAP to find out why my configuration is different.

Brian

bernhasc
Offline
Joined: 2008-11-11

Ok. clicking on a test case, then "Test Description" shows the following:
junit.finderscantype: annotation
junit.testmethods: testCloseAboutBox
keywords: junit junit4
source: /home/bernhasc/Work/CxLCS/DocumentEditor_junit/build/test/classes/documenteditor/DocumentEditorAboutBoxTest.class
----------------------------------

-------------------- DocumentEditorAboutBoxTest.java --------------------

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package documenteditor;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import java.awt.Frame;
import org.jdesktop.application.ApplicationActionMap;
/**
*
* @author lcs
*/
/* @Test
* @executeClass DocumentEditorAboutBoxTest
* @sources DocumentEditorAboutBoxTest.java
* @keywords About Dialog junit4
*/
public class DocumentEditorAboutBoxTest {
private DocumentEditorAboutBox instance = null;

public DocumentEditorAboutBoxTest() {
}

@BeforeClass
public static void setUpClass() throws Exception {
}

@AfterClass
public static void tearDownClass() throws Exception {
}

@Before
public void setUp() {
}

@After
public void tearDown() {
instance = null;
}

/**
* Test of closeAboutBox method, of class DocumentEditorAboutBox.
*/
@Test
public void testCloseAboutBox() {
System.out.println("closeAboutBox");
Frame frame = new Frame("About Box Test");
instance = new DocumentEditorAboutBox(frame);
// instance.setVisible(true);
// instance = null;
instance.closeAboutBox();
System.out.println("closeAboutBox invoked.");
}
}
-----------------------------

I'll try that tdValues.put() call.

bkurotsu
Offline
Joined: 2004-12-13

So, in this example, your executeClass should be documenteditor.DocumentEditorAboutBoxTest

bernhasc
Offline
Joined: 2008-11-11

that's what I thought It should have been set to (and was, in fact, the 1st thing I set it to, except hard coded) :
tdValues.put("executeClass", "documenteditor.DocumentEditorAboutBoxTest");
I figured it'd be easier to hard code the class name, then, if it worked, figure out how to dynamically obtain the qualified class name. That was the only line I changed or added from the original scanFile method.

Edit (bernhasc) - removed e-mail request

bernhasc
Offline
Joined: 2008-11-11

Ok. got that working....was back to the display issue thing, except the exception dump wasn't getting dumped anywhere :
[i]fail("Exception creating AboutBox: " + e);[/i]

Got swallowed up and sent to the bit-bucket. I replaced the Interview file w/ the LCSInterviewParameters class I created before, reconfigured and re-ran and it worked! Woot! Of course, ALL test cases ran the same bloody test, but I expected that having hard coded the Finder to use the DocEd AboutBox Test class as the executeClass. I'll patch and post the code.

Although, a bug prolly should be posted that all JUnit's fails and failed asserts text is sent to the bit-bucket. Not sure if that was intended, or not. The only thing I get back is a Failed Test case w/ no text as to what happened.

bernhasc
Offline
Joined: 2008-11-11

code/src/com/sun/javatest/junit/JUnitAnnotationTestFinder.java
213a214,215
> String tempClassName = cr.getClassName();
> tdValues.put("executeClass", tempClassName.replace('/', '.'));

Edit (bernhasc) - [chop]

bkurotsu
Offline
Joined: 2004-12-13

Jon may get a gold star for good guesses.

Some notes of mine show that lib/asm-commons-3.1.jar is also required on the classpath.

Brian

bernhasc
Offline
Joined: 2008-11-11

I downloaded the asm-all-3.1.jar file and dropped it in there and am getting the same error. I'll try various concoctions of -cp and .jtt:classpath entry alterations and see if I can come up w/ something.

I fetched asm-all-3.1 from :
http://ftp.cica.es/mirrors/maven2/asm/asm-all/3.1/

bkurotsu
Offline
Joined: 2004-12-13

Apparently this was the invocation that I was using:

java -cp javatest.jar:lib/asm-3.1.jar:lib/junit.jar:lib/asm-commons-3.1.jar:jt-junit3-demo/classses com.sun.javatest.tool.Main -ts jt-junit3-demo

bernhasc
Offline
Joined: 2008-11-11

still no go...

which classes belong in the JTT file and which belong in the answer block for the Interview Question? For the basic JUnitBaseInterview, I realize there is no Classpath question, so I'll have to write an interview Q for it, but I can do that once I get to the point where it's failing to find the testee and testor classes.

Nothing app specific should be in the classpath in the JTT file? Or only those classes required to run the harness (ie Interview, TestSuite, Test Script classes and the like)? Or should all classpath entries be specified in the JTT file?

Also, I'm using JUnit-4.5, if that matters.

Edit (bernhasc) - Added JUnit version

bkurotsu
Offline
Joined: 2004-12-13

Have you read the architect's guide? It's available in the docs section of the jtharness website.

The classpath in the jtt is only for code which is part of the JT plugin infrastructure. So things related to the finder, script class, etc.

The JUnit support was developed using JUnit 3.8.2 and 4.4. But the error you have doesn't seem related.

I still suspect classpath problems, for whatever reason. Generally for classpath needed for starting the TestSuite, TestFinder, Interview andTestRunner classes can be completely specified on the command line and should be reliable for debugging purposes, unless you specify an invalid classpath (the java command is silent about missing classpath items too). So, this should work for you:
java -cp lib/asm.jar:lib/asm-common.jar:lib/javatest.jar:lib/jt-junit.jar:$JUNIT_JAR:dist/DocumentEditor.jar:dist/lib/appframework-1.0.3.jar:dist/lib/swing-layout-1.0.3.jar:dist/lib/swing-worker-1.1.jar::build/classes:build/test/classes:
com.sun.javatest.tool.Main

Maybe you can start this way and check the verbose class loader output to make sure it is scanning all the jar files you expect.

Classpath entries in the testsuite.jtt file are relative to the location of the jtt file, your cwd does not matter for that setting.

This line is not valid in your file:
script=com.sun.javatest.junit.JUnitTestRunner

The TestRunner class is not a Script. This is probably not the cause of the problem though. The stack trace shows that it is trying to load the finder class.

As a side note, what Java runtime version are you using? If you want a completely flat playing field, try 1.5.

Brian

bernhasc
Offline
Joined: 2008-11-11

I've read the arch guide once thru, plus some sections a number of times.

1) The CP entries (dist/DocumentEditor.jar, dist/lib/appframework-1.0.3.jar, dist/lib/swing-layout-1.0.3.jar, dist/lib/swing-worker-1.1.jar, build/classes, build/test/classes) are all app specific. I'll remove those from CP entries.
2) commented the script= line.
3) jdk/jre version 1.6.0.10. I also have 1.5.0 installed

Edit (bernhasc) - Oh, how lovely. I think a coworker mangled some stuff up before giving up and passing this to me; I found a copy of javatest.jar, jt-junit.jar and jh.jar in /usr/java/latest/jre/lib/ext but no asm*jar. I bet the class loader wont load dependent classes outside the default area iff the originating class came from within.

I removed the jars from the default area and reran vanilla java -jar lib/javatest.jar and it loaded the testsuite ok, except it didn't find any JUnit tests.

Message was edited by: bernhasc

bkurotsu
Offline
Joined: 2004-12-13

I wonder if my documentation is slightly defective. Your finder line in testsuite.jtt should read:

finder = com.sun.javatest.junit.JUnitAnnotationTestFinder -scanClasses

Then you can point tests= at the directory that contains the class files (no .java files needed in there). I'm thinking that will resolve why it was confused about finding the class files vs not finding any tests to display.

Brian

bernhasc
Offline
Joined: 2008-11-11

That took care of the missing tests, but I still get the Exception tossed

bernhasc
Offline
Joined: 2008-11-11

Here's a partial dump from when I tried to Open TestSuite :
(bernhasc)tyr(~/Work/CxLCS/DocumentEditor_junit) cat setup.zsh
export CP=$(pwd)/lib/asm.jar:$(pwd)/lib/javatest.jar:$(pwd)/lib/jt-junit.jar:$JUNIT_JAR:$(pwd)/dist/DocumentEditor.jar:$(pwd)/dist/lib/appframework-1.0.3.jar:$(pwd)/dist/lib/swing-layout-1.0.3.jar:$(pwd)/dist/lib/swing-worker-1.1.jar::$(pwd)/build/classes:$(pwd)/build/test/classes:

(I get the same results if I start up JTH GUI w/ java -jar lib/javatest.jar)

(bernhasc)tyr(~/Work/CxLCS/DocumentEditor_junit) java -cp $CP -jar lib/javatest.jar
Exception occurred during event dispatching:
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at com.sun.javatest.TestSuite.loadClass(TestSuite.java:1089)
at com.sun.javatest.TestSuite.loadClass(TestSuite.java:1073)
at com.sun.javatest.TestSuite.createTestFinder(TestSuite.java:550)
...
[ chop - 119 lines ]

testsuite.jtt file looks like :
(bernhasc)tyr(~/Work/CxLCS/DocumentEditor_junit) cat testsuite.jtt
# The presentation name of the test suite
name=Test Project 1.0 Test Suite (JUnit Tests)
id=JUnit_1.0
tests=test

# The test finder to use
# finder=com.sun.javatest.finder.TagTestFinder
finder=com.sun.javatest.junit.JUnitAnnotationTestFinder

# testsuite=com.sun.javatest.TestSuite
testsuite=com.sun.javatest.junit.JUnitTestSuite

# The test script to use
# script=com.sun.javatest.lib.StdTestScript
script=com.sun.javatest.junit.JUnitTestRunner

# The jar file containing the test suite's JavaTest plug in classes
# Added lib/asm.jar to cp.
classpath=lib/asm.jar lib/jt-junit.jar lib/junit.jar dist/lib/appframework-1.0.3.jar dist/lib/swing-layout-1.0.3.jar dist/lib/swing-worker-1.1.jar build/test/classes build/classes

# The configuration interview to use
# interview=com.sun.javatest.interview.LCSInterviewParameters
interview=com.sun.javatest.junit.JUnitBaseInterview

# No keywords
# keywords=
---------------------------------------------------------
# finder=com.sun.javatest.finder.TagTestFinder
finder=com.sun.javatest.junit.JUnitAnnotationTestFinder

If I swap those 2 lines, It'll go thru the interview process creating a JTI file with :
#JT Harness Configuration Interview
#Mon Nov 17 09:23:55 EST 2008
CHECKSUM=59a6a4bcb2fac60e
INTERVIEW=com.sun.javatest.junit.JUnitBaseInterview
LOCALE=en_US
NAME=junitenv
QUESTION=junit.epilog
TESTSUITE=/home/bernhasc/Work/CxLCS/DocumentEditor_junit
WORKDIR=/home/bernhasc/Work/CxLCS/DocumentEditor_junit/junit_harness
junit.concurrency.concurrency=1
junit.excludeList.latestAutoCheck=No
junit.excludeList.latestAutoCheckInterval=7
junit.excludeList.latestAutoCheckMode=everyXDays
junit.excludeList.needExcludeList=No
junit.keywords.keywords.mode=expr
junit.keywords.needKeywords=No
junit.priorStatus.needStatus=Yes
junit.priorStatus.status=error failed not_run
junit.tests.needTests=No
junit.tests.tests=
junit.tests.treeOrFile=tree
junit.timeout.timeout=1
-----------------
But, the list of tests to run are the wrapped JT-Harness classes (eg ClassTestJTH.java), not their underlying JUnit test classes (eg ClassTest.java).
% find src test -type f -print | grep "About.*\.java$"
src/documenteditor/DocumentEditorAboutBox.java (src file to be tested... the "Class")
test/documenteditor/DocumentEditorAboutBoxTest.java (JUnit Test class testing the "Class")
test/documenteditor/DocumentEditorAboutBoxTestJTH.java (JT-Harness wrapper for ClassTest)

bkurotsu
Offline
Joined: 2004-12-13

Hi, could you please try this...

java -cp $CP com.sun.javatest.tool.Main

Where $CP has that long list of jars you had defined.

I don't believe the java binary support the use of -cp and -jar at the same time and -jar will override any classpath settings. Let us know if this works as expected in your preferred jtt configuration - we can debug based on that.

I'm a bit surprised that it didn't work with the settings you had in testsuite.jtt though.

Brian

bernhasc
Offline
Joined: 2008-11-11

Thanks, Brian. I think I'm loosin it over here. Hmm. on 2nd thought... maybe I already have? ;)

I gave the command a whirl and got the same error. Just in case something left over was honkin' things up, I tried adding -newdesktop. I tried both commands (w/ and w/o -newdesktop) w/ asm-3.0.jar and asm-2.2.2.jar (copied to lib/asm.jar).

----------------
java -cp $CP com.sun.javatest.tool.Main -newdesktop
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)

bkurotsu
Offline
Joined: 2004-12-13

I used the asm 3.1 binary for development. Errors in testsuite.jtt classpaths are silent - that is, missing items are not reported I think. We're sure that lib/asm.jar is a correct relative path and that asm.jar contains the class in quesiton?

You probably checked those things though...

Um...I'm looking through my files and refreshing my memory. It's been a while since I did the junit stuff...

Brian

bernhasc
Offline
Joined: 2008-11-11

Aye. here's the results of those checks.

(bernhasc)tyr(~/Work/CxLCS/DocumentEditor_junit) ls -l lib/asm*
-rw-r--r-- 1 bernhasc devel 34807 Nov 17 12:26 lib/asm.jar
(bernhasc)tyr(~/Work/CxLCS/DocumentEditor_junit) unzip -t lib/asm.jar| grep ClassVisitor
testing: org/objectweb/asm/ClassVisitor.class OK

Edit (bernhasc) - I'll go fetch the asm-3.1.jar and asm*common*3.1.jar