SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Downloaden Sie, um offline zu lesen
Strategies for End-to-End
                            Ariya Hidayat
       Web Apps Testing
Amazon Kindle
Cloud Reader




Financial Times
Edit


       Develop


                 QA
Code Editing
Do not provoke ambiguities

Avoid silly mistakes
                        Learn better code pattern
Write readable code

                  Improve future maintenance
JavaScript Engine Building Blocks


                               Built-in objects,
                               host objects, ...    Runtime




                                 Syntax
                                  Tree
                                                     Virtual
  Source         Parser                             Machine/
                                                   Interpreter
                  Fast and
                conservative
Parsing Stage

                        identifier           number


                var answer = 42;
            keyword            equal sign       semicolon




                      Variable Declaration




                Identifier
                                            Literal Constant
JavaScript Parser (Written in JavaScript)




          Esprima          UglifyJS
                        Narcissus
        ZeParser
                          Traceur
            Es-Lab
Syntax Tree Visualization




  answer = 42
Style Formatter                     https://github.com/fawek/codepainter




                  Sample code




  Source          CodePainter                  Formatted source


                            Indentation
             Infer coding   Quote for string
                styles      literal
                            Whitespace
Code Outline   Eclipse




Functions
  Variables
Application Structure



Ext.define('My.sample.Person', {                Class manifest
    name: 'Mr. Unknown',
    age: 42,
                                        {
      constructor: function(name) {},       className: 'My.sample.Person',
                                            functions: ['walk', 'run'],
      walk: function(steps) {}              properties: ['name', 'age']
      run: function(steps) {}           }

});
Content Assist (aka Intellisense aka Autocomplete)

                                                                                Eclipse




   http://contraptionsforprogramming.blogspot.com/2012/02/better-javascript-content-assist-in.html
