Testng JavaScript callbacks -
i fear not understand javascrpt variable scoping. have function looks this:
return { response: '', birthmonthprompt: function(question, promptcallback) { this.dialogtext = question; } };
the idea birthmonthprompt ask user birth month. after enter it, have value 'november'. test ths, i've written following:
it('should prompt user', function() { var reponse = 'november'; myservice.response= response; myservice.birthmonthprompt('please choose birth month:', function(userresponse) { expect(userresponse).tobe(this.response); } ); });
when execute this, error says:
referenceerror: can't find variable: response
i don't understand why test can't find response. doing wrong?
you have typo:
var reponse = 'november';
should be:
var response = 'november';
Comments
Post a Comment