Get help with testing, discuss unit testing strategies etc.


Post by nickolay »

Well, it works for me, in Windows, Linux and MacOs.. I need to reproduce your issue. So you are saying that "save_it_here" folder is successfully created, but it remains empty? Try to remove that directory first and re-run the command.

Please also run the command with the "--debug" switch and post the full log from the console (including the command itself).

Post by akansha85 »

Hi nick

C:\Program Files\apache-tomcat-7.0.56-windows-x64\apache-tomcat-7.0.56\webapps\siesta-trial-45d\siesta-2.0.8-trial
lhost:8080/siesta-trial-45d/siesta-2.0.8-trial/examples/code_coverage.html --coverage-report-format=html --coverag
--debug
Launching PhantomJS 1.6.0 at https://localhost:8080/siesta-trial-45d/siesta-2.0.8-trial/examples/code_coverage.html
Started browser session: PhantomJS
Opening harness page: https://localhost:8080/siesta-trial-45d/siesta-2.0.8-trial/examples/code_coverage.html?phanto
true&hasPreviousReport=false&page=0
Received command: pageCount:1
Page opened successfully: https://localhost:8080/siesta-trial-45d/siesta-2.0.8-trial/examples/code_coverage.html?ph
age=true&hasPreviousReport=false&page=0
Received command: keepAlive
Received command: keepAlive
Received command: keepAlive
Received command: keepAlive
Received command: keepAlive
Received command: log:[PASS]  code_coverage/010_range.t.js
[PASS]  code_coverage/010_range.t.js
Received command: keepAlive
Received command: keepAlive
Received command: keepAlive
Received command: keepAlive
Received command: keepAlive
Received command: log:[PASS]  code_coverage/020_event.t.js
[PASS]  code_coverage/020_event.t.js
Received command: log:fail 1 - Test  threw an exception
ReferenceError: Can't find variable: Ext https://localhost:8080/siesta-trial-45d/siesta-2.0.8-trial/examples/code_c
enableCodeCoverage=true&hasPreviousReport=false&page=0 12
fail 1 - Test  threw an exception
ReferenceError: Can't find variable: Ext https://localhost:8080/siesta-trial-45d/siesta-2.0.8-trial/examples/code_c
enableCodeCoverage=true&hasPreviousReport=false&page=0 12
Received command: keepAlive
Received command: keepAlive
Received command: log:[FAIL]  code_coverage/030_loader.t.js

[FAIL]  code_coverage/030_loader.t.js

