SlideShare a Scribd company logo
1 of 41
Full-stack unit-testing 
Tech talk @ Pause
Plan 
1. Overview of frameworks and libraries for testing 
2. Testing of client side web application 
a. Test runner 
b. Unit testing stack 
c. End-2-end testing 
d. Reporting 
e. Sample: angular application testing 
3. Testing of server side 
a. Mocking of data providers 
b. Fixtures 
c. Essentials of tests 
4. Pitfalls of unit testing
Overview of frameworks
Testing of client-side 
1. Test runner - runs unit tests suite in various 
browsers and write reports using different 
formats 
2. Frameworks - skeleton for unit tests suites 
3. Utils libraries - allow to write tests in more 
expressive
Test runner 
1. Dynamically generate index file using 
required libs, sources and tests 
2. Execute web server on background 
3. Run tests in different browsers 
4. Collect test results from expectations and 
asserts 
5. Format them into report
Test runner 
Test’em - simple test 
runner 
1. Framework config: 
Mocha, Jasmine 
2. Test files 
3. Serve files 
4. Browser stack config
Test runner 
Karma - advanced test 
runner 
1. Plugins 
2. Multiple report formats 
supported 
3. Various browsers 
4. Dynamic index.html 
generation
Test runner 
Essentials 
1. Synchronization between source files 
2. Integration of frameworks 
3. Debugging
Unit testing stack 
Testing framework 
API 
● TDD 
● BDD 
Main frameworks 
● Mocha 
● Jasmine 
● describe 
o skip 
o only 
● it 
● before(done) 
● after(done) 
● beforeEach 
● afterEach
Unit testing stack 
Assertion libraries 
Chai 
● Plugins 
● Supports should and 
expect style 
Should 
● expect(foo).to.deep. 
equal(someNested 
Array) 
● should.exist(foo) 
● foo.bar.should.have 
.property(‘bar’)
Unit testing stack 
Plugins for chai 
● Allows you to write 
tests in terms of 
libraries you are 
using 
● Syntactic sugar 
● Sinon.js 
● jQuery 
● Backbone 
● Q
Unit testing stack
End-2-end testing 
Protractor (previously 
angular-scenario): 
● Access to angular 
scope from view 
● Selectors for 
directives 
● Uses selenium 
● by. 
o id 
o css 
o model 
o binding 
● element 
o sendKeys 
o setPosition 
o setSize
End-2-end testing
Reporting 
● jUnit XML - Jenkins 
love it 
● Progress, Dots - for 
console lovers 
● Coverage - 
objective metrics 
● jUnit is has better 
support of Jasmine 
● Coverage settings - 
include all sources 
not tests
Reporting
Sample angular app testing 
beforeEach(inject(function ($controller, $rootScope) { 
scope = $rootScope.$new(); 
GamesCtrl = $controller('HotelsCtrl', { 
$scope: scope, Hotels: factory 
}); 
})); 
it('should set default value for orderProp', function () { 
expect(scope.orderProp).toBe('title'); 
}); 
it('should have a List of Hotels', function () { 
expect(scope.games.length).toBe(2); 
expect(scope.games[0].title).toBe('Hilton'); 
expect(scope.games[1].freeRooms).toBe(10); 
});
Testing of server side
Mocking of data providers 
Faker.js 
● id’s 
● names, emails 
● cities, locations 
● messages, sentences, paragraphs 
Sinon.js 
● Mocking API using sinon.mock(API)
Sample code 
//Hotels data 
'use strict'; 
var Faker = require('Faker'); 
function generateOne() { 
return { 
name: Faker.random.bk_noun(), 
address: Faker.Addresses.streetAddress(), 
capacity: { 
standard: Faker.helpers.randomNumber(100), 
economy: Faker.helpers.randomNumber(100), 
luxury: Faker.helpers.randomNumber(100) 
} 
}; 
} 
module.exports.generateOne = generateOne; 
module.exports.generateMany = function (count) { 
var result = []; 
for (var i = 0; i < count; i++) { 
result.push(generateOne()) 
} 
return result; 
}
Database mapping testing 
1. No need to test mongoose API 
2. Create stub data using Faker API and 
predefined JSON 
3. Insert it into DB inside before callback 
4. Run unit test suites on test data 
5. Remove data from DB inside after callback
Sample code 
var fixtures = require('fixtures.js'); 
var api = require('api/'); 
var expect = require('chai').expect; 
var COUNT = 100; 
describe('Booking API', function () { 
describe('#search', function () { 
before(function (done) { 
fixtures.prepareData('hotels', 
COUNT, done); 
}); 
it('should return all hotes if no query 
params provided', function (done) 
{api.search('hotels', function (err, 
data) { 
expect(err).to.be.null; 
expect(data).to.be.an('object'); 
expect(data.length).to.be.eql(COUNT); 
done(); 
…. 
after(function (done) { 
fixtures.destroyData('hotels');
Alternatives 
● https://github.com/petejkim/factory-lady 
● http://chaijs.com/plugins/chai-factories 
● https://www.npmjs.com/package/rosie
Fixtures 
Rules 
1. Do not hardcode the id’s and data that is 
generated by database 
2. Put all domain specific data into fixtures, 
group them by collections 
3. Do not put null to client API object. Use 
dummy object instead.
Sample code 
// Fixtures 
var async = require('async'); 
var hotelsData = require('./hotelsData'); 
var Hotel = require('./hotelModel'); 
module.exports.prepareData = function (name, count, cb) { 
if (name !== 'hotels') { cb(new Error('Invalid data type')); return; } 
async.forEach(hotelsData.generateMany(count), function (item, callback) { 
var hotel = Hotel.createNew(item); 
hotel.save(callback); 
}, cb) 
}
Sample code 
var client = null; 
function notInitializedThrow () {throw new Error 
('Client not initialized')}; 
module.exports.init = function (config, cb) { 
if (client === null) { 
client = API.createClient(config); 
// doing some initializations tuff 
client.on('error', cb); 
client.on('connected', cb.bind(this, null)); 
} 
} 
module.exports.getClient = function () { 
if (client === null) { 
return { 
method1: notInitializedThrow, 
method2: notInitializedThrow 
} 
} else { 
return client; 
} 
}
Essentials 
1. Test should not depend on each others 
results 
2. They should not use shared data (only in 
read only mode) 
3. Do not allow skipped tests in releases 
4. Tests are not just for make it green
Integration tests 
1. They are checking of how modules are 
working together 
2. Ideal for checking of entity lifecycle - 
creation, linking to others, api calls, 
querying, destroying 
3. Execution environment should be 
configurable
References 
Tools: 
● WS: 
o WebSocket API client 
● HTTP: 
o Nock 
Article: 
● https://davidbeath.com/posts/testing-http-responses-in-nodejs. 
html
Stack 
1. Mocha as core framework 
2. Chai / Expect as assertions 
3. Request.js for HTTP requests 
4. node-websocket as ws client 
5. Faker or factory-lady for generation of test 
data
Best 
1. To put grunt test or test command as git 
merge to master hook 
2. To put shortcut for testing into npm test 
assuming that grunt is not globally installed 
3. JSHint/JSLint as pre commit hook
Worst 
1. To mix TDD and BDD 
a. TDD: Suite, test, step, setup, done 
b. BDD: Expectations, asserts 
2. To spaghetti the dependencies inside test 
code
Sample code 
describe('API method', function () { 
var temporaryData = null; 
it('should do one thing', function (done) { 
var result = API.call('somemethod'); 
temporaryData = API.call('anotherMethod'); 
expect(result).to.have.keys(['code', 'details', 'message']); 
}); 
it('should do another thing', function (done) { 
API.call('setup', temporaryData); 
var result = API.call('anotherMethod'); 
expect(result).to.be.null;
Pitfalls 
1. Separated environment for integration testing, unit 
testing development and production 
2. Do not rely on synchronous operations especially when 
they are not (callbacks, initialization process) 
3. Extra console.log’s are breaking unit test reportings
Sample code 
describe('Service API', function () { 
before(function (done) { 
thirdparty1.init(/*callback?*/); 
thirdparty2.init(/*callback?*/); 
thirdparty3.init(/*callback?*/); 
done(); 
}); 
before(function (done) { 
thirdparty1.done(/*callback?*/); 
thirdparty2.done(/*callback?*/); 
thirdparty3.done(/*callback?*/); 
done(); 
}); 
}); 
describe('Service API', function () { 
before(function (done) { 
async.waterfall([ 
thirdparty1.init, 
thirdparty2.init, 
thirdparty3.init 
], done); 
}); 
before(function (done) { 
async.waterfall([ 
thirdparty1.done, 
thirdparty2.done, 
thirdparty3.done 
], done); 
}); 
});
References 
Books 
1. Testable Javascript book 
2. JavaScript Allongé 
3. Testing with CoffeeScript 
Articles/Blogs: 
1. Full spectrum testing with angular.js and Karma 
2. Cross-browser testing on multiple devices 
3. Mocha + CoffeeScript tutorial 
4. http://code.tutsplus.com/tutorials/testing-in-nodejs--net-35018
Tools 
1. Node version manager 
2. Mocha 
3. Jasmine 
4. Karma 
5. Istanbul 
6. Protractor 
7. Selenium
QA

More Related Content

What's hot

Jasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyJasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyIgor Napierala
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSKnoldus Inc.
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmineTimothy Oxley
 
Unit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and KarmaUnit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and KarmaAndrey Kolodnitsky
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineGil Fink
 
Test-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS ApplicationsTest-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS ApplicationsFITC
 
Testing Javascript with Jasmine
Testing Javascript with JasmineTesting Javascript with Jasmine
Testing Javascript with JasmineTim Tyrrell
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasminefoxp2code
 
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma Christopher Bartling
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSJim Lynch
 
Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Roy Yu
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit TestChiew Carol
 
Good karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaGood karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaExoLeaders.com
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with JestMichał Pierzchała
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introductionNir Kaufman
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentAll Things Open
 
Celery: The Distributed Task Queue
Celery: The Distributed Task QueueCelery: The Distributed Task Queue
Celery: The Distributed Task QueueRichard Leland
 

What's hot (20)

Jasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyJasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishy
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmine
 
Unit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and KarmaUnit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and Karma
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
 
Test-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS ApplicationsTest-Driven Development of AngularJS Applications
Test-Driven Development of AngularJS Applications
 
Testing Javascript with Jasmine
Testing Javascript with JasmineTesting Javascript with Jasmine
Testing Javascript with Jasmine
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasmine
 
Celery
CeleryCelery
Celery
 
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
 
Practical Celery
Practical CeleryPractical Celery
Practical Celery
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJS
 
Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101Javascript Testing with Jasmine 101
Javascript Testing with Jasmine 101
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
 
Good karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaGood karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with Karma
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introduction
 
Angular testing
Angular testingAngular testing
Angular testing
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End Development
 
Celery: The Distributed Task Queue
Celery: The Distributed Task QueueCelery: The Distributed Task Queue
Celery: The Distributed Task Queue
 

Viewers also liked

Dependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJSDependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJSRemo Jansen
 
FTIR For Stack and CEM
FTIR For Stack and CEMFTIR For Stack and CEM
FTIR For Stack and CEMjimbelanger33
 
Dr bhargava
Dr bhargavaDr bhargava
Dr bhargavaECRD2015
 
Combustion & Flue Gas Analysis
Combustion & Flue Gas AnalysisCombustion & Flue Gas Analysis
Combustion & Flue Gas AnalysisAmit Makwana
 
Air quality montoring system
Air quality montoring systemAir quality montoring system
Air quality montoring systemAnees Waqar
 
Flue gas analisys in industry-Practical guide for Emission and Process Measur...
Flue gas analisys in industry-Practical guide for Emission and Process Measur...Flue gas analisys in industry-Practical guide for Emission and Process Measur...
Flue gas analisys in industry-Practical guide for Emission and Process Measur...Testo Azerbaijan
 
Measurement of ambient air pollutants, sampling and analysis
Measurement of ambient air pollutants, sampling and analysisMeasurement of ambient air pollutants, sampling and analysis
Measurement of ambient air pollutants, sampling and analysisAbhishek Tiwari
 
Air quality sampling and monitoring m5
Air quality sampling and monitoring m5Air quality sampling and monitoring m5
Air quality sampling and monitoring m5Bibhabasu Mohanty
 

Viewers also liked (10)

Dependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJSDependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJS
 
FTIR For Stack and CEM
FTIR For Stack and CEMFTIR For Stack and CEM
FTIR For Stack and CEM
 
Dr bhargava
Dr bhargavaDr bhargava
Dr bhargava
 
L 37 final
L 37 finalL 37 final
L 37 final
 
Combustion & Flue Gas Analysis
Combustion & Flue Gas AnalysisCombustion & Flue Gas Analysis
Combustion & Flue Gas Analysis
 
Air quality montoring system
Air quality montoring systemAir quality montoring system
Air quality montoring system
 
Flue gas analisys in industry-Practical guide for Emission and Process Measur...
Flue gas analisys in industry-Practical guide for Emission and Process Measur...Flue gas analisys in industry-Practical guide for Emission and Process Measur...
Flue gas analisys in industry-Practical guide for Emission and Process Measur...
 
Measurement of ambient air pollutants, sampling and analysis
Measurement of ambient air pollutants, sampling and analysisMeasurement of ambient air pollutants, sampling and analysis
Measurement of ambient air pollutants, sampling and analysis
 
Air quality sampling and monitoring m5
Air quality sampling and monitoring m5Air quality sampling and monitoring m5
Air quality sampling and monitoring m5
 
Flue gas analysis
Flue gas analysisFlue gas analysis
Flue gas analysis
 

Similar to Full Stack Unit Testing

Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineGil Fink
 
Unit Testing from Setup to Deployment
Unit Testing from Setup to DeploymentUnit Testing from Setup to Deployment
Unit Testing from Setup to DeploymentMark Niebergall
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web developmentalice yang
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciollaAndrea Paciolla
 
Unit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and HowsUnit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and Howsatesgoral
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF SummitOrtus Solutions, Corp
 
Browser testing with nightwatch.js - Drupal Europe
Browser testing with nightwatch.js - Drupal EuropeBrowser testing with nightwatch.js - Drupal Europe
Browser testing with nightwatch.js - Drupal EuropeSalvador Molina (Slv_)
 
Rapid prototyping and easy testing with ember cli mirage
Rapid prototyping and easy testing with ember cli mirageRapid prototyping and easy testing with ember cli mirage
Rapid prototyping and easy testing with ember cli mirageKrzysztof Bialek
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testingpleeps
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock FrameworkEugene Dvorkin
 
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-MechanizePerformance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanizecoreygoldberg
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with exampleshadabgilani
 
MT_01_unittest_python.pdf
MT_01_unittest_python.pdfMT_01_unittest_python.pdf
MT_01_unittest_python.pdfHans Jones
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingVisual Engineering
 
Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023Mark Niebergall
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockRobot Media
 
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyUI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyOren Farhi
 
Angularjs Test Driven Development (TDD)
Angularjs Test Driven Development (TDD)Angularjs Test Driven Development (TDD)
Angularjs Test Driven Development (TDD)Anis Bouhachem Djer
 

Similar to Full Stack Unit Testing (20)

Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
 
Unit Testing from Setup to Deployment
Unit Testing from Setup to DeploymentUnit Testing from Setup to Deployment
Unit Testing from Setup to Deployment
 
Testing in JavaScript
Testing in JavaScriptTesting in JavaScript
Testing in JavaScript
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Test strategy for web development
Test strategy for web developmentTest strategy for web development
Test strategy for web development
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
 
Unit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and HowsUnit Testing - The Whys, Whens and Hows
Unit Testing - The Whys, Whens and Hows
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
Browser testing with nightwatch.js - Drupal Europe
Browser testing with nightwatch.js - Drupal EuropeBrowser testing with nightwatch.js - Drupal Europe
Browser testing with nightwatch.js - Drupal Europe
 
Rapid prototyping and easy testing with ember cli mirage
Rapid prototyping and easy testing with ember cli mirageRapid prototyping and easy testing with ember cli mirage
Rapid prototyping and easy testing with ember cli mirage
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock Framework
 
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-MechanizePerformance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanize
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
MT_01_unittest_python.pdf
MT_01_unittest_python.pdfMT_01_unittest_python.pdf
MT_01_unittest_python.pdf
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
 
Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
 
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyUI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected Journey
 
Angularjs Test Driven Development (TDD)
Angularjs Test Driven Development (TDD)Angularjs Test Driven Development (TDD)
Angularjs Test Driven Development (TDD)
 

More from GlobalLogic Ukraine

GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic Ukraine
 
Штучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxШтучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxGlobalLogic Ukraine
 
Задачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxЗадачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxGlobalLogic Ukraine
 
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxЩо треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxGlobalLogic Ukraine
 
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Ukraine
 
JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"GlobalLogic Ukraine
 
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic Ukraine
 
Страх і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationСтрах і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationGlobalLogic Ukraine
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic Ukraine
 
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic Ukraine
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?GlobalLogic Ukraine
 
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Ukraine
 
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Ukraine
 
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic Ukraine
 
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"GlobalLogic Ukraine
 
GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Ukraine
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"GlobalLogic Ukraine
 
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Ukraine
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
 
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”GlobalLogic Ukraine
 

More from GlobalLogic Ukraine (20)

GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
 
Штучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxШтучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptx
 
Задачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxЗадачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptx
 
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxЩо треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
 
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
 
JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"
 
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
 
Страх і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationСтрах і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic Education
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
 
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?
 
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
 
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
 
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
 
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
 
GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"
 
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
 

Recently uploaded

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 

Full Stack Unit Testing

  • 2. Plan 1. Overview of frameworks and libraries for testing 2. Testing of client side web application a. Test runner b. Unit testing stack c. End-2-end testing d. Reporting e. Sample: angular application testing 3. Testing of server side a. Mocking of data providers b. Fixtures c. Essentials of tests 4. Pitfalls of unit testing
  • 4. Testing of client-side 1. Test runner - runs unit tests suite in various browsers and write reports using different formats 2. Frameworks - skeleton for unit tests suites 3. Utils libraries - allow to write tests in more expressive
  • 5. Test runner 1. Dynamically generate index file using required libs, sources and tests 2. Execute web server on background 3. Run tests in different browsers 4. Collect test results from expectations and asserts 5. Format them into report
  • 6. Test runner Test’em - simple test runner 1. Framework config: Mocha, Jasmine 2. Test files 3. Serve files 4. Browser stack config
  • 7. Test runner Karma - advanced test runner 1. Plugins 2. Multiple report formats supported 3. Various browsers 4. Dynamic index.html generation
  • 8. Test runner Essentials 1. Synchronization between source files 2. Integration of frameworks 3. Debugging
  • 9. Unit testing stack Testing framework API ● TDD ● BDD Main frameworks ● Mocha ● Jasmine ● describe o skip o only ● it ● before(done) ● after(done) ● beforeEach ● afterEach
  • 10. Unit testing stack Assertion libraries Chai ● Plugins ● Supports should and expect style Should ● expect(foo).to.deep. equal(someNested Array) ● should.exist(foo) ● foo.bar.should.have .property(‘bar’)
  • 11. Unit testing stack Plugins for chai ● Allows you to write tests in terms of libraries you are using ● Syntactic sugar ● Sinon.js ● jQuery ● Backbone ● Q
  • 13. End-2-end testing Protractor (previously angular-scenario): ● Access to angular scope from view ● Selectors for directives ● Uses selenium ● by. o id o css o model o binding ● element o sendKeys o setPosition o setSize
  • 15. Reporting ● jUnit XML - Jenkins love it ● Progress, Dots - for console lovers ● Coverage - objective metrics ● jUnit is has better support of Jasmine ● Coverage settings - include all sources not tests
  • 17.
  • 18. Sample angular app testing beforeEach(inject(function ($controller, $rootScope) { scope = $rootScope.$new(); GamesCtrl = $controller('HotelsCtrl', { $scope: scope, Hotels: factory }); })); it('should set default value for orderProp', function () { expect(scope.orderProp).toBe('title'); }); it('should have a List of Hotels', function () { expect(scope.games.length).toBe(2); expect(scope.games[0].title).toBe('Hilton'); expect(scope.games[1].freeRooms).toBe(10); });
  • 20. Mocking of data providers Faker.js ● id’s ● names, emails ● cities, locations ● messages, sentences, paragraphs Sinon.js ● Mocking API using sinon.mock(API)
  • 21. Sample code //Hotels data 'use strict'; var Faker = require('Faker'); function generateOne() { return { name: Faker.random.bk_noun(), address: Faker.Addresses.streetAddress(), capacity: { standard: Faker.helpers.randomNumber(100), economy: Faker.helpers.randomNumber(100), luxury: Faker.helpers.randomNumber(100) } }; } module.exports.generateOne = generateOne; module.exports.generateMany = function (count) { var result = []; for (var i = 0; i < count; i++) { result.push(generateOne()) } return result; }
  • 22. Database mapping testing 1. No need to test mongoose API 2. Create stub data using Faker API and predefined JSON 3. Insert it into DB inside before callback 4. Run unit test suites on test data 5. Remove data from DB inside after callback
  • 23. Sample code var fixtures = require('fixtures.js'); var api = require('api/'); var expect = require('chai').expect; var COUNT = 100; describe('Booking API', function () { describe('#search', function () { before(function (done) { fixtures.prepareData('hotels', COUNT, done); }); it('should return all hotes if no query params provided', function (done) {api.search('hotels', function (err, data) { expect(err).to.be.null; expect(data).to.be.an('object'); expect(data.length).to.be.eql(COUNT); done(); …. after(function (done) { fixtures.destroyData('hotels');
  • 24. Alternatives ● https://github.com/petejkim/factory-lady ● http://chaijs.com/plugins/chai-factories ● https://www.npmjs.com/package/rosie
  • 25. Fixtures Rules 1. Do not hardcode the id’s and data that is generated by database 2. Put all domain specific data into fixtures, group them by collections 3. Do not put null to client API object. Use dummy object instead.
  • 26. Sample code // Fixtures var async = require('async'); var hotelsData = require('./hotelsData'); var Hotel = require('./hotelModel'); module.exports.prepareData = function (name, count, cb) { if (name !== 'hotels') { cb(new Error('Invalid data type')); return; } async.forEach(hotelsData.generateMany(count), function (item, callback) { var hotel = Hotel.createNew(item); hotel.save(callback); }, cb) }
  • 27. Sample code var client = null; function notInitializedThrow () {throw new Error ('Client not initialized')}; module.exports.init = function (config, cb) { if (client === null) { client = API.createClient(config); // doing some initializations tuff client.on('error', cb); client.on('connected', cb.bind(this, null)); } } module.exports.getClient = function () { if (client === null) { return { method1: notInitializedThrow, method2: notInitializedThrow } } else { return client; } }
  • 28. Essentials 1. Test should not depend on each others results 2. They should not use shared data (only in read only mode) 3. Do not allow skipped tests in releases 4. Tests are not just for make it green
  • 29. Integration tests 1. They are checking of how modules are working together 2. Ideal for checking of entity lifecycle - creation, linking to others, api calls, querying, destroying 3. Execution environment should be configurable
  • 30.
  • 31.
  • 32. References Tools: ● WS: o WebSocket API client ● HTTP: o Nock Article: ● https://davidbeath.com/posts/testing-http-responses-in-nodejs. html
  • 33. Stack 1. Mocha as core framework 2. Chai / Expect as assertions 3. Request.js for HTTP requests 4. node-websocket as ws client 5. Faker or factory-lady for generation of test data
  • 34. Best 1. To put grunt test or test command as git merge to master hook 2. To put shortcut for testing into npm test assuming that grunt is not globally installed 3. JSHint/JSLint as pre commit hook
  • 35. Worst 1. To mix TDD and BDD a. TDD: Suite, test, step, setup, done b. BDD: Expectations, asserts 2. To spaghetti the dependencies inside test code
  • 36. Sample code describe('API method', function () { var temporaryData = null; it('should do one thing', function (done) { var result = API.call('somemethod'); temporaryData = API.call('anotherMethod'); expect(result).to.have.keys(['code', 'details', 'message']); }); it('should do another thing', function (done) { API.call('setup', temporaryData); var result = API.call('anotherMethod'); expect(result).to.be.null;
  • 37. Pitfalls 1. Separated environment for integration testing, unit testing development and production 2. Do not rely on synchronous operations especially when they are not (callbacks, initialization process) 3. Extra console.log’s are breaking unit test reportings
  • 38. Sample code describe('Service API', function () { before(function (done) { thirdparty1.init(/*callback?*/); thirdparty2.init(/*callback?*/); thirdparty3.init(/*callback?*/); done(); }); before(function (done) { thirdparty1.done(/*callback?*/); thirdparty2.done(/*callback?*/); thirdparty3.done(/*callback?*/); done(); }); }); describe('Service API', function () { before(function (done) { async.waterfall([ thirdparty1.init, thirdparty2.init, thirdparty3.init ], done); }); before(function (done) { async.waterfall([ thirdparty1.done, thirdparty2.done, thirdparty3.done ], done); }); });
  • 39. References Books 1. Testable Javascript book 2. JavaScript Allongé 3. Testing with CoffeeScript Articles/Blogs: 1. Full spectrum testing with angular.js and Karma 2. Cross-browser testing on multiple devices 3. Mocha + CoffeeScript tutorial 4. http://code.tutsplus.com/tutorials/testing-in-nodejs--net-35018
  • 40. Tools 1. Node version manager 2. Mocha 3. Jasmine 4. Karma 5. Istanbul 6. Protractor 7. Selenium
  • 41. QA