Stored Report
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Stored Report
Hi,
I'm using JScoverage on proxy server mode. Then, at end I store my reports, but, when I click on each file result, I can't see the sources view with the coverage result per file. How can I achieve that?
VELO
I'm using JScoverage on proxy server mode. Then, at end I store my reports, but, when I click on each file result, I can't see the sources view with the coverage result per file. How can I achieve that?
VELO
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: Stored Report
Can you provide more details? What happens when you click on each file? Is there an error in your browser's error console?
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Re: Stored Report
I uploaded my report to rapidshare...
http://www.easy-share.com/1906069720/site.zip
When I click on links nothing happens
http://www.easy-share.com/1906069720/site.zip
When I click on links nothing happens
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Re: Stored Report
I debug a bit jscoverage.js...
on function jscoverage_makeTable, it does _$jscoverage[jscoverage_currentFile]....
The all objects inside this array doesn't have source. Does that give you any clue?
VELO
on function jscoverage_makeTable, it does _$jscoverage[jscoverage_currentFile]....
The all objects inside this array doesn't have source. Does that give you any clue?
VELO
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: Stored Report
It looks like something went wrong when the report was stored. Were there any errors printed by jscoverage-server (likely printed to stderr) when the report was stored?
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Re: Stored Report
Hi Ed,
So no errors on console!
I saw that jscoverage_serializeCoverageToJSON() doesn't include the sources.... I guess that is why jscoverage.json doesn't include the sources.... I thought jscoverage will load they from the .js files again.
VELO
So no errors on console!
I saw that jscoverage_serializeCoverageToJSON() doesn't include the sources.... I guess that is why jscoverage.json doesn't include the sources.... I thought jscoverage will load they from the .js files again.
VELO
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: Stored Report
The jscoverage-server proxy server is supposed to retrieve the sources directly from the origin server and store them in the jscoverage.json report. The jscoverage_serializeCoverageToJSON function does not include the sources because the proxy server can retrieve the sources directly from the origin server.velo wrote:I saw that jscoverage_serializeCoverageToJSON() doesn't include the sources.... I guess that is why jscoverage.json doesn't include the sources....
Looking at your jscoverage.json file, it doesn't look like a standard proxy report - in a proxy report, the names of all the scripts are usually absolute URLs (i.e., starting with http://). Can you describe the steps you used to generate this report?
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Re: Stored Report
I do generate it manually, because I'm running using instrumented JS, not the server, so I just do jscoverage_serializeCoverageToJSON() , then I store the result to jscoverage.json
I had to make a small java API to covert the JSON from jscoverage_serializeCoverageToJSON() to be the same as it is on jscoverage.json from server... but still on server there is no sources...
This is the original report generated by server:
http://www.easy-share.com/1906073451/js ... report.zip
VELO
I had to make a small java API to covert the JSON from jscoverage_serializeCoverageToJSON() to be the same as it is on jscoverage.json from server... but still on server there is no sources...
This is the original report generated by server:
http://www.easy-share.com/1906073451/js ... report.zip
VELO
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Re: Stored Report
FWIW, I had to build my ow jscoverage exes...
Due to this problem:
http://siliconforks.com/forum/viewtopic.php?f=1&t=141
VELO
Due to this problem:
http://siliconforks.com/forum/viewtopic.php?f=1&t=141
VELO
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: Stored Report
I'm still a bit confused about how you're executing jscoverage-server (or is it just jscoverage?)velo wrote:I do generate it manually, because I'm running using instrumented JS, not the server, so I just do jscoverage_serializeCoverageToJSON() , then I store the result to jscoverage.json
I had to make a small java API to covert the JSON from jscoverage_serializeCoverageToJSON() to be the same as it is on jscoverage.json from server... but still on server there is no sources...
Is the source code for this java API, etc., available? E.g., is it in the subversion repository listed here: http://nexus.sonatype.org/dev/repository.html?
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Re: Stored Report
I'm using jscoverage to emulate jscoverage-server report....
But I couldn't figure out how jscoverage-server retrieves the sources on reports.
The sources are in 2 pieces...
One to convert the JS json into server JSON
http://svn.sonatype.org/spice/trunk/jsc ... component/
The other is the maven plugin that instruments and generate the report it self
http://svn.sonatype.org/plugins/trunk/j ... en-plugin/
VELO
But I couldn't figure out how jscoverage-server retrieves the sources on reports.
The sources are in 2 pieces...
One to convert the JS json into server JSON
http://svn.sonatype.org/spice/trunk/jsc ... component/
The other is the maven plugin that instruments and generate the report it self
http://svn.sonatype.org/plugins/trunk/j ... en-plugin/
VELO
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Re: Stored Report
No hope for me on getting sources report?
VELO
VELO
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: Stored Report
Sorry, I was busy all day yesterday, I haven't had a chance to look at it yet. I'll try to take a look some time today.
-
- Posts: 120
- Joined: 2008-10-11 6:52 pm
Re: Stored Report
I think I understand your workflow now - just let me ask if this is correct:
- Your test suite calls the method org.sonatype.nexus.mock.SeleniumTest.getCoverage(). (There is a Selenium RC server running by this time.)
- This method sends the "getEval" command to the Selenium server, asking it to evaluate the function jscoverage_serializeCoverageToJSON().
- The result of the eval is returned (a JSON object).
- The JsonReportHandler (the spice plexus component) converts that JSON object to the format normally stored to disk in JSCoverage reports, and then persists it to a file. (The intent here is to create a stored report that can be viewed in a web browser in the usual way, i.e., using jscoverage.html. But the problem is the JavaScript source code is missing.)
-
- Posts: 16
- Joined: 2009-06-08 7:04 pm
Re: Stored Report
Exactly....
I try to mimic what jscoverage server does....
BTW, I just found a fix for my problem this morning. I changed the method jscoverage_body_load():
I don't know why I had to store _$jscoverage into currentCoverage, but if I didn't do that _$jscoverage[file].source was always empty.
That way my report needs to load all my .js files, but did the trick.
VELO
I try to mimic what jscoverage server does....
BTW, I just found a fix for my problem this morning. I changed the method jscoverage_body_load():
Code: Select all
function jscoverage_body_load() {
var progressBar = document.getElementById('progressBar');
ProgressBar.init(progressBar);
function reportError(e) {
jscoverage_endLengthyOperation();
var summaryThrobber = document.getElementById('summaryThrobber');
summaryThrobber.style.visibility = 'hidden';
var div = document.getElementById('summaryErrorDiv');
div.innerHTML = 'Error: ' + e;
}
//start - my change
var currentCoverage = _$jscoverage;
//end - my change
if (jscoverage_isReport) {
jscoverage_beginLengthyOperation();
var summaryThrobber = document.getElementById('summaryThrobber');
summaryThrobber.style.visibility = 'visible';
var request = jscoverage_createRequest();
try {
request.open('GET', 'jscoverage.json', true);
request.onreadystatechange = function (event) {
if (request.readyState === 4) {
try {
if (request.status !== 0 && request.status !== 200) {
throw request.status;
}
var response = request.responseText;
if (response === '') {
throw 404;
}
var json = eval('(' + response + ')');
var file;
for (file in json) {
var fileCoverage = json[file];
//start - my change
var originalSource = currentCoverage[file].source;
_$jscoverage[file] = fileCoverage.coverage;
if(originalSource) {
_$jscoverage[file].source = originalSource;
} else {
_$jscoverage[file].source = fileCoverage.source;
}
//end - my change
}
jscoverage_recalculateSummaryTab();
summaryThrobber.style.visibility = 'hidden';
}
catch (e) {
reportError(e);
}
}
};
request.send(null);
}
catch (e) {
reportError(e);
}
jscoverage_removeTab('browser');
jscoverage_removeTab('store');
}
else {
if (jscoverage_isInvertedMode) {
jscoverage_removeTab('browser');
}
if (! jscoverage_isServer) {
jscoverage_removeTab('store');
}
}
jscoverage_initTabControl();
jscoverage_initTabContents(location.search);
}
That way my report needs to load all my .js files, but did the trick.
VELO