Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357577 - EUnit test framework can NOT run in javascript preview pane or deployed mode
Summary: EUnit test framework can NOT run in javascript preview pane or deployed mode
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Scott Greer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 356464 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-13 20:46 EDT by Jing Qian CLA
Modified: 2017-02-23 14:14 EST (History)
5 users (show)

See Also:


Attachments
Change to eunit javascript testdriver project creation; Add eunit runtime to HTML gen (4.13 KB, patch)
2011-09-14 07:13 EDT, Huang Ji Yong CLA
lasher: iplog+
Details | Diff
HTML Gen update (3.32 KB, patch)
2011-09-15 10:04 EDT, Huang Ji Yong CLA
lasher: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jing Qian CLA 2011-09-13 20:46:39 EDT
see green thread scenario No. 0

http://wiki.eclipse.org/EDT:v07_green_threads

for java script, after generate, running in preview or deployed mode, I just get object not defined error.
Comment 1 Scott Greer CLA 2011-09-13 22:29:03 EDT
Ji Yong,

Could you try Jing's scenario and see what you think?  Just step thru the instructions on the green threads wiki, starting with "0. Run EUnit test framework ".....

I've just tried it for myself and reviewed the generated JavaScript for the library created in Step 1;  it looks ok to me (although I didn't execute it).  I also reviewed the generated JS in Step 3 and it also looks ok.   

I was unable to go to the Preview pane -- I get the document.write error, but I may not be running all the latest IDE code.....

I suspect this is a deployment issue, but please confirm whether you agree;  if you think it's in JS, just re-assign it back to me....thanks!
Comment 2 Huang Ji Yong CLA 2011-09-14 07:13:03 EDT
Created attachment 203330 [details]
Change to eunit javascript testdriver project creation; Add eunit runtime to HTML gen
Comment 3 Huang Ji Yong CLA 2011-09-14 07:29:14 EDT
The changes are:
1. The javascript testdriver project did not add javascript dev generator, add it.
2. Add the eunit runtime to html file.

There are still several problems:
JS Gen problem
1.writeResultLib.egl generation error: in js file line 310 or so
eze$Temp11 = egl.egl.lang.ETimestamp.fromETimestamp(myTime"yyyyMMddHHmmssffffff");
should be
eze$Temp11 = egl.egl.lang.ETimestamp.fromETimestamp(myTime,"yyyyMMddHHmmssffffff");
2.mylib.egl generation error? at corresponding js file line 9
new egl.a.mylib();  // Is this expected?
Html Gen problem
1. library dependency is wrong: createResultFile.js is not included

Scott, could you please look at the JS Gen problem at your working day?
Comment 4 Jing Qian CLA 2011-09-14 10:00:38 EDT
JiYong,

Your fix made the javascript testdriver project ONLY has the development mode generator. 

I checked another fix, tested it, now the javascript testdriver project have BOTH development and deployment mode generator
Comment 5 Huang Ji Yong CLA 2011-09-15 10:04:12 EDT
Created attachment 203411 [details]
HTML Gen update

The problems still exists
JSGen
1. writeResultLib.egl generation error still exists. in js file getTimeStamp function
eze$Temp11 = egl.egl.lang.ETimestamp.ezeCast({eze$$value : myTime, eze$$signature : "J'null';"}"yyyyMMddHHmmssffffff");  // This is wrong.
2.TestExecutionLib.egl, the generated js is wrong. 
"eze$$setEmpty": function() {
this.resultRootSum = new egl.org.eclipse.edt.eunit.runtime.ResultSummaryRoot();
this.STEXTS =  [];
}
this.STEXTS should not be empty.

JS Runtime Error
1. egl.createInvalidIndexException does not exist which is invoked in several place.
---------------------------
The mylib.js problem in comment 3 is not an issue. It happens because the project does not configure javascript dev generator.

Scott, I will transfer this to you because I can only find gen problems now. Please return to me if there is deployment problem.
Comment 6 Kathy Carroll CLA 2011-09-15 10:07:52 EDT
*** Bug 356464 has been marked as a duplicate of this bug. ***
Comment 7 Scott Greer CLA 2011-09-18 23:51:13 EDT
Quick update.....after working with Ji Yong tonight / today, I was able to get EUnit working with these caveats:

1.  Late Friday there were some MOF changes that broke JS Gen;   I eventually figured out that running with an earlier version of TypeUtils at least restores JS gen to where I can gen & run the FVT testcases again.  I'll work with Paul (and possibly Jeff) tomorrow to figure out how to resolve this.

2.  The EUnit scenario on the green threads wiki calls for the creation of a basic EGL project;  as a result, the dev mode generator won't be used (as required by VE).  So I re-ran the scenario, but with a Web Client project....  This may be a bug.

3.  There appear to be issues with the service -- I did get errors when I generated the Java portion of the testcase so perhaps that is the root problem. So I commented out all the service-related work in CreateResultFile.egl.  Ji Yong and I will continue to look into getting the service to work.