Received command: pageReport:{"testSuiteName":"Siesta Code Coverage Example","startDate":"2014-10-16T20:19:12.822Z
:19:21.401Z","passed":false,"testCases":[{"type":"Siesta.Result.SubTest","startDate":1413490754303,"endDate":14134
l":"code_coverage/010_range.t.js","jUnitClass":"unknown:Siesta.Test.ExtJS","groups":["Static loading"],"assertions
Assertion","passed":true,"description":"Calling `getStartDate` w/o format returns raw date"},{"type":"Siesta.Resul
,"description":"Calling `getStartDate` w/ format returns formatted string"},{"type":"Siesta.Result.Diagnostic","de
es"},{"type":"Siesta.Result.Assertion","passed":true,"description":"No unexpected global variables found"}]},{"typ
,"startDate":1413490758000,"endDate":1413490758070,"passed":true,"url":"code_coverage/020_event.t.js","jUnitClass"
S","groups":["Static loading"],"assertions":[{"type":"Siesta.Result.Assertion","passed":true,"description":"Correc
pe":"Siesta.Result.Assertion","passed":true,"description":"Correct type set"},{"type":"Siesta.Result.Diagnostic","
bles"},{"type":"Siesta.Result.Assertion","passed":true,"description":"No unexpected global variables found"}]},{"t
t","startDate":1413490761169,"endDate":1413490761339,"passed":false,"url":"code_coverage/030_loader.t.js","jUnitCl
ExtJS","groups":["Dynamic loading"],"assertions":[{"type":"Siesta.Result.Assertion","passed":false,"description":"
"annotation":"ReferenceError: Can't find variable: Ext https://localhost:8080/siesta-trial-45d/siesta-2.0.8-trial/e
?phantom=true&enableCodeCoverage=true&hasPreviousReport=false&page=0 12","isException":true,"exceptionType":"Strin
Received command: summaryMessage:6 passed, 1 failed assertions took 7.036s to complete
Received command: htmlReport:{"coverageNoSource":false,"htmlReport":{"prefix":[],"root":{"name":"My","fullName":"M
{"lines":{"total":15,"covered":9,"pct":60},"statements":{"total":18,"covered":10,"pct":55.56},"functions":{"total"
branches":{"total":6,"covered":3,"pct":50}},"parent":null,"children":[{"name":"My/Model","relativeName":"Model","f
:"dir","metrics":{"lines":{"total":15,"covered":9,"pct":60},"statements":{"total":18,"covered":10,"pct":55.56},"fu
ed":3,"pct":50},"branches":{"total":6,"covered":3,"pct":50}},"parent":"My","children":[{"name":"My/Model/Employee"
,"fullName":"My/Model/Employee","kind":"file","metrics":{"lines":{"total":2,"covered":1,"pct":50},"statements":{"t
50},"functions":{"total":1,"covered":0,"pct":0},"branches":{"total":0,"covered":0,"pct":100}},"parent":"My/Model",
 class=\"coverage\"><table class=\"coverage\"><tr><td class=\"line-count\">1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12</
ge\"><span class=\"cline-any cline-yes\">2</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span cl
ral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\
ss=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\
>&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-no\">&nbsp;</
-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span></td><td class=\"text\"><
ng-js\">Ext.define('My.Model.Employee', {\n    extend          : 'My.Model.Resource',\n    \n    fields          :
    ],\n    \n    \n    calculateSalary : <span class=\"fstat-no\" title=\"function not covered\" >function (start
span class=\"cstat-no\" title=\"statement not covered\" >        return this.get('Salary') * (endDate - startDate)
    }\n})</pre></td></tr></table></pre>\n"},{"name":"My/Model/Event","relativeName":"Event","fullName":"My/Model/E
cs":{"lines":{"total":2,"covered":2,"pct":100},"statements":{"total":2,"covered":2,"pct":100},"functions":{"total"
"branches":{"total":0,"covered":0,"pct":100}},"parent":"My/Model","children":[],"html":"<pre class=\"coverage\"><t
r><td class=\"line-count\">1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13</td><td class=\"line-coverage\"><span class=\
span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span
 cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cli
\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<s
e-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-ye
\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span></td><td class=\"t
rint lang-js\">Ext.define('My.Model.Event', {\n        extend          : 'My.Model.Range',\n        \n        fiel
   'ResourceId',\n            'Type'\n        ],\n        \n        \n        getType : function () {\n
        }\n    }) </pre></td></tr></table></pre>\n"},{"name":"My/Model/Range","relativeName":"Range","fullName":"M
