Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which testing-framework for Javascript supports Testing without a browser?

For Javascript some testing-frameworks exist, like JSUnit or js-test-driver. They are fine, but they run the tests in a browser. That's fine, especially to verify your webapp is running in different browsers. But on out continuous-integration-server no window-system (and no browser) is installed. So is there a way to run the tests without the usage of a browser? The best would be to use one of the existing frameworks, so that developers can locally run the tests in their browsers and the continuous-integration-system runs them browserless.

like image 309
Mnementh Avatar asked Jul 10 '09 12:07

Mnementh


3 Answers

You may be interested in HtmlUnit which is used by several UI-testing framework like WebDriver

like image 111
luc Avatar answered Sep 21 '22 00:09

luc


jsTest can be run command line or as an eclipse plugin.

However, be careful, you will not get 100% code coverage using a tool like this if you need to support multiple browsers. Each browser implements JavaScript differently (i.e.: IE). Therefore, the only way to fully test your JavaScript is to run the tests in all browsers that you support.

like image 22
geowa4 Avatar answered Sep 18 '22 00:09

geowa4


Take a look at the following articles:

  • JavaScript Unit Testing with Hudson and JasmineBDD
  • JavaScript BDD, with Jasmine, without a browser

In addition, we have a jsTestDriver server running with a couple of web browsers (as remote console runners) as a resource for Jenkins, so you can have CI with testing in web browsers.

like image 41
Ingvald Avatar answered Sep 21 '22 00:09

Ingvald