SlideShare una empresa de Scribd logo
1 de 45
UI Testing
An unexpected Journey
Oren Farhi
JS Engineer (2006)
JS Group Leader @Tikal
Speaker (Israel & World Wide)
github.com/orizens
orizens.com
JSes6
B
Outline
1. What is UI testing
2. Why Should I Test UI
3. Hands On & Best Practices Patterns
a. Unit Testing
b. End To End Tests (E2E)
Demo App: Echoes Player
http://echotu.be (available as a chrome app)
github.com/orizens/echoes/tree/angular
What is UI Testing
perspective
UI Testing - Who Should Give a $#%&?
developer product end user qa / testers
Why Should I Test UI?
Why ?
In The Past...
1. Getting Requirements
2. Started writing code
3. now the cycle begins:
Save Code
Go To Browser & Refresh
Open Debugger
Automating The Debug Process
1. Add some “watches”
2. Add some “truthy” watches
3. Refresh
4. Try some other input
5. Repeat the “clicks”, “enter”, “keys” in
input
6. Refresh...
debugging, checking and repeating this process each time makes me go: ‘ahhhh’
I Should Write Test For UI
Because:
4 reasons
We’ve been doing that from the
beginning (maybe not with code)
Absence of Human Testers For Every Step
Automate the Dev & Tests Process
“Can You Make Sure Everything works?”
A UI Test = expecting something to be
What do we check anyway?
1. I expect something to be with a value
2. I expect something to be visible on the
DOM
3. I expect that click will change the search
4. I expect that a right click will show a
context menu, with user permissions
visible
5. I expect “<grid model=”items”>” to
render a data table in the DOM
Tools For Testing JS
Jasmine, Karma, phantom
What Is Jasmine.js
bdd js testing framework for testing js
Jasmine.js
by Pivotal
it’s a Standalone
BDD framework
for testing JS code
available on
github
1. Suites - describe()
2. Specs - it()
3. Expectations - expect()
4. Matchers - .not/.toBe()
● Spies
● Stubs
● Async
● skip tests - xit, xdescribe
Jasmine Syntax - BDD Style
describe('Gandalf the Gray', function () {
it("should stop balrog passing the bridge", function() {});
it("should save the hobbits when in danger", function() {});
})
What Is Karma Test Runner
automate: running tests, ci (jenkins, teamcity..),
multiple browsers, by angularjs team
Phantom.js - Headless Webkit
scriptable browser: includes js, DOM, routing etc..
Showtime 1 - Dropdown
testing dropdown directive in angular
Testing a Bootstrap Dropdown
<e-dropdown label="Preset"
items="presets"
on-select="onPresetChange(item)"
icon="tag"
></e-dropdown>
HTML - container rendered
it('should render a dropdown element', function () {
expect(element.hasClass('dropdown')).toBeTruthy();
});
<e-dropdown label="Preset"
items="presets"
on-select="onPresetChange(item)"
icon="tag"
></e-dropdown>
HTML - items rendered
it("should render items if given presets", function() {
expect(
element.find('ul li').length)
.toBe(
scope.presets.length
);
});
<e-dropdown label="Preset"
items="presets"
on-select="onPresetChange(item)"
icon="tag"
></e-dropdown>
HTML - Content is rendered
it("should render the label according to the 'label' attribute",
function() {
expect(
element.find('.dropdown-toggle').text().trim())
.toBe('Preset')
});
<e-dropdown label="Preset"
items="presets"
on-select="onPresetChange(item)"
icon="tag"
></e-dropdown>
Functionality - function called on clicked
it("should call a function when select has changed",function() {
spyOn(scope, 'onPresetChange');
element.isolateScope().handleClick(scope.presets[0]);
expect(scope.onPresetChange).toHaveBeenCalled();
});
<e-dropdown label="Preset"
items="presets"
on-select="onPresetChange(item)"
icon="tag"
></e-dropdown>
Functionality using Spy - click
it("should call a function with the selected item when select
has changed", function() {
spyOn(scope, 'onPresetChange');
element.isolateScope().handleClick(scope.presets[0]);
expect(scope.onPresetChange).toHaveBeenCalledWith(scope.presets
[0]);
});
<e-dropdown label="Preset"
items="presets"
on-select="onPresetChange(item)"
icon="tag"
></e-dropdown>
Showtime #2 - Testing Ajax
mocks and stubs using angularjs services
Preparing Mocks
var mockData = window.mocks[‘video.items.mock’];
var url = /.+search.*/
karma-json-fixtures-preprocessor
add to json paths to configuration of:
files: [ '../tests/mocks/**/*mock.json' ]
preprocessor: {
'../tests/mocks/**/*mock.json': ['json_fixtures']
}
Functionality using Spy and Fake
it("set the feed type when changed in YoutubeSearch and perform
search", function(){
httpBackend.whenGET(url).respond(mockData);
spyOn(scope, 'searchYoutube').and.returnValue('done')
spyOn(YoutubeSearchSrv, 'setType').and.callFake(function(){
return 'set';
});
rootScope.$broadcast('feed-type-changed', 'playlist');
scope.$digest();
expect(YoutubeSearchSrv.setType).toHaveBeenCalled();
expect(YoutubeSearchSrv.setType.calls.count()).toEqual(1);
expect(scope.searchYoutube).toHaveBeenCalled();
expect(scope.searchYoutube.calls.count()).toEqual(1);
})
Testing Ajax
stubs & mocks
Mocking Ajax Call
describe("Media Info :", function() {...})
it("should update the video's title when video has changed",
function() {
var video = mockMediaInfoItems.items[0];
httpBackend.whenGET(/.+videos.*/).respond(mockMediaInfo);
YoutubePlayerSettings.playVideoId(video);
scope.$apply();
expect(scope.vm.video.title).toEqual(video.snippet.title);
});
End to End Testing (E2E)
towards the rest of the world
What is E2E
tests few pieces together
regarding ui:
web ui = > rest of the world
E2E for JS
for angular.js
JS syntax
all browsers
for any js app
Gherkin syntax
all browsers
E2E with Pioneer.js
Feature: Simple Feature
Background:
Given I visit Echoes Player
Scenario: Entering Information
When I search for "alice in chains live"
Then I should see 50 results
PioneerJS “When” Example
this.When(/^I search for "([^"]*)"$/, function(value){
var MediaSearch = this.Widget.extend({
root: "#media-search",
setSearchQuery: function (val) {
return this.fill(val);
}
})
var search = new MediaSearch();
return this.driver.sleep(10000).then(function(){
search.sendKeys('', Driver.Key.ENTER).then(function(){
search.setSearchQuery(value);
return search.sendKeys(Driver.Key.ENTER);
});
});
});
So - What are the benefits?
Show me the money
What is Good with UI Unit Testing
● Adding Features won’t break code’s
behaviour
● promotes writing modular logics
● Forces writing high quality code -
decoupling
● documentation - code intention &
functional behavior
The End
Q & A