Error Tolerant

          Mismatched quote         var msg =
                                   "Hello’;


              Too many dots        person..age = 18;

                                    
        Incomplete, still typing   if (person.



                                    
                                   'use strict';
         Strict mode violation     with (person) {
                                   }
Code Linting



                      var fs = require('fs'),
 Not a strict equal       esprima = require('./esprima'),
                          files = process.argv.splice(2);
                       
                      files.forEach(function (filename) {
if (x == 9) {             var content = fs.readFileSync(filename, 'utf-8'),
  // do Something             syntax = esprima.parse(content, { loc: true });
                       
}                         JSON.stringify(syntax, function (key, value) {
                              if (key === 'test' && value.operator === '==')
                                  console.log('Line', value.loc.start.line);
                              return value;
                          });
                      });
Copy Paste Mistake




 function inside(point, rect) {
     return (point.x >= rect.x1) && (point.y >= rect.y1) &&
            (point.x <= rect.x2) && (point.y <= rect.y1);
 }
                                              Wrong
                                              check
“Boolean Trap” Finder              http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html




         Obfuscated choice    var volumeSlider = new Slider(false);




           Double-negative    component.setHidden(false);
                              filter.setCaseInsensitive(false);




Can you make up your mind?    treeItem.setState(true, false);




       The more the merrier   event.initKeyEvent("keypress", true, true,
                              null, null, false, false, false, false, 9,
                              0);
Refactoring Helper




 // Add two numbers          // Add two numbers
 function add(firt, two) {   function add(first, two) {
     return firt + two;          return first + two;
 }                           }
Syntax = Message




var Foo = (function () {
   return {                   module Foo {
     bar: function (x, y) {     export function bar (x, y) {
        // do Something           // do something
      }                         }
   };                         }
};



       ES 5.1                           Harmony
        Today                          ES 6/7, Future
Transpilation


                // Object literal property shorthand.
                function Point(x, y) {
    Harmony         return { x, y };
                }




                // Object literal property shorthand.
     ES 5.1     function Point(x, y) {
                    return { x: x, y: y };
                }
Development
Unit Test Framework




http://www.trollquotes.org/image/5-gandalf-troll-quote.jpg
Automatic Reload




     Modified source   Reload content
Remote Interaction
         http://www.sencha.com/blog/remote-javascript-debugging-on-android/




    Weinre, Adobe Shadow, Remote Web Inspector,...
Fast Smoke Test




                  Feedback
                    Cycle
Precommit Check

Typical Scenario
                            This is
                           awesome!




                      un
               t to r
          forge tests
             the




                             Git: precommit hook
    http://ariya.ofilabs.com/2012/03/git-pre-commit-hook-and-smoke-testing.html
Zombie.js



  var Browser = require("zombie");
   
  browser = new Browser();
  browser.visit("http://mobileconference.nl", function () {
      console.log(browser.text("title"));
  });
PhantomJS (Headless WebKit)


                              Paint

 Normal Browser
                     Layout           Display




                              Paint




                                      X
Headless Operation
                     Layout           Display
Screen Capture = Pixel-Perfect Comparison




      phantomjs rasterize.js URL output
CasperJS


 var casper = require('casper').create();

 casper.start('http://www.mobileconference.nl/', function() {
     this.echo('Page title is: ' + this.evaluate(function() {
         return document.title;
     }), 'INFO');
 });

 casper.run();
Postcommit Quality Metrics



                             Quality Factor 1



        Check-in

                              Quality Factor 2
Identifier Length Distribution
                                                    mean of the identifier length is 8.27 characters
                    750



                    500



                    250



                         0
                             0    5 10 15 20 25 30 35 40 45

  prototype-1.7.0.0.js       SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING
  prototype-1.7.0.0.js       MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED
       jquery-1.7.1.js       subtractsBorderForOverflowNotVisible
  jquery.mobile-1.0.js       getClosestElementWithVirtualBinding
  prototype-1.7.0.0.js       HAS_EXTENDED_CREATE_ELEMENT_SYNTAX



                                  http://ariya.ofilabs.com/2012/05/javascript-identifier-length-distribution.html
Statement Distribution

ExpressionStatement                                        6728


     BlockStatement                                      6353


          IfStatement                      3063


    ReturnStatement                       2878
                                                                var fs = require('fs'),
  VariableDeclaration              2116                             esprima = require('esprima'),
 FunctionDeclaration         371                                    files = process.argv.splice(2);
                                                                 
        ForStatement         293
                                                                files.forEach(function (filename) {
      ForInStatement        143
                                                                    var content = fs.readFileSync(filename, 'utf-8'),
      WhileStatement    131                                             syntax = esprima.parse(content);
     BreakStatement     115                                      
                                                                    JSON.stringify(syntax, function (key, value) {
        TryStatement    84
                                                                        if (key === 'type') {
    EmptyStatement      66
                                                                            if (value.match(/Declaration$/) ||
    ThrowStatement      38
                                                                                value.match(/Statement$/)) {
    SwitchStatement     35                                                          console.log(value);
 ContinueStatement      25                                                      }
                                                                        }
  DoWhileStatement      12
                                                                        return value;
   LabeledStatement     6
                                                                    });
                                                                });




                                                  http://ariya.ofilabs.com/2012/04/most-popular-javascript-statements.html
QA
Platform Proliferation
BusterJS




                              Test Suite
           Server Interface




             Test Server
Selenium



                            Firefox
            Opera          WebDriver       Chrome
           WebDriver                      WebDriver




                           WebDriver




                       WebDriver Client
Code Coverage                                 https://github.com/itay/node-cover
                                              https://github.com/coveraje/coveraje
                                              https://github.com/pmlopes/coberturajs


  x = 42;
  if (false)
      x = -1;




                http://ariya.ofilabs.com/2012/03/javascript-code-coverage-and-esprima.html
Instrumentation for Code Coverage

                                            {
                      var a = 5;
    Statement                                   __statement_ZyyqFc(1);
                                                var a = 5;
                                            }


                                            {
                                                __statement_ZyyqFc(2);
                        foo();
    Expression                                  __expression_kC$jur(3), foo();
                                            }




                                            function foo() {
                   function foo() {             __block_n53cJc(1);
     Block             ...                      ...
                   };                       }




             http://itay.github.com/snug_codecoverage_slides/
Performance via Benchmarks.js


       var suite = new Benchmark.Suite;

       suite.add('String#indexOf', function() {
          'Hello World!'.indexOf('o') > -1;
       })
       .on('complete', function() {
          console.log('Fastest is ' +
            this.filter('fastest').pluck('name'));
       })
       .run();




 JSPerf.com
Performance Baseline




                                             Baseline
     Execution time




                      Application revision
Scalability via Run-time Complexity Analysis

       Array.prototype.swap = function (i, j) {
           var k = this[i]; this[i] = this[j]; this[j] = k;
       }




 Array.prototype.swap = function (i, j) {
 Log({ name: 'Array.prototype.swap', lineNumber: 1,
 range: [23, 94] });
     var k = this[i]; this[i] = this[j]; this[j] = k;
 }




  http://ariya.ofilabs.com/2012/01/scalable-web-apps-the-complexity-issue.html
Execution Tracing
                                           4640 function calls



                                              https://gist.github.com/1823129
     jQuery Mobile startup log



        jquery.js   26    jQuery
        jquery.js  103    init                           undefined,   undefined,
 [object Object]
        jquery.js  274    each                           (Function)
        jquery.js  631    each                           [object Object],
 (Function), undefined
        jquery.js  495    isFunction                     [object Object]
        jquery.js  512    type                           [object Object]
 jquery.mobile.js 1857    [Anonymous]
 jquery.mobile.js  642    [Anonymous]
 jquery.mobile.js  624    enableMouseBindings
 jquery.mobile.js  620    disableTouchBindings




http://ariya.ofilabs.com/2012/02/tracking-javascript-execution-during-startup.html
Wrap-up
Coding style/lint, semantic outline, autocomplete,
 Edit     API usage, refactoring, better syntax




          Test framework, remote control, precommit check,
Develop   automatic reload, fast smoke testing, preflight
          metrics




          Comprehensive browser driver, code coverage,
  QA      performance baseline, execution tracking
To boldly analyze what no man has analyzed before...
Thank You



            ariya.hidayat@gmail.com



            ariya.ofilabs.com



            @AriyaHidayat

Weitere ähnliche Inhalte

Andere mochten auch

End-2-End Monitoring – Der Prüfstand jedes SLA´s – in 15 Minuten erklärt!
End-2-End Monitoring – Der Prüfstand jedes SLA´s – in 15 Minuten erklärt!End-2-End Monitoring – Der Prüfstand jedes SLA´s – in 15 Minuten erklärt!
End-2-End Monitoring – Der Prüfstand jedes SLA´s – in 15 Minuten erklärt!MAXXYS AG
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JSMichael Haberman
 
The Impact of Big Data On Marketing Analytics (UpStream Software)
The Impact of Big Data On Marketing Analytics (UpStream Software)The Impact of Big Data On Marketing Analytics (UpStream Software)
The Impact of Big Data On Marketing Analytics (UpStream Software)Revolution Analytics
 
Complex End-to-End Testing
Complex End-to-End TestingComplex End-to-End Testing
Complex End-to-End TestingErika Barron
 
End 2-end testing of mean applications
End 2-end testing of mean applicationsEnd 2-end testing of mean applications
End 2-end testing of mean applicationsMihai-Cristian Fratila
 
Implementing Test Automation: What a Manager Should Know
Implementing Test Automation: What a Manager Should KnowImplementing Test Automation: What a Manager Should Know
Implementing Test Automation: What a Manager Should KnowSoftServe
 
Session 12 Activités à venir de la CoP PSS : projet Mobilisation 2.0
Session 12 Activités à venir de la CoP PSS : projet Mobilisation 2.0Session 12 Activités à venir de la CoP PSS : projet Mobilisation 2.0
Session 12 Activités à venir de la CoP PSS : projet Mobilisation 2.0COP_HHA
 
QA Fes 2016. Gerlof Hoekstra. E2E Testing the Ministry Of Justice Biometric I...
QA Fes 2016. Gerlof Hoekstra. E2E Testing the Ministry Of Justice Biometric I...QA Fes 2016. Gerlof Hoekstra. E2E Testing the Ministry Of Justice Biometric I...
QA Fes 2016. Gerlof Hoekstra. E2E Testing the Ministry Of Justice Biometric I...QAFest
 
E2E-тестирование мобильных приложений
E2E-тестирование мобильных приложенийE2E-тестирование мобильных приложений
E2E-тестирование мобильных приложенийMoscowJS
 
test plan
test plan test plan
test plan rosh26
 
Strategic Testing (CodeMash 2016)
Strategic Testing (CodeMash 2016)Strategic Testing (CodeMash 2016)
Strategic Testing (CodeMash 2016)Dmitry Sharkov
 
End-to-End Quality Approach: 14 Levels of Testing
End-to-End Quality Approach: 14 Levels of TestingEnd-to-End Quality Approach: 14 Levels of Testing
End-to-End Quality Approach: 14 Levels of TestingJosiah Renaudin
 
End to End Test Management Test Strategy Estimation and Metrics Workshop
End to End Test Management Test Strategy Estimation and Metrics WorkshopEnd to End Test Management Test Strategy Estimation and Metrics Workshop
End to End Test Management Test Strategy Estimation and Metrics WorkshopQAAgility Technologies
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6Bert Ertman
 

Andere mochten auch (15)

End-2-End Monitoring – Der Prüfstand jedes SLA´s – in 15 Minuten erklärt!
End-2-End Monitoring – Der Prüfstand jedes SLA´s – in 15 Minuten erklärt!End-2-End Monitoring – Der Prüfstand jedes SLA´s – in 15 Minuten erklärt!
End-2-End Monitoring – Der Prüfstand jedes SLA´s – in 15 Minuten erklärt!
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JS
 
The Impact of Big Data On Marketing Analytics (UpStream Software)
The Impact of Big Data On Marketing Analytics (UpStream Software)The Impact of Big Data On Marketing Analytics (UpStream Software)
The Impact of Big Data On Marketing Analytics (UpStream Software)
 
Complex End-to-End Testing
Complex End-to-End TestingComplex End-to-End Testing
Complex End-to-End Testing
 
End 2-end testing of mean applications
End 2-end testing of mean applicationsEnd 2-end testing of mean applications
End 2-end testing of mean applications
 
Implementing Test Automation: What a Manager Should Know
Implementing Test Automation: What a Manager Should KnowImplementing Test Automation: What a Manager Should Know
Implementing Test Automation: What a Manager Should Know
 
Session 12 Activités à venir de la CoP PSS : projet Mobilisation 2.0
Session 12 Activités à venir de la CoP PSS : projet Mobilisation 2.0Session 12 Activités à venir de la CoP PSS : projet Mobilisation 2.0
Session 12 Activités à venir de la CoP PSS : projet Mobilisation 2.0
 
QA Fes 2016. Gerlof Hoekstra. E2E Testing the Ministry Of Justice Biometric I...
QA Fes 2016. Gerlof Hoekstra. E2E Testing the Ministry Of Justice Biometric I...QA Fes 2016. Gerlof Hoekstra. E2E Testing the Ministry Of Justice Biometric I...
QA Fes 2016. Gerlof Hoekstra. E2E Testing the Ministry Of Justice Biometric I...
 
E2E-тестирование мобильных приложений
E2E-тестирование мобильных приложенийE2E-тестирование мобильных приложений
E2E-тестирование мобильных приложений
 
test plan
test plan test plan
test plan
 
Strategic Testing (CodeMash 2016)
Strategic Testing (CodeMash 2016)Strategic Testing (CodeMash 2016)
Strategic Testing (CodeMash 2016)
 
End-to-End Quality Approach: 14 Levels of Testing
End-to-End Quality Approach: 14 Levels of TestingEnd-to-End Quality Approach: 14 Levels of Testing
End-to-End Quality Approach: 14 Levels of Testing
 
Test Planning_Arsala
Test Planning_ArsalaTest Planning_Arsala
Test Planning_Arsala
 
End to End Test Management Test Strategy Estimation and Metrics Workshop
End to End Test Management Test Strategy Estimation and Metrics WorkshopEnd to End Test Management Test Strategy Estimation and Metrics Workshop
End to End Test Management Test Strategy Estimation and Metrics Workshop
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
 

Mehr von Ariya Hidayat

Understanding Webkit Rendering
Understanding Webkit RenderingUnderstanding Webkit Rendering
Understanding Webkit RenderingAriya Hidayat
 
Understanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersUnderstanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersAriya Hidayat
 
Understanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersUnderstanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersAriya Hidayat
 
JavaScript Parser Infrastructure for Code Quality Analysis
JavaScript Parser Infrastructure for Code Quality AnalysisJavaScript Parser Infrastructure for Code Quality Analysis
JavaScript Parser Infrastructure for Code Quality AnalysisAriya Hidayat
 
Build HTML5 App (Intel Elements 2011)
Build HTML5 App (Intel Elements 2011)Build HTML5 App (Intel Elements 2011)
Build HTML5 App (Intel Elements 2011)Ariya Hidayat
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitAriya Hidayat
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAriya Hidayat
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitAriya Hidayat
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitAriya Hidayat
 
Efficient Graphics with Qt
Efficient Graphics with QtEfficient Graphics with Qt
Efficient Graphics with QtAriya Hidayat
 
Introduction to QtWebKit
Introduction to QtWebKitIntroduction to QtWebKit
Introduction to QtWebKitAriya Hidayat
 
Writing Tools using WebKit
Writing Tools using WebKitWriting Tools using WebKit
Writing Tools using WebKitAriya Hidayat
 

Mehr von Ariya Hidayat (12)

Understanding Webkit Rendering
Understanding Webkit RenderingUnderstanding Webkit Rendering
Understanding Webkit Rendering
 
Understanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersUnderstanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile Browsers
 
Understanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersUnderstanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile Browsers
 
JavaScript Parser Infrastructure for Code Quality Analysis
JavaScript Parser Infrastructure for Code Quality AnalysisJavaScript Parser Infrastructure for Code Quality Analysis
JavaScript Parser Infrastructure for Code Quality Analysis
 
Build HTML5 App (Intel Elements 2011)
Build HTML5 App (Intel Elements 2011)Build HTML5 App (Intel Elements 2011)
Build HTML5 App (Intel Elements 2011)
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKit
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile Web
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
 
Hybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKitHybrid Apps (Native + Web) using WebKit
Hybrid Apps (Native + Web) using WebKit
 
Efficient Graphics with Qt
Efficient Graphics with QtEfficient Graphics with Qt
Efficient Graphics with Qt
 
Introduction to QtWebKit
Introduction to QtWebKitIntroduction to QtWebKit
Introduction to QtWebKit
 
Writing Tools using WebKit
Writing Tools using WebKitWriting Tools using WebKit
Writing Tools using WebKit
 

Kürzlich hochgeladen

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 

Kürzlich hochgeladen (20)

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 

Strategies for End-to-End Web Apps Testing

  • 1. Strategies for End-to-End Ariya Hidayat Web Apps Testing
  • 3. Edit Develop QA
  • 5. Do not provoke ambiguities Avoid silly mistakes Learn better code pattern Write readable code Improve future maintenance
  • 6. JavaScript Engine Building Blocks Built-in objects, host objects, ... Runtime Syntax Tree Virtual Source Parser Machine/ Interpreter Fast and conservative
  • 7. Parsing Stage identifier number var answer = 42; keyword equal sign semicolon Variable Declaration Identifier Literal Constant
  • 8. JavaScript Parser (Written in JavaScript) Esprima UglifyJS Narcissus ZeParser Traceur Es-Lab
  • 10. Style Formatter https://github.com/fawek/codepainter Sample code Source CodePainter Formatted source Indentation Infer coding Quote for string styles literal Whitespace
  • 11. Code Outline Eclipse Functions Variables
  • 12. Application Structure Ext.define('My.sample.Person', { Class manifest name: 'Mr. Unknown',   age: 42, { constructor: function(name) {}, className: 'My.sample.Person',   functions: ['walk', 'run'], walk: function(steps) {} properties: ['name', 'age'] run: function(steps) {} } });
  • 13. Content Assist (aka Intellisense aka Autocomplete) Eclipse http://contraptionsforprogramming.blogspot.com/2012/02/better-javascript-content-assist-in.html
  • 14. Error Tolerant Mismatched quote var msg = "Hello’; Too many dots person..age = 18;   Incomplete, still typing if (person.   'use strict'; Strict mode violation with (person) { }
  • 15. Code Linting var fs = require('fs'), Not a strict equal esprima = require('./esprima'), files = process.argv.splice(2);   files.forEach(function (filename) { if (x == 9) { var content = fs.readFileSync(filename, 'utf-8'), // do Something syntax = esprima.parse(content, { loc: true });   } JSON.stringify(syntax, function (key, value) { if (key === 'test' && value.operator === '==') console.log('Line', value.loc.start.line); return value; }); });
  • 16. Copy Paste Mistake function inside(point, rect) { return (point.x >= rect.x1) && (point.y >= rect.y1) && (point.x <= rect.x2) && (point.y <= rect.y1); } Wrong check
  • 17. “Boolean Trap” Finder http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html Obfuscated choice var volumeSlider = new Slider(false); Double-negative component.setHidden(false); filter.setCaseInsensitive(false); Can you make up your mind? treeItem.setState(true, false); The more the merrier event.initKeyEvent("keypress", true, true, null, null, false, false, false, false, 9, 0);
  • 18. Refactoring Helper // Add two numbers // Add two numbers function add(firt, two) { function add(first, two) { return firt + two; return first + two; } }
  • 19. Syntax = Message var Foo = (function () { return { module Foo { bar: function (x, y) { export function bar (x, y) { // do Something // do something } } }; } }; ES 5.1 Harmony Today ES 6/7, Future
  • 20. Transpilation // Object literal property shorthand. function Point(x, y) { Harmony return { x, y }; } // Object literal property shorthand. ES 5.1 function Point(x, y) { return { x: x, y: y }; }
  • 23. Automatic Reload Modified source Reload content
  • 24. Remote Interaction http://www.sencha.com/blog/remote-javascript-debugging-on-android/ Weinre, Adobe Shadow, Remote Web Inspector,...
  • 25. Fast Smoke Test Feedback Cycle
  • 26. Precommit Check Typical Scenario This is awesome! un t to r forge tests the Git: precommit hook http://ariya.ofilabs.com/2012/03/git-pre-commit-hook-and-smoke-testing.html
  • 27. Zombie.js var Browser = require("zombie");   browser = new Browser(); browser.visit("http://mobileconference.nl", function () { console.log(browser.text("title")); });
  • 28. PhantomJS (Headless WebKit) Paint Normal Browser Layout Display Paint X Headless Operation Layout Display
  • 29. Screen Capture = Pixel-Perfect Comparison phantomjs rasterize.js URL output
  • 30. CasperJS var casper = require('casper').create(); casper.start('http://www.mobileconference.nl/', function() { this.echo('Page title is: ' + this.evaluate(function() { return document.title; }), 'INFO'); }); casper.run();
  • 31. Postcommit Quality Metrics Quality Factor 1 Check-in Quality Factor 2
  • 32. Identifier Length Distribution mean of the identifier length is 8.27 characters 750 500 250 0 0 5 10 15 20 25 30 35 40 45 prototype-1.7.0.0.js SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING prototype-1.7.0.0.js MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED jquery-1.7.1.js subtractsBorderForOverflowNotVisible jquery.mobile-1.0.js getClosestElementWithVirtualBinding prototype-1.7.0.0.js HAS_EXTENDED_CREATE_ELEMENT_SYNTAX http://ariya.ofilabs.com/2012/05/javascript-identifier-length-distribution.html
  • 33. Statement Distribution ExpressionStatement 6728 BlockStatement 6353 IfStatement 3063 ReturnStatement 2878 var fs = require('fs'), VariableDeclaration 2116 esprima = require('esprima'), FunctionDeclaration 371 files = process.argv.splice(2);   ForStatement 293 files.forEach(function (filename) { ForInStatement 143 var content = fs.readFileSync(filename, 'utf-8'), WhileStatement 131 syntax = esprima.parse(content); BreakStatement 115   JSON.stringify(syntax, function (key, value) { TryStatement 84 if (key === 'type') { EmptyStatement 66 if (value.match(/Declaration$/) || ThrowStatement 38 value.match(/Statement$/)) { SwitchStatement 35 console.log(value); ContinueStatement 25 } } DoWhileStatement 12 return value; LabeledStatement 6 }); }); http://ariya.ofilabs.com/2012/04/most-popular-javascript-statements.html
  • 34. QA
  • 36. BusterJS Test Suite Server Interface Test Server
  • 37. Selenium Firefox Opera WebDriver Chrome WebDriver WebDriver WebDriver WebDriver Client
  • 38. Code Coverage https://github.com/itay/node-cover https://github.com/coveraje/coveraje https://github.com/pmlopes/coberturajs x = 42; if (false) x = -1; http://ariya.ofilabs.com/2012/03/javascript-code-coverage-and-esprima.html
  • 39. Instrumentation for Code Coverage { var a = 5; Statement __statement_ZyyqFc(1); var a = 5; } { __statement_ZyyqFc(2); foo(); Expression __expression_kC$jur(3), foo(); } function foo() { function foo() { __block_n53cJc(1); Block ... ... }; } http://itay.github.com/snug_codecoverage_slides/
  • 40. Performance via Benchmarks.js var suite = new Benchmark.Suite; suite.add('String#indexOf', function() { 'Hello World!'.indexOf('o') > -1; }) .on('complete', function() { console.log('Fastest is ' + this.filter('fastest').pluck('name')); }) .run(); JSPerf.com
  • 41. Performance Baseline Baseline Execution time Application revision
  • 42. Scalability via Run-time Complexity Analysis Array.prototype.swap = function (i, j) { var k = this[i]; this[i] = this[j]; this[j] = k; } Array.prototype.swap = function (i, j) { Log({ name: 'Array.prototype.swap', lineNumber: 1, range: [23, 94] }); var k = this[i]; this[i] = this[j]; this[j] = k; } http://ariya.ofilabs.com/2012/01/scalable-web-apps-the-complexity-issue.html
  • 43. Execution Tracing 4640 function calls https://gist.github.com/1823129 jQuery Mobile startup log jquery.js 26 jQuery jquery.js 103 init undefined, undefined, [object Object] jquery.js 274 each (Function) jquery.js 631 each [object Object], (Function), undefined jquery.js 495 isFunction [object Object] jquery.js 512 type [object Object] jquery.mobile.js 1857 [Anonymous] jquery.mobile.js 642 [Anonymous] jquery.mobile.js 624 enableMouseBindings jquery.mobile.js 620 disableTouchBindings http://ariya.ofilabs.com/2012/02/tracking-javascript-execution-during-startup.html
  • 45. Coding style/lint, semantic outline, autocomplete, Edit API usage, refactoring, better syntax Test framework, remote control, precommit check, Develop automatic reload, fast smoke testing, preflight metrics Comprehensive browser driver, code coverage, QA performance baseline, execution tracking
  • 46. To boldly analyze what no man has analyzed before...
  • 47. Thank You ariya.hidayat@gmail.com ariya.ofilabs.com @AriyaHidayat