aspose file tools*
The moose likes Testing and the fly likes Junit test on servers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Junit test on servers" Watch "Junit test on servers" New topic
Author

Junit test on servers

sankar dunga
Greenhorn

Joined: Mar 07, 2011
Posts: 16
Dear Sir,

I am JUnit 4.8.2 testing tool to test my EJB and servlet classes.
I am using JBoss server to run my programs. I created test classes for my java classes.
When i am running project as rightclick on project->run as-> junit test, i am getting following error.............


java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


I am not getting what is this error.
Is there is any other way to execute the web applications using junit tool.

please give the best solution
Thank you in advance.

regards
sankar
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30925
    
158

java.lang.UnsupportedClassVersionError: Bad version number in .class file

This is the error you get when running code compiled with a later version of Java on an earlier version of Java. What version did you compile with? What version is your JBoss server using?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
sankar dunga
Greenhorn

Joined: Mar 07, 2011
Posts: 16
Thank you for your reply.

Right now i am using JDK 1.5 version which is supported for my project.
I will try with JDK 1.6 version.

And one more small doubt: Is there is any special process to test web application on web server using JUnit.
Or it is also same as normal application testing?


please sorry for my poor doubts, i am new to the JUnit.


regards
sankar
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30925
    
158

For testing the web app through the GUI, you would want an extension to junit (jwebunit) or a browser plugin (like selenium). These tests you can run on your machine since they don't rely on the server JVM.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Junit test on servers