Más contenido relacionado

La actualidad más candente

Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Codemotion
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: DemystifiedSeth McLaughlin
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web ApplicationsSeth McLaughlin
 
Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016
Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016
Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016Oren Rubin
 
Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Mehdi Khalili
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend TestingNeil Crosby
 
Angular UI Testing with Protractor
Angular UI Testing with ProtractorAngular UI Testing with Protractor
Angular UI Testing with ProtractorAndrew Eisenberg
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Andrew Eisenberg
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Joe Ferguson
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Cogapp
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application TestingYnon Perek
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011Nicholas Zakas
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Abhijeet Vaikar
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing AutomationAgileEngine
 
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCUI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCJim Lane
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
Front-end Automated Testing
Front-end Automated TestingFront-end Automated Testing
Front-end Automated TestingRuben Teijeiro
 
Building testable chrome extensions
Building testable chrome extensionsBuilding testable chrome extensions
Building testable chrome extensionsSeth McLaughlin
 

La actualidad más candente (20)

Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
 
Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016
Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016
Statistical Element Locator by Oren Rubin - SeleniumConf UK 2016
 
Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
Angular UI Testing with Protractor
Angular UI Testing with ProtractorAngular UI Testing with Protractor
Angular UI Testing with Protractor
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application Testing
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing Automation
 
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCUI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
Front-end Automated Testing
Front-end Automated TestingFront-end Automated Testing
Front-end Automated Testing
 
