XpdWiki
Set your name in
UserPreferences Edit this page Referenced by
JSPWiki v2.0.52
![]() ![]() |
Any advice given on this page or this site is to be used entirely at the reader's own risk. Q: I am getting the following error when i try to run the test.bat under the jester install dir .. Exception in thread "main" java.lang.UnsupportedClassVersionError?: jester/TestTester (Unsupported major.minor version 49.0) My env details are OS: Win XP Java version: java version "1.4.2_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode) Any help will be greatly appreciated ... A: This usually means that you are compiling the source with a newer version of the compiler to the JVM that you're running the object code with. I've often found this if compiling with an IDE and running from the command line. --OliBye. A: I've made a new build of version 1.37 of Jester, compiling using Java 1.4 - sorry for the problem - I had switched over to use Java 1.5 on my machine and didn't realise the problem this would cause. I've now gone back to 1.4. Try downloading again (file now called jester137b.zip) this should fix the problem. IvanM Q: What is the significance of the messages that JesTer prints? A: Here's an example: - if you had some method foo in the class Bar and JesTer reported: Bar.java - changed string at 654 from 0 to 1 for (int i = £0; i < numbers.length; i++) and Bar.java included the method foo (the character '0' in this method is character 654 in Bar.java): void foo(int[] numbers){ for (int i = 0; i < numbers.length; i++){ process(numbers[i]); } } this means that the tests pass whether the loop in foo starts with i=0 or i=1 The significance of this is probably one of the following:
Manual inspection of the code (static and/or dynamic) should be able to reveal which of these cases apply. Then you'll need to decide if a test is missing, if the code is redundant, or if this is a 'false hit' by Jester. If a test is missing, then it is simply a test that would have failed if the loop incorrectly started with i=1 instead of i=0 (assuming that the loop was correct to start with i=0) Q: What does the score at the end mean? A: This is the percentage of changes that JesTer made that caused the tests to fail. It's a number between 0-100; the higher the number the more completely the tests test the code (but it does not necessarily equate to the percentage of code covered measured by conventional code coverage tools. The result from such tools could be 100%, and from Jester could be much lower than 100%). Q: The tests all pass in VisualAgeForJava? so why doesn't it work in VisualAgeForJava?? A: The tests only cover those things that run in VisualAgeForJava? (it was mostly developed in VisualAgeForJava?) - the tests are incomplete (nobody said that JesTer was itself a good example of testing!) Q: If I run JesTer on itself or on JUnit then I get strange results. A: Don't run JesTer on itself or on JUnit as it uses these classes to run, so will not run correctly if they are changed. Q: I'd like the results in a file rather than printed to the screen. A: use '>'; e.g. java jester.TestTester? myPackage.TestAll? myPackage > results.txt Q: I ran the test.bat example but I got the following message : jester.SourceChangeException: Couldn't run test tester because tests didn't pass before any changes made. at jester.TestTester?.run(TestTester.java:81) at jester.TestTester?.main(TestTester.java:74) what is SourceChangeException ? A: See SourceChangeException. In this case, try executing: java jester.functionaltests.TestAll? to see why the tests didn't pass before any changes were made. It may be that you don't have everything necessary on the classpath (i.e. the current directory, jester.jar and junit) Q: I get the following error: `Couldn't run test tester because tests didn't pass before any changes made` even tho junit passes the TestClass BenHogan A: See JesTer version 1.16 - it now logs what it is trying to do which can help to diagnose problems running Jester A: Note that putting jester.jar, junit.jar and mockobjects.jar into *\jre\lib\ext as jar extensions doesn't work - they have to be on the static classpath. Q: Sorry to bother, but I've been at this for an hour. Why am I stupid this time? Kent Tue Mar 19 02:04:52 PST 2002 Trying to run command "java jester.TestRunnerImpl? j ester.functionaltests.TestAll?" Tue Mar 19 02:04:52 PST 2002 running command "java jester.TestRunnerImpl? jester. functionaltests.TestAll?" resulted in "Suite class "jester.functionaltests.TestA ll" not found?" A: Most problems running JesTer are to do with not having everything on the static classpath. Is the directory 'jester' on the static classpath (in the installation directory - i.e. is the installation directory on the static classpath)? If you run (with NO changes, e.g. NOT "java -cp ...") "java jester.TestRunnerImpl? jester.functionaltests.TestAll?" what happens? If you run "java jester.functionaltests.TestAll?" what happens? Please feel free to email me directly if you are having a problem running JesTer - IvanM. A': My classpath is c:\programs\jdk1.3\jre\lib\rt.jar;c:\programs\junit;c:\programs\mockobjects\lib\mockobjects.jar;c:\programs\jester\jester116\jester.jar;.;c:\programs\jester\jester116 C:\>java jester.TestRunnerImpl? jester.functionaltests.TestAll? . Time: 30 PASSED java jester.functionaltests.TestAll? -- The awtui comes up and shows a green bar with 1 test run I hate this stupid classpath stuff. Whose dumd idea was it anyway? Here's what happens when I try to run Jester: C:\Programs\Jester\jester116\TDD>java jester.TestTester? Money.MoneyTest? . Exception in thread "main" jester.SourceChangeException: couldn't compile (missi ng .class file) ./Money/MoneyTest.class ... Afterwards, the file MoneyTest?.class, which was there and running correctly moments before, has disappeared. Hmmm (IvanM again) - try (with NO changes) "javac ./Money/MoneyTest.java" - javac has to be on the path. (You can use an alternative, but then you have to change "jester.cfg" to specify the alternative compilation command). JesTer compiles code by using exec("javac ...") - to make sure that it has successfully compiled code, it deletes the original .class file, tries to compile, and checks if a replacement .class file has been created. Unfortunately, if JesTer fails to compile (e.g. because javac is not on the path) then it's deleted the original .class file so things won't work any more. NOTE the latest version of JesTer is Jester1.20 rather than Jester1.16; I strongly recommend using the latest version of JesTer. That was it. jdk1.3 wasn't properly installed, so it couldn't run javac. Duh... You can't protect me from my own stupidity. Thanks for the help. I was exercising the example code for http://groups.yahoo.com/group/testdrivendevelopment. The only hole found in the tests was a fake implementation of hashCode() that just returned 0, and wasn't explicitly tested. thank you for persevering and using JesTer - the error messages that it produces are quite unhelpful - I'll improve them or find some other way to improve the diagnosis of problems running JesTer (when I can get my computer at home working again!) IvanM JesTer now (version >= 1.22) reports problems much better. IvanM Q: Question about using Jester with application running under application server Hello. I've got a couple questions about how to use Jester properly. It seems clear just from a high level that for Jester to do it's job, the following has to happen: 1. your junit tests have to pass against the unmodified application. 2. jester modifies the the original application source code. 3. the modified application source code has to be compiled. 4. jester needs to run your unmodified junit tests against the modified application. Is the above correct? My confusion is in the instructions for how to "run" jester. In my particular case, the application that I'm testing is one that is run under an application server on a remote machine. My junit tests tend to "act like clients" meaning they contacts servlets, jsps, beans, etc. This means that, once my application's original source code is modified, it needs to be compiled and deployed on the remote server. The jester instructions, however, make this all sound like a one-step process - which can't be right. I'm guessing that jester is really only involved in 2 steps: 1. Jester modifies the source code. 2. YOU compile deploy your modified application. 3. Jester runs the unmodified junit tests. Do I have this wrong? Jester can be used to test an application that is deployed under an application server, correct? How do I make this happen? As you can see, I'm having a little trouble with understanding how jester works - as well as how to "run" it. Thanks! -john Hello John, you have understood what Jester does correctly. Jester is usually used for unit tests but can also be used in your case (what you describe are functional tests) - you just need to configure Jester to execute the appropriate command line thing (typically calling some ant target) that does the recompilation and deployment of your application. This configuration is in jester.cfg - it's the line: IvanM
|