KOSTAS BARIOTIS
- Developer
- Blogger/Podcaster
- Wanderer
Goodvidio Backend Software Engineer
F.I.R.S.T. Principles of Tests Suites
THIS IS ALL ABOUT TESTING
-
Big Team
-
Many Projects
-
Many Test Suites
F.I.R.S.T.
- Fast
- Isolated
- Repeatable
- Self-verifying
- Timely
FAST
it('throws an error on wrong query', function (done) {
stub = sinon
.stub(analyticsService, '_queryAPI')
.returns(BPromise.reject(
new Error('Something went wrong')
));
analyticsService.queryAPI({})
.catch(Error, function (err) {
expect(err.message)
.to.equal('Something went wrong');
done();
});
});
ISOLATED
it('Should handle recommended video filtering', function (done) {
var request = shopPagesService
.prepareRequest({'videos.recommended': 'VIDEOID'}, {});
expect(request.query)
.to.have.property('videos.recommended.video')
.and.to.equals('VIDEOID');
expect(request.query)
.to.not.have.property('videos.recommended');
done();
});
describe('Handle recommended video filtering', function (done) {
var request = {};
before(function (done) {
request = shopPagesService
.prepareRequest({'videos.recommended': 'VIDEOID'}, {});
});
it('Should contain recommended videos property', function (done) {
expect(request.query)
.to.not.have.property('videos.recommended');
done();
});
it('Should contain the ID', function (done) {
expect(request.query)
.to.have.property('videos.recommended.video')
.and.to.equals('VIDEOID');
done();
});
});
REPEATABLE
describe('Sorting', function () {
before(function (done) {
/*
* Create a couple of platforms
*/
});
it('Sorts results on name with default order', function (done) {
/*
* Test since you know the state of the DB
*/
});
after(function (done) {
/*
* Delete the previous created platforms
* so we leave the DB in the previous state
*/
});
});
SELF-VERYFYING
Tests should always assert something.
TIMELY
AW BTW...
Ep. 3 - Stavros Korokithakis - Testing
THANK YOU SO MUCH
F.I.R.S.T. Principles of Tests Suites
By Kostas Bariotis
F.I.R.S.T. Principles of Tests Suites
- 1,835