Building testable chrome extensions
Building testable chrome extensionsBuilding testable chrome extensions
Building testable chrome extensions
 

Destacado

User Interface Testing | Best Practices
User Interface Testing | Best Practices User Interface Testing | Best Practices
User Interface Testing | Best Practices David Tzemach
 
Testing the User Interface - Coded UI Tests with Visual Studio 2010
Testing the User Interface - Coded UI Tests with Visual Studio 2010Testing the User Interface - Coded UI Tests with Visual Studio 2010
Testing the User Interface - Coded UI Tests with Visual Studio 2010Eric D. Boyd
 
GSF - The UI / UX Design philosphy
GSF - The UI / UX Design philosphyGSF - The UI / UX Design philosphy
GSF - The UI / UX Design philosphyZariyaa Consulting
 
Introducción a la programación y la informática. Tema 5
Introducción a la programación y la informática. Tema 5Introducción a la programación y la informática. Tema 5
Introducción a la programación y la informática. Tema 5Andres Garcia Garcia
 
Introducción a la programación y la informática. Tema 8
Introducción a la programación y la informática. Tema 8Introducción a la programación y la informática. Tema 8
Introducción a la programación y la informática. Tema 8Andres Garcia Garcia
 
Introducción a la programación y la informática. Tema 6
Introducción a la programación y la informática. Tema 6Introducción a la programación y la informática. Tema 6
Introducción a la programación y la informática. Tema 6Andres Garcia Garcia
 
Introducción a la programación y la informática. Tema 4
Introducción a la programación y la informática. Tema 4Introducción a la programación y la informática. Tema 4
Introducción a la programación y la informática. Tema 4Andres Garcia Garcia
 
Introducción a la programación y la informática. Tema 9
Introducción a la programación y la informática. Tema 9Introducción a la programación y la informática. Tema 9
Introducción a la programación y la informática. Tema 9Andres Garcia Garcia
 
Introducción a la programación y la informática. Tema 7
Introducción a la programación y la informática. Tema 7Introducción a la programación y la informática. Tema 7
Introducción a la programación y la informática. Tema 7Andres Garcia Garcia
 
Introducción a la programación y la informática. Tema 2
Introducción a la programación y la informática. Tema 2Introducción a la programación y la informática. Tema 2
Introducción a la programación y la informática. Tema 2Andres Garcia Garcia
 
Combining Methods: Web Analytics and User Testing
Combining Methods: Web Analytics and User TestingCombining Methods: Web Analytics and User Testing
Combining Methods: Web Analytics and User TestingUser Intelligence
 
Testing responsive web design pdf
Testing responsive web design pdfTesting responsive web design pdf
Testing responsive web design pdfcrilusi
 
UX Design Testing Battle School - ISL
UX Design Testing Battle School - ISLUX Design Testing Battle School - ISL
UX Design Testing Battle School - ISLEric Shutt
 
UI Testing with Earl Grey
UI Testing with Earl GreyUI Testing with Earl Grey
UI Testing with Earl GreyShyam Bhat
 
Introducción a la programación y la informática. Tema 3
Introducción a la programación y la informática. Tema 3Introducción a la programación y la informática. Tema 3
Introducción a la programación y la informática. Tema 3Andres Garcia Garcia
 
The evolution of agile development process
The evolution of agile development processThe evolution of agile development process
The evolution of agile development processDavid Tzemach
 
Visual Regression Testing
Visual Regression TestingVisual Regression Testing
Visual Regression TestingVodqaBLR
 
All you need to know about regression testing | David Tzemach
All you need to know about regression testing | David TzemachAll you need to know about regression testing | David Tzemach
All you need to know about regression testing | David TzemachDavid Tzemach
 

Destacado (20)

User Interface Testing | Best Practices
User Interface Testing | Best Practices User Interface Testing | Best Practices
User Interface Testing | Best Practices
 
