Support Forum
So I just checked, and it seems things has changed significantly in the recent Ext versions. The application loading now happens inside the "bootstrap.js" and does not use Ext.require(). Thus, Siesta presently does not support gathering code coverage information for the tests with "pageUrl" config.
You still can generate this report for tests that uses regular "preload" + on-demand loading. Here's a sample app (default app generated by sencha cmd): https://yadi.sk/d/8LSI13ag3RYDLo
Refer to the "tests" folder. Need to place Ext6.5.2 into the "MyApp/ext" and siesta into "MyApp/tests/siesta".
We plan to rewrite the code coverage feature and make it more generic, after that it will be possible to use it for all types of tests. Realistically thats not earlier than Q2 .
You still can generate this report for tests that uses regular "preload" + on-demand loading. Here's a sample app (default app generated by sencha cmd): https://yadi.sk/d/8LSI13ag3RYDLo
Refer to the "tests" folder. Need to place Ext6.5.2 into the "MyApp/ext" and siesta into "MyApp/tests/siesta".
We plan to rewrite the code coverage feature and make it more generic, after that it will be possible to use it for all types of tests. Realistically thats not earlier than Q2 .
Read the API documentation
Dear nickolay here is the result of my application through your sample. Unfortunately I couldn't be fully success yet
Whole Coverage Folder @ I've set test environment as this way;
globals.t.js // Here are some test assertions; before harness configuration some of them PASSED some are FAILED.
SessionMon.t.js // Here are some test assertions; before harness configuration as well on here some of them PASSED some are FAILED.
Here is translations.js which probably effects Test Environment!?
//Root: myapp/resources/locales/en.js
and we are using those translations on both of unit-test file as this way, Globals.js
Finally here is terminal command I am using;
- * Test threw exceptions: ReferenceError: translations is not defined
* Includes only one test file but I'm state two unit-test file: Globals.js and it's test file + SessionMonitor.js and it's test file
* Coverage folder produces under computer's User root folder: /Users/myuser/coverage. It should produce under application folder where test folder located.
Whole Coverage Folder @ I've set test environment as this way;
harness.configure({
title : 'MyApp Test Runner',
viewDOM : true,
enableCodeCoverage : true,
coverageUnit : 'file',
waitForTimeout : 20000,
runCore : 'sequential'
});
harness.start(
{
group : 'Unit Tests',
preload : [
'../../../ext/build/ext-all-debug.js' // Chrome Network: Status 200
],
loaderPath : {
'MyApp' : '../../app'
},
installLoaderInstrumentationHook : true,
requires : [
'MyApp.Globals', // Chrome Network: Status 200
'MyApp.utils.SessionMonitor' // Chrome Network: Status 200
],
items : [
'01-unit-tests/010_globals.t.js', // Test Threw exception: ReferenceError: translations is not defined
'01-unit-tests/020_sessionmonitor.t.js' // Test Threw exception: ReferenceError: translations is not defined
]
},
describe('MyApp Globals unit-test', function(t) {
t.ok(MyApp.Globals, 'Found Globals.js');
t.describe('getStatusDesc() method', function(t) {
t.it('should return \'A\' as status description', function(t) {
t.expect(MyApp.Globals.getStatusDesc('A')).toEqual('Future');
});
});
t.describe('getGlyph() method', function(t) {
t.it('should return \'add\' ass webfont-code', function(t) {
t.expect(MyApp.Globals.getGlyph('add')).toEqual('xf067@FontAwesome');
});
});
describe('MyApp utils/SessionMonitor unit-test', function(t) {
t.ok(MyApp.utils.SessionMonitor, 'Found SessionMonitor.js');
t.describe('captureActivity() method', function(t) {
t.it('should return a new Date object', function(t) {
t.expect(MyApp.utils.SessionMonitor.captureActivity(new Date())).toEqual(new Date());
});
});
t.describe('monitorUI() method', function(t) {
t.it('should return an undefined', function(t) {
t.expect(MyApp.utils.SessionMonitor.monitorUI()).toEqual('undefined');
});
});
//Root: myapp/resources/locales/en.js
translations = {
active: 'Active',
add: 'Add',
Ext.define('MyApp.Globals', {
.....
status: {
'A': translations.future,
'E': translations.expected,
other-sdks/Siesta/siesta-4.4.0-standard/bin/webdriver https://localhost:1841/myapp/test/Siesta/index.html --browser-arg disable-web-security --coverage-report-format=html
- * As well I would like to point that; coverage folder is keep producing under ROOT directory of computer. (/Users/myuser/coverage). How can I set it directory navigation to produce this folder under application folders?
Well, test clearly says, that "translations" is not defined. This means its not loaded, which is expected, since its not included in the "preload" config.
To specify the location of coverage report use --coverage-report-dir option
To specify the location of coverage report use --coverage-report-dir option
Read the API documentation