Finally, I'd like to mention that these results were obtained with the committed version of JS gen and the JS runtime (i.e., without uncommitted changes).
Comment 8 Huang Ji Yong CLA 2011-09-19 09:40:09 EDT
(In reply to comment #7)
> Quick update.....after working with Ji Yong tonight / today, I was able to get
> EUnit working with these caveats:
> 
> 1.  Late Friday there were some MOF changes that broke JS Gen;   I eventually
> figured out that running with an earlier version of TypeUtils at least restores
> JS gen to where I can gen & run the FVT testcases again.  I'll work with Paul
> (and possibly Jeff) tomorrow to figure out how to resolve this.
> 
> 2.  The EUnit scenario on the green threads wiki calls for the creation of a
> basic EGL project;  as a result, the dev mode generator won't be used (as
> required by VE).  So I re-ran the scenario, but with a Web Client project.... 
> This may be a bug.
> 
> 3.  There appear to be issues with the service -- I did get errors when I
> generated the Java portion of the testcase so perhaps that is the root problem.
> So I commented out all the service-related work in CreateResultFile.egl.  Ji
> Yong and I will continue to look into getting the service to work.
> 
> Finally, I'd like to mention that these results were obtained with the
> committed version of JS gen and the JS runtime (i.e., without uncommitted
> changes).

Hi Scott,
The service problem may be caused by the generation error of CreateResultFile.
The generated constructor is
"constructor": function() {
			this.jsrt$SysVar = new egl.egl.core.SysVar();
			var trService = new egl.eglx.http.HttpRest();
			this.trService.restType = egl.eglx.rest.ServiceType.EglDedicated;
			this.trService.request.uri = "org.eclipse.edt.eunit.runtime.TestResultService";
			;
			this.eze$$setInitial();
		}
In which, var trService is declared but this.trService is undefined.
Comment 9 Scott Greer CLA 2011-09-20 10:55:10 EDT
(In reply to comment #8)

Ji Yong,

Thanks so much for triaging CreateResultFile;  I've just committed a fix for this and as a result, I can now run the EUnit smoke-test end-to-end.   

Jing, there are still two caveats (unrelated to JS gen):
1)  I had to create my test project (myProj) as a Web Client with Services Project;  otherwise, my Java test driver for the project would be marked by Eclipse with a red exclamation mark.  I don't know why I had to do this, and possibly I could've done something different, but this does work for me.

2)  I had to modify EUnit to work around the SysLib issue;  as you know, this is outside of the scope of JS gen.  I simply hardcoded the directory and file separator.  Not sure whether Brian's workaround works, or if there's something to dig into here.


> Hi Scott,
> The service problem may be caused by the generation error of CreateResultFile.
> The generated constructor is
> "constructor": function() {
>             this.jsrt$SysVar = new egl.egl.core.SysVar();
>             var trService = new egl.eglx.http.HttpRest();
>             this.trService.restType = egl.eglx.rest.ServiceType.EglDedicated;
>             this.trService.request.uri =
> "org.eclipse.edt.eunit.runtime.TestResultService";
>             ;
>             this.eze$$setInitial();
>         }
> In which, var trService is declared but this.trService is undefined.
Comment 10 Scott Greer CLA 2011-09-20 15:20:48 EDT
Jing and I were both seeing the resulting XML .trs file contained invalid XML tags which were improperly prefixed with "null".  Joe identified the bug in XML.js, and I've just verified that it works with EUnit;  am committing the fix now.

Jing and I are both seeing invalid counts coming of the summary results, so I'll look at that next.
Comment 11 Scott Greer CLA 2011-09-20 21:14:40 EDT
Discovered that the test results weren't being accurately tallied because ConstantsLib.js had been generated prior to some fixes, so all the various constants were incorrectly initialized to zero.

Committing the fix for that now.  Next up is to look into JS gen's exception handling, since that has some bearing on EUnit's results (there are separate bugs that may document these already).
Comment 12 Jing Qian CLA 2011-09-20 21:36:33 EDT
(Reply to comment #9)

caveats #1, the basic EGL project should have all 3 generators by default (java, javascript dev, javascript), but sometimes javascript dev generator isn't created, bug 358304 has been opened against IDE

Also, we found the record => XML conversion has issues in javascript, [[bug 358304]] has been opened
Comment 13 Scott Greer CLA 2011-09-20 22:30:55 EDT
(In reply to comment #12)
> (Reply to comment #9)
> 
> caveats #1, the basic EGL project should have all 3 generators by default
> (java, javascript dev, javascript), but sometimes javascript dev generator
> isn't created, bug 358304 has been opened against IDE
> 
> Also, we found the record => XML conversion has issues in javascript, [[bug
> 358304]] has been opened

At this point, I believe that all JS gen issues have been addressed.  Jing, if
you agree, please close or re-route this bug.....thanks!


> Committing the fix for that now.  Next up is to look into JS gen's exception
> handling, since that has some bearing on EUnit's results (there are separate
> bugs that may document these already).

After further review, I don't think the exception issues are affecting the
tallies.
Comment 14 Jing Qian CLA 2011-09-21 14:47:02 EDT
lower the severity to normal, waiting for bug 358321 (XML issue in javascript) to be fixed
Comment 15 Scott Greer CLA 2011-09-22 15:42:51 EDT
Jing agreed with marking this one resolved;  will re-open if necessary.
Comment 16 Jing Qian CLA 2011-10-14 15:01:01 EDT
verified on 20111009's build
Comment 17 Jing Qian CLA 2011-10-14 15:02:51 EDT
verified & closed