Testing the User Interface - Coded UI Tests with Visual Studio 2010
Testing the User Interface - Coded UI Tests with Visual Studio 2010Testing the User Interface - Coded UI Tests with Visual Studio 2010
Testing the User Interface - Coded UI Tests with Visual Studio 2010
 
Agile scrum roles
Agile scrum rolesAgile scrum roles
Agile scrum roles
 
GSF - The UI / UX Design philosphy
GSF - The UI / UX Design philosphyGSF - The UI / UX Design philosphy
GSF - The UI / UX Design philosphy
 
Introducción a la programación y la informática. Tema 5
Introducción a la programación y la informática. Tema 5Introducción a la programación y la informática. Tema 5
Introducción a la programación y la informática. Tema 5
 
Introducción a la programación y la informática. Tema 8
Introducción a la programación y la informática. Tema 8Introducción a la programación y la informática. Tema 8
Introducción a la programación y la informática. Tema 8
 
Introducción a la programación y la informática. Tema 6
Introducción a la programación y la informática. Tema 6Introducción a la programación y la informática. Tema 6
Introducción a la programación y la informática. Tema 6
 
Introducción a la programación y la informática. Tema 4
Introducción a la programación y la informática. Tema 4Introducción a la programación y la informática. Tema 4
Introducción a la programación y la informática. Tema 4
 
Introducción a la programación y la informática. Tema 9
Introducción a la programación y la informática. Tema 9Introducción a la programación y la informática. Tema 9
Introducción a la programación y la informática. Tema 9
 
Introducción a la programación y la informática. Tema 7
Introducción a la programación y la informática. Tema 7Introducción a la programación y la informática. Tema 7
Introducción a la programación y la informática. Tema 7
 
Introducción a la programación y la informática. Tema 2
Introducción a la programación y la informática. Tema 2Introducción a la programación y la informática. Tema 2
Introducción a la programación y la informática. Tema 2
 
Combining Methods: Web Analytics and User Testing
Combining Methods: Web Analytics and User TestingCombining Methods: Web Analytics and User Testing
Combining Methods: Web Analytics and User Testing
 
Testing responsive web design pdf
Testing responsive web design pdfTesting responsive web design pdf
Testing responsive web design pdf
 
UX Design Testing Battle School - ISL
UX Design Testing Battle School - ISLUX Design Testing Battle School - ISL
UX Design Testing Battle School - ISL
 
UI Testing with Earl Grey
UI Testing with Earl GreyUI Testing with Earl Grey
UI Testing with Earl Grey
 
Introducción a la programación y la informática. Tema 3
Introducción a la programación y la informática. Tema 3Introducción a la programación y la informática. Tema 3
Introducción a la programación y la informática. Tema 3
 
Ui BDD Testing
Ui BDD TestingUi BDD Testing
Ui BDD Testing
 
The evolution of agile development process
The evolution of agile development processThe evolution of agile development process
The evolution of agile development process
 
Visual Regression Testing
Visual Regression TestingVisual Regression Testing
Visual Regression Testing
 
All you need to know about regression testing | David Tzemach
All you need to know about regression testing | David TzemachAll you need to know about regression testing | David Tzemach
All you need to know about regression testing | David Tzemach
 

Similar a UI Testing Best Practices - An Expected Journey

Security testing of YUI powered applications
Security testing of YUI powered applicationsSecurity testing of YUI powered applications
Security testing of YUI powered applicationsdimisec
 
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
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testingMats Bryntse
 
E2E testing con nightwatch.js - Drupalcamp Spain 2018
E2E testing con nightwatch.js  - Drupalcamp Spain 2018E2E testing con nightwatch.js  - Drupalcamp Spain 2018
E2E testing con nightwatch.js - Drupalcamp Spain 2018Salvador Molina (Slv_)
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testingpleeps
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - Ortus Solutions, Corp
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION APIGavin Pickin
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with exampleshadabgilani
 
Unit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsUnit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsYnon Perek
 
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...Learnosity
 
jQuery Bay Area Conference 2010
jQuery Bay Area Conference 2010jQuery Bay Area Conference 2010
jQuery Bay Area Conference 2010mennovanslooten
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciollaAndrea Paciolla
 
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
 

Similar a UI Testing Best Practices - An Expected Journey (20)

