JSCoverage
code coverage for JavaScript

Bug #16 - Jscoverage-server make error in parsed js files

Submitted by: Anonymous
Date submitted: 2009-09-16 06:57:13 UTC
Status: Open
I want to use the jscoverage-server (with --proxy) with selenium framework. I do
the necessary modification in the project and the jscoverage-server work well
went I started ONLY ONE automated test. When I started more than One then the
jscoverage-server make a parse error, because the main page of the site was not
loaded correctly. For example "H is undefended" surely H is a variable which the
ext-js renamed. How can I resolved this problem, jscoverage-server doesn't
support the new java script syntax?
Submitted by: Ed
Date submitted: 2009-09-16 15:47:59 UTC
Could you attach a minimal example of code that generates the error?
Submitted by: Anonymous
Date submitted: 2009-09-16 17:20:56 UTC
The error is generated by the FF3 because the js file which he want to use has a
syntax error. This parse error occurred when the second test is started to run.
Always the first test is run successfully. With the second test and the remains
tests has this problem. This parse problem always change(The test stop not only
at a certain *.js file, the *.js file change.)I can't attach one error example
because I write this message from home, but I will attach tomorrow when I will
work again.    
Submitted by: Anonymous
Date submitted: 2009-09-17 14:47:03 UTC
I have this lines of code: 

begin at the line of 16 
SessionContext = function(config)
{
    SessionContext.superclass.constructor.call(this, config);

    this.objName = "SessionContext";

    this.javaDocPath = null;
    this.hasUserReadWriteAccess = false;

};
end at the lineof 25.

The jscoverage-server with proxy option made this modification:

_$jscoverage['http://localhost:8080/src/main/SessionCtxt.js'][16]++;
SessionContext = (function (config) {
  _$jscoverage['http://localhost:8080/src/main/SessionCtxt.js'][18]++;
SessionContext.superclass.constructor.call(this, config); //<- This is appeare
the FF3 error with the following text: "SessionContext.superclass class is
undefined"
  _$jscoverage['http://localhost:8080/src/main/SessionCtxt.js'][20]++;
  this.objName = "TNG.main.SessionContext";
  _$jscoverage['http://localhost:8080/src/main/SessionCtxt.js'][22]++;
  this.javaDocPath = null;
  _$jscoverage['http://localhost/src/main/SessionCtxt.js'][23]++;
  this.hasUserReadWriteAccess = false;
});

I compared the parsed code and the unparsed code and is the following difference
between them: unparsed code ->"SessionContext = function(config)" and the parsed
code "SessionContext = (function (config) {". An unneeded round brackets appears
there -> "= (function"
Submitted by: Anonymous
Date submitted: 2009-09-17 15:00:20 UTC
I forgot to say that another difference appears at the end of the function,
exactly here: "});".

It is an another unneeded round bracket.

Please help me. This is the only tool I found for js code coverage.
Submitted by: Anonymous
Date submitted: 2009-09-17 15:23:03 UTC
The brackets are not causing the error.

It looks like Ext is not getting loaded.  It may be a good idea to use the
--no-instrument=http://example.com/path/to/ext.js option.
Submitted by: Anonymous
Date submitted: 2009-09-17 15:31:08 UTC
This is not a solution for us, because we had more then 500 js files. The
index.html contains the all js files in the head-er. And it is download the all
js files when the ext want to load the main window. 

And the all project was designed to use this "stuffs"(Objected oriented
programming). 

Any other idea with which I can resolve my problem?
Submitted by: Anonymous
Date submitted: 2009-09-17 15:39:16 UTC
> This is not a solution for us, because we had more then 500 js files.

I'm not sure I understand your point - the more files you have, the *more*
important it is to use the --no-instrument option.  Otherwise, your code will
run slowly, and you will end up with a lot of information you don't need.

You can have the --no-instrument option point to a directory
(--no-instrument=http://example.com/directory/), and none of the files in that
directory will be instrumented.  See the manual for details.
Submitted by: Anonymous
Date submitted: 2009-09-18 06:18:07 UTC
I understand what are you say. But you doesn't understand what I want to say to
you. We have more than 500 js files which we were written and we want to test
the all files. Of course I used the no-instrument option for the ext-js
directories. But this error generated in our code. I don't like to run the code
coverage and skip the files. I say again this error is generated not only in
this file... Didn't use you jscoverage with selenium?  
Submitted by: Ed
Date submitted: 2009-09-18 18:14:43 UTC
Okay, can you reduce it to a minimal example that still generates the error and
attach the code?

Add a comment

Your name:
Your email address (optional - will never be displayed):
Comment:
Attachment (optional - maximum 64 KiB):
Copyright © 2008 Silicon Forks siliconforks.com
siliconforks@siliconforks.com