Search code examples
javaunit-testingtomcatjunittomcat7

Test websocket server with junit


Is JUnit able to test a websocket server, or is JUnit unable to complete this task and should another tool then be used to test a websocket server using Java? As of note the websocket server is hosted on a page served by Tomcat 7.0.53.


Solution

  • Your question is confusing. However, perhaps you can look at HTMLUnit which is API that allows you to programmatically access webpages. You can use that with JUnit to test your webpage. You may also want to look at JWebUnit that is based on HTMLUnit. Something else that might be helpful is that you can debug your webapp using Eclipse. You can either run the tomcat server in eclipse or connect to a running server instance (You will need to set some options when starting tomcat if you do not run within Eclipse)

    Hope this helps.