Security testing of YUI powered applications
Security testing of YUI powered applicationsSecurity testing of YUI powered applications
Security testing of YUI powered applications
 
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
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testing
 
Full Stack Unit Testing
Full Stack Unit TestingFull Stack Unit Testing
Full Stack Unit Testing
 
E2E testing con nightwatch.js - Drupalcamp Spain 2018
E2E testing con nightwatch.js  - Drupalcamp Spain 2018E2E testing con nightwatch.js  - Drupalcamp Spain 2018
E2E testing con nightwatch.js - Drupalcamp Spain 2018
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Browser testing with nightwatch.js
Browser testing with nightwatch.jsBrowser testing with nightwatch.js
Browser testing with nightwatch.js
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
Unit Testing JavaScript Applications
Unit Testing JavaScript ApplicationsUnit Testing JavaScript Applications
Unit Testing JavaScript Applications
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
 
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
 
jQuery Bay Area Conference 2010
jQuery Bay Area Conference 2010jQuery Bay Area Conference 2010
jQuery Bay Area Conference 2010
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
 
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
 

Último

On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.CarlotaBedoya1
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.soniya singh
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 

Último (20)

(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 

UI Testing Best Practices - An Expected Journey

  • 2. Oren Farhi JS Engineer (2006) JS Group Leader @Tikal Speaker (Israel & World Wide) github.com/orizens orizens.com JSes6 B
  • 3. Outline 1. What is UI testing 2. Why Should I Test UI 3. Hands On & Best Practices Patterns a. Unit Testing b. End To End Tests (E2E)
  • 4. Demo App: Echoes Player http://echotu.be (available as a chrome app) github.com/orizens/echoes/tree/angular
  • 5. What is UI Testing perspective
  • 6. UI Testing - Who Should Give a $#%&? developer product end user qa / testers
  • 7. Why Should I Test UI? Why ?
  • 8. In The Past... 1. Getting Requirements 2. Started writing code 3. now the cycle begins:
  • 10. Go To Browser & Refresh
  • 12. Automating The Debug Process 1. Add some “watches” 2. Add some “truthy” watches 3. Refresh 4. Try some other input 5. Repeat the “clicks”, “enter”, “keys” in input 6. Refresh...
  • 13. debugging, checking and repeating this process each time makes me go: ‘ahhhh’
  • 14. I Should Write Test For UI Because: 4 reasons
  • 15. We’ve been doing that from the beginning (maybe not with code)
  • 16. Absence of Human Testers For Every Step
  • 17. Automate the Dev & Tests Process
  • 18. “Can You Make Sure Everything works?”
  • 19. A UI Test = expecting something to be What do we check anyway? 1. I expect something to be with a value 2. I expect something to be visible on the DOM 3. I expect that click will change the search 4. I expect that a right click will show a context menu, with user permissions visible 5. I expect “<grid model=”items”>” to render a data table in the DOM
  • 20. Tools For Testing JS Jasmine, Karma, phantom
  • 21. What Is Jasmine.js bdd js testing framework for testing js
  • 22. Jasmine.js by Pivotal it’s a Standalone BDD framework for testing JS code available on github 1. Suites - describe() 2. Specs - it() 3. Expectations - expect() 4. Matchers - .not/.toBe() ● Spies ● Stubs ● Async ● skip tests - xit, xdescribe
  • 23. Jasmine Syntax - BDD Style describe('Gandalf the Gray', function () { it("should stop balrog passing the bridge", function() {}); it("should save the hobbits when in danger", function() {}); })
  • 24. What Is Karma Test Runner automate: running tests, ci (jenkins, teamcity..), multiple browsers, by angularjs team
  • 25. Phantom.js - Headless Webkit scriptable browser: includes js, DOM, routing etc..
  • 26. Showtime 1 - Dropdown testing dropdown directive in angular
  • 27. Testing a Bootstrap Dropdown <e-dropdown label="Preset" items="presets" on-select="onPresetChange(item)" icon="tag" ></e-dropdown>
  • 28. HTML - container rendered it('should render a dropdown element', function () { expect(element.hasClass('dropdown')).toBeTruthy(); }); <e-dropdown label="Preset" items="presets" on-select="onPresetChange(item)" icon="tag" ></e-dropdown>
  • 29. HTML - items rendered it("should render items if given presets", function() { expect( element.find('ul li').length) .toBe( scope.presets.length ); }); <e-dropdown label="Preset" items="presets" on-select="onPresetChange(item)" icon="tag" ></e-dropdown>
  • 30. HTML - Content is rendered it("should render the label according to the 'label' attribute", function() { expect( element.find('.dropdown-toggle').text().trim()) .toBe('Preset') }); <e-dropdown label="Preset" items="presets" on-select="onPresetChange(item)" icon="tag" ></e-dropdown>
  • 31. Functionality - function called on clicked it("should call a function when select has changed",function() { spyOn(scope, 'onPresetChange'); element.isolateScope().handleClick(scope.presets[0]); expect(scope.onPresetChange).toHaveBeenCalled(); }); <e-dropdown label="Preset" items="presets" on-select="onPresetChange(item)" icon="tag" ></e-dropdown>
  • 32. Functionality using Spy - click it("should call a function with the selected item when select has changed", function() { spyOn(scope, 'onPresetChange'); element.isolateScope().handleClick(scope.presets[0]); expect(scope.onPresetChange).toHaveBeenCalledWith(scope.presets [0]); }); <e-dropdown label="Preset" items="presets" on-select="onPresetChange(item)" icon="tag" ></e-dropdown>
  • 33. Showtime #2 - Testing Ajax mocks and stubs using angularjs services
  • 34. Preparing Mocks var mockData = window.mocks[‘video.items.mock’]; var url = /.+search.*/ karma-json-fixtures-preprocessor add to json paths to configuration of: files: [ '../tests/mocks/**/*mock.json' ] preprocessor: { '../tests/mocks/**/*mock.json': ['json_fixtures'] }
  • 35. Functionality using Spy and Fake it("set the feed type when changed in YoutubeSearch and perform search", function(){ httpBackend.whenGET(url).respond(mockData); spyOn(scope, 'searchYoutube').and.returnValue('done') spyOn(YoutubeSearchSrv, 'setType').and.callFake(function(){ return 'set'; }); rootScope.$broadcast('feed-type-changed', 'playlist'); scope.$digest(); expect(YoutubeSearchSrv.setType).toHaveBeenCalled(); expect(YoutubeSearchSrv.setType.calls.count()).toEqual(1); expect(scope.searchYoutube).toHaveBeenCalled(); expect(scope.searchYoutube.calls.count()).toEqual(1); })
  • 37. Mocking Ajax Call describe("Media Info :", function() {...}) it("should update the video's title when video has changed", function() { var video = mockMediaInfoItems.items[0]; httpBackend.whenGET(/.+videos.*/).respond(mockMediaInfo); YoutubePlayerSettings.playVideoId(video); scope.$apply(); expect(scope.vm.video.title).toEqual(video.snippet.title); });
  • 38. End to End Testing (E2E) towards the rest of the world
  • 39. What is E2E tests few pieces together regarding ui: web ui = > rest of the world
  • 40. E2E for JS for angular.js JS syntax all browsers for any js app Gherkin syntax all browsers
  • 41. E2E with Pioneer.js Feature: Simple Feature Background: Given I visit Echoes Player Scenario: Entering Information When I search for "alice in chains live" Then I should see 50 results
  • 42. PioneerJS “When” Example this.When(/^I search for "([^"]*)"$/, function(value){ var MediaSearch = this.Widget.extend({ root: "#media-search", setSearchQuery: function (val) { return this.fill(val); } }) var search = new MediaSearch(); return this.driver.sleep(10000).then(function(){ search.sendKeys('', Driver.Key.ENTER).then(function(){ search.setSearchQuery(value); return search.sendKeys(Driver.Key.ENTER); }); }); });
  • 43. So - What are the benefits? Show me the money
  • 44. What is Good with UI Unit Testing ● Adding Features won’t break code’s behaviour ● promotes writing modular logics ● Forces writing high quality code - decoupling ● documentation - code intention & functional behavior