e","metrics":{"lines":{"total":5,"covered":5,"pct":100},"statements":{"total":7,"covered":6,"pct":85.71},"function
"pct":100},"branches":{"total":4,"covered":3,"pct":75}},"parent":"My/Model","children":[],"html":"<pre class=\"cov
erage\"><tr><td class=\"line-count\">1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22
rage\"><span class=\"cline-any cline-yes\">3</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span
utral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutra
lass=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class
\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-yes\">2</sp
ny cline-yes\">1</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-yes\
cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"clin
p;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</
-any cline-yes\">1</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-ne
an class=\"cline-any cline-neutral\">&nbsp;</span></td><td class=\"text\"><pre class=\"prettyprint lang-js\">Ext.d
n    extend          : 'Ext.data.Model',\n    \n    fields          : [\n        'StartDate', 'EndDate'\n    ],\n
e : function (format) {\n        if (format)\n            return Ext.Date.format(this.get('StartDate'), format)\n
eturn this.get('StartDate')\n    },\n    \n    \n    // istanbul provides statement-level coverage, so several sta
s fine\n    getEndDate : function (format) {\n        <span class=\"missing-if-branch\" title=\"if path not taken\
 <span class=\"cstat-no\" title=\"statement not covered\" >return Ext.Date.format(this.get('EndDate')) }</span> el
ate') }\n    }\n})\n&nbsp;</pre></td></tr></table></pre>\n"},{"name":"My/Model/Resource","relativeName":"Resource"
urce","kind":"file","metrics":{"lines":{"total":6,"covered":1,"pct":16.67},"statements":{"total":7,"covered":1,"pc
tal":2,"covered":0,"pct":0},"branches":{"total":2,"covered":0,"pct":0}},"parent":"My/Model","children":[],"html":"
able class=\"coverage\"><tr><td class=\"line-count\">1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18
td class=\"line-coverage\"><span class=\"cline-any cline-yes\">2</span>\n<span class=\"cline-any cline-neutral\">&
\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cl
bsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;
ne-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-a
/span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</spa
y cline-no\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-n
lass=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-no\">&nbsp;</span>\n<span class=\"cl
/span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</spa
y cline-no\">&nbsp;</span>\n<span class=\"cline-any cline-neutral\">&nbsp;</span>\n<span class=\"cline-any cline-n
><td class=\"text\"><pre class=\"prettyprint lang-js\">Ext.define('My.Model.Resource', {\n    extend          : 'E
 eventsStore     : null,\n    \n    fields          : [\n        'Name',\n        'Duration'\n    ],\n    \n    \n
s=\"fstat-no\" title=\"function not covered\" >function () {</span>\n<span class=\"cstat-no\" title=\"statement no
d      = this.getId()</span>\n        \n<span class=\"cstat-no\" title=\"statement not covered\" >        var even
n<span class=\"cstat-no\" title=\"statement not covered\" >        this.eventsStore(<span class=\"fstat-no\" title
>function (event) {</span></span>\n<span class=\"cstat-no\" title=\"statement not covered\" >            if (event
<span class=\"cstat-no\" title=\"statement not covered\" >events.push(event)</span></span>\n        })\n        \n
itle=\"statement not covered\" >        return events</span>\n    }\n})</pre></td></tr></table></pre>\n"}]}]}},"co

Received command: exit:1
6 passed, 1 failed assertions took 7.036s to complete
Unable to copy directory tree 'C:\Program Files\apache-tomcat-7.0.56-windows-x64\apache-tomcat-7.0.56\webapps\sies
trial\bin\../resources/css/fonts' at 'save_it_here/css/fonts'
Now I see the files in the folder , but on the UI it shows could not load coverage.json data.This is what I see on console after appending --debug option.
Attachments
report
report
Report.png (28.51 KiB) Viewed 5221 times

Post by nickolay »

Do you open the coverage report in the web server? It performs the XHR request to load the "coverage_data.json" file and if you open it from the file system (file://) it may fail.

Post by akansha85 »

Hi Nick,

Yes, I simply followed your instructions as suggested by you in your previous post, and using web server for opening the report in the browser.

Regards,
Akansha.

Post by mats »

Can we setup a quick screenshare session where you demonstrate the issue?

Post by nickolay »

Ok, do you actually see the "coverage_data.json" file in the "save_it_here" folder?

Post by akansha85 »

@Mats
Yes I can do a screen share session with you, let me know what time works for you?

@Nick
Yes I do see coverage_data.json file in the save_it_here folder.

Post by nickolay »

In what browser do you open the report? Try the different one - Chrome for example.

Also, if you are using the IIS as the webserver, try to rename the "coverage_data.json" to "coverage_data.js" and make the same change in this line of the "save_it_here/index.html" file:
dataUrl             : 'coverage-data.json'
I remember IIS has some problems with serving ".json" files, perhaps that is the reason.

Post by akansha85 »

Actually I am using chrome to open index.html and using apache tomcat server 7.0.56 for loading the siesta project , so I am not using why it is not loading the json file into the UI.

Post by mats »

Can you double check the server response when it loads the json file(please post an image of your console Network tab)? Can you attach the JSON file here too please?

Post Reply