spring-projects / spring-webflow

Spring Web Flow
https://spring.io/projects/spring-webflow
Apache License 2.0
323 stars 231 forks source link

provide junit-tests for the js-project [SWF-1298] #494

Open spring-operator opened 15 years ago

spring-operator commented 15 years ago

Odilo Oehmichen opened SWF-1298 and commented

please provide junit-tests for the js-project. otherwise the stability for the project is not guaranteed.


No further details from SWF-1298

spring-operator commented 15 years ago

Rossen Stoyanchev commented

I'm investigating the use of the Dojo Objective Harness (DOH) for unit testing Spring JavaScript.

My initial thoughts are:

1) bundle doh with Spring JavaScript (META-INF/util/doh) 2) have a spring/tests subdirectory where the tests will reside (similar to Dojo's conventions) 3) invoke the runner.html browser harness provided by doh

Invoking runner.html might be achieved in one of two ways:

a) have the source for the Spring JavaScript META-INF/ directory on a web server b) modify ResourceServlet to allow serving HTML pages (perhaps test ones only)

Dependency on Dojo:

While DOH seems to be designed not to have a dependency on dojo, the runner.html browser harness does make use of Dojo module loading. This is not a major concern IMO since Dojo is already available with Spring JavaScript.

Command-line vs. Browser Tests:

DOH tests can be run from the command line with the Rhino engine. This is a nice option for automation but it doesn't guarantee tests will pass in major browsers other than Firefox. Automation is very important and it's something we should pursue. Of course being able to run tests in all major browser environments is the first priority.

Invoking Tests As Local Files:

I discovered that in Firefox 3 you can't double-click a local file to run tests. Dojo's loading mechanism uses XHR requests and in Firefox 3 that does not work for local files (file:///...). I verified it works ok with Konqueror. An alternative would be to create runner.html browser harness that doesn't depend on Dojo for loading test modules but that's not a very high priority IMO.

spring-operator commented 15 years ago

Rossen Stoyanchev commented

I checked in the first set of tests for Spring.js along with a short readme.txt. The readme is required to explain how to make Dojo's unit test framework available.

One option is to add Dojo's util directory to the SJS but that's not quite right because SJS contains a built version of Dojo. Another option is for SJS to contain a version of Dojo that has not been built and also includes Dojo's util directory. That would make it easier to run tests and would also allow building SJS as part of the ant build.