reliable than manual tests. • Automated tests can test what manual tests cannot. • Tests encourage incremental development. • Free QA experts to do more interesting and valuable work. • You’re already doing it…
element on the page. this.element = $('<fscsw-matchpredictorshare sport="football" code="WC" matchid="WC20140101BRACRO" />'); this.element.appendTo('body'); fscsw.init(this.element); ! // Wait for widget to initialise. waitFor(function () { return this.element.children().length; }.bind(this), done); }); ! afterEach(function () { this.element.trigger('delete'); this.element.remove(); }); ! it('displays the names of the teams playing the match', function () { var titles = this.element.find('.fscsw-team-name'); expect(titles).to.have.length(2); expect(titles[0].innerHTML).to.equal('Brazil'); expect(titles[1].innerHTML).to.equal('Croatia'); }); ! });
element on the page. this.element = $('<fscsw-matchpredictorshare sport="football" code="WC" matchid="WC20140101BRACRO" />'); this.element.appendTo('body'); fscsw.init(this.element); ! // Wait for widget to initialise. waitFor(function () { return this.element.children().length; }.bind(this), done); }); ! afterEach(function () { this.element.trigger('delete'); this.element.remove(); }); ! it('displays the names of the teams playing the match', function () { var titles = this.element.find('.fscsw-team-name'); expect(titles).to.have.length(2); expect(titles[0].innerHTML).to.equal('Brazil'); expect(titles[1].innerHTML).to.equal('Croatia'); }); ! });
element on the page. this.element = $('<fscsw-matchpredictorshare sport="football" code="WC" matchid="WC20140101BRACRO" />'); this.element.appendTo('body'); fscsw.init(this.element); ! // Wait for widget to initialise. waitFor(function () { return this.element.children().length; }.bind(this), done); }); ! afterEach(function () { this.element.trigger('delete'); this.element.remove(); }); ! it('displays the names of the teams playing the match', function () { var titles = this.element.find('.fscsw-team-name'); expect(titles).to.have.length(2); expect(titles[0].innerHTML).to.equal('Brazil'); expect(titles[1].innerHTML).to.equal('Croatia'); }); ! });