Get help with testing, discuss unit testing strategies etc.


Post by nuridesengin »

Nickolay I hope that could be good news and finally I passed the test as all green. First of all I couldn't share whole app folder because of I'm not allowed for that.

Test is passing now but I've been confuse about something! The problem occurred from separateContext * config which used in harness.configure. I had comment this config and then when I checked test suite, it passed.

But the thing is I've not specified location.search.match('unittest') anywhere! Also I've deleted ?unittest parameter from pageUrl config but that worked as well! Isn't there anything wrong within theory?

So the finally harness;
harness.configure({
    title               : 'Siesta Examples',
    // viewDOM             : true,
    // waitForTimeout: 10000,
    // separateContext: true,
    // enableCodeCoverage: true
});

harness.start(
    {
        group   : 'Unit Tests',
        runCore : 'sequential',
        items   : [
            {
                title           : 'Globals',
                pageUrl         : '../../index.html',
                url             : '01-unit-tests/010_globals.t.js'
            }
        ]
    },
and Test file;
describe('MyApp Globals', function(t) {

   t.ok(MyApp.view.main.MainPort, 'Found mainview');

    t.describe('getStatusDesc() method', function(t) {

        t.it('should be a function', function(t) {
            t.expect(typeof MyApp.Globals.getResStatusDesc).toEqual('function');
        });

        t.it('should return a string', function(t) {
            t.expect(typeof MyApp.Globals.getResStatusDesc()).toEqual('string');
        });
    });

});
* There is nothing for separateContext in Siesta API. What's that config for? I've implemented it through one of tutorial...

Post by nickolay »

Hi,

`separateContext` is an old deprecated name of `enablePageRedirect`. In which tutorial did you find it? Must be something old, can't find references to it in recent versions. You don't need to use it, unless you need your tests to support page refresh. More here:
https://www.bryntum.com/docs/siesta/#!/ ... ge_testing

Its ok to not add the "?unittest" query. The goal of this - is to prevent your app from auto-launch, as in unit-testing you don't want that usually. In unit-testing you want to test only specific part of your app (like several classes of it). But, if the whole app starts you still can do that. Pick the most reasonable approach in your case.

Post by nuridesengin »

I couldn't find where I've reference for seperateContext but probably your right, that could be an old tutorial. well! Thanks a lot for your help and of course for your patience =)

Post by nickolay »

Sure, yw

Post Reply