Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335285 - Provide tooling support for JavaScript Tests
Summary: Provide tooling support for JavaScript Tests
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: Tools (show other bugs)
Version: 1.4   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 1.4 M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-25 04:49 EST by Rüdiger Herrmann CLA
Modified: 2011-04-14 09:54 EDT (History)
3 users (show)

See Also:


Attachments
Version 1 (10.23 KB, patch)
2011-03-17 11:00 EDT, Beyhan Veliev CLA
no flags Details | Diff
Version 2 (12.88 KB, patch)
2011-04-08 08:31 EDT, Beyhan Veliev CLA
holger.staudacher: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rüdiger Herrmann CLA 2011-01-25 04:49:57 EST
Double-clicking the index.html in org.eclipse.rap.rwt.q07.jstest leads to an error after some tests are executed:
  Always run tests from an http-server!

Am I really supposed to run the JavaScript tests from an HTTP server?
If so, could someone tell how this could be done easiest.
Comment 1 Ivan Furnadjiev CLA 2011-01-25 05:00:32 EST
I will share my setup:
1. Apache HTTP Server 2.2.17 installed on Windows 7
2. Add two aliases in Apache config file (httpd.conf) like:
#
# RAP JavaScript tests runner
#
Alias /org.eclipse.rap.rwt.q07.jstest "E:/Workspace/org.eclipse.rap.rwt.q07.jstest"
<Directory "E:/Workspace/org.eclipse.rap.rwt.q07.jstest">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Alias /org.eclipse.rap.rwt.q07 "E:/Workspace/org.eclipse.rap.rwt.q07"
<Directory "E:/Workspace/org.eclipse.rap.rwt.q07">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
3. Run the tests from http://127.0.0.1:8081/org.eclipse.rap.rwt.q07.jstest (my apache port is set to 8081 in the same cofig file)
Comment 2 Tim Buschtoens CLA 2011-01-25 05:02:16 EST
We had issues in the past with tests failing in ceratin browser (i think webkit) when tests are run from the file-system.
Comment 3 Tim Buschtoens CLA 2011-01-25 05:03:53 EST
If you only want to run certain tests, use the ?filer=XXXX syntax, then you can omit the filesystem-check.
Comment 5 Rüdiger Herrmann CLA 2011-01-25 05:18:48 EST
Thanks for the tips. I need to run all of the tests as I changed just something and I don't know which tests could possibly affected.
The apache http server setup looks "scary" to me. Sloppy said: "I am not in the mood to install and setup an HTTP server just to be able to once run some tests" The effort outweighs the benefit by far.

Wouldn't it be way more inviting for adopters to press just one button to run te tests?
If we assume that Jetty is around anyway, we could use Jetty to deliver the files.
What do you think?
Comment 6 Tim Buschtoens CLA 2011-01-25 06:11:47 EST
I would not say that the "effort outweighs the benefit by far", but using jetty is a neat idea.
Comment 7 Rüdiger Herrmann CLA 2011-01-25 08:24:39 EST
(In reply to comment #6)
> I would not say that the "effort outweighs the benefit by far", but using jetty
> is a neat idea.
RAP has always tried hard to be as easy to consume as possible, for framework-developers and for application-developers. For framework-developers this would mean: 
* get the suitable Eclipse Tooling
* set up the target platform properly (this step could be improved)
* check out the artefacts from the source code repository and you are done

Having to install additional software breaks RAP's ease of use and may even tempt others to add even more dependencies. Thus using Jetty isn't just a neat idea but a must to keep the project on the right track on the long run.
Comment 8 Ralf Sternberg CLA 2011-01-25 09:18:42 EST
There are some JavaScript tests that can produce false negatives when run from the file system (meaning that the tests succeed despite of problems). Therefore I think there's no alternative to running the tests from a server.

I agree that we should definitely provide tooling support that lets developers run the tests from inside the IDE. This tooling should start a server internally and open the test suite in an internal browser.
Comment 9 Beyhan Veliev CLA 2011-03-17 11:00:30 EDT
Created attachment 191428 [details]
Version 1

The patch provides support for java script tests. 
* Registers all needed resources of bundle 'org.eclipse.rap.rwt.q07.jstest' under the alias 'org.eclipse.rap.rwt.q07.jstest' and from bundle 'org.eclipse.rap.rwt.q07' under the alias 'org.eclipse.rap.rwt.q07'.
* To execute the tests start the provided launch configuration and go to 'http://127.0.0.1:8081/org.eclipse.rap.rwt.q07.jstest/index.html' in your browser.
* If you want to change the port open the 'Jetty Configurator' launch configuration and edit the VM argument 'Dorg.osgi.service.http.port'.
Comment 10 Beyhan Veliev CLA 2011-03-18 11:11:36 EDT
I forgot to mention that I didn't found a easy way to open the browser automatically. Therefore, for the first time we have to open the browser manually. Ideas are welcome.
Comment 11 Rüdiger Herrmann CLA 2011-03-18 12:04:35 EDT
(In reply to comment #10)
> I forgot to mention that I didn't found a easy way to open the browser
> automatically. Therefore, for the first time we have to open the browser
> manually. Ideas are welcome.

Could something like this be the way to go?
  Runtime.exec( "/path/to/org.eclipse.rap.rwt.q07.jstest/index.html" );
Comment 12 Beyhan Veliev CLA 2011-03-18 14:04:10 EDT
(In reply to comment #11)
 
> Could something like this be the way to go?
>   Runtime.exec( "/path/to/org.eclipse.rap.rwt.q07.jstest/index.html" );

I also was looking at something like your suggestion but it is very OS specific what happens when you execute such a command. E.g under Windows following works but only if you have set a browser as the default application for HTML files:

Runtime.getRuntime().exec( "cmd /c start  C:/path/to/org.eclipse.rap.rwt.q07.jstest/index.html" );

I also think that we have to use Runtime.exec and implement OS specific solutions for Windows/Linux and Mac. It isn't complicated and I don't see other ways to do it.
Comment 13 Beyhan Veliev CLA 2011-04-08 08:31:37 EDT
Created attachment 192822 [details]
Version 2

This patch prints additionally into the console the URL which can be used to start the JS tests. Browser isn't opened automatically. After some discussions with Rüdiger and Ralf we decided to not implement the browser activation because the implementation will be a little bit tricky.
Comment 14 Holger Staudacher CLA 2011-04-14 09:54:42 EDT
I reviewed the changes together with Beyhan. After a little refactoring we applied the changes to CVS HEAD.