SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
Automated integration tests for
AJAX applications

Overview

DEVELOPER GARAGE 2012
April 17, Nizhny Novgorod
Justification

 Who is part of development team?

Who is using …
 automated integration (functional) testing
 unit-testing
 manual testing
… to track quality?

 Why or how?


                                               2
Agenda


•Motivation
•Challenges
•Solutions & tricks
•Experience
•Conclusion


                      3
Motivation – goals


•Reliability of the product at any moment
•Less time for bugs – more time for
 development
•Feel free to add new features – it’s safe




                                             4
Motivation – issues


•Manual testing is slow
•Hard to determine guilty commit




                                   5
Reliability at any moment

Worst case is:




The goal is:




                             6
Automated tests for AJAX
    web-applications




                           7
Challenges - I

•Recent framework compared to unit testing
•Full-featured container required
•New approach (API)
•Lack of tools
•Relatively faster, but …. relatively slow




                                             8
Challenges - II

•Asynchronous behavior
•Tricky to configure Hudson/Jenkins
•Complicated staging environment configuration
•Lack of experienced QA engineers




                                                 9
Solutions

Challenges
• Recent framework compared to unit testing
• Tricky to configure Hudson/Jenkins
• Lack of experienced QA engineers
Solution
• Well… Everything happens for the first time
• Research, study and teach




                                                10
Solutions

Challenges
• Complicated staging environment configuration
Solution
• Test driven application architecture – planning in advance is
  a key
• Use IoC based approach for applications




                                                                  11
Solutions

Challenge
•Requires full-featured container
•Requires new approach (API)
Solution
•Use Selenium, jWebUnit




                                    12
Solutions

Challenge
 Tools… Just few of them

Solution
 jWebUnit
  −In case of simple ajax
  −Turn off javascript if not needed (save 30 seconds)
 Selenium
  −Need to control items visibility
  −Need to test against real browser




                                                         13
Solutions


Challenge
• Relatively faster, but… relatively slow
Solution
• Still much faster than manual tests
• Define AllInOne suite for quick check
• Run full set of tests on CI
• Use distributed technologies (i.e. Selenium Grid)




                                                      14
Solutions

Challenge
• Hard to determine guilty commit
• Intend to add new features safely
Solution
• Test all before commit
- or at least -
• Email notification from CI that commit produced regression




                                                               15
Solutions



Challenge
•Asynchronous behavior
Solution
•Use wait() approach
•Use Thread.sleep() after each action
•Be aware of DOM inconsistency


                                        16
Experience


Our experience with AJAX apps
 testing:
•GWT application (100% AJAX)
 •GWTTestCase is not recommended for
  functional testing

•Regular WEB 2.0
 application

                                       17
The architecture




                            Server-side running in
                              test environment


                                        AJAX


    Test Cases           HTML + JavaScript container
     Test Cases
      Test Case              running client-side

     jUnit-style tests               Selenium, jWebUnit




                                                          18
Source code example (jWebUnit) – 1/3

public class TestShoppingCart extends BaseTest {
  @Test
  public void test() {
    beginAt("/cart/index");
    tester.assertTextPresent("Your cart is empty.");
    tester.setScriptingEnabled(true);
    beginAt("/album/list?sort=albumName&max=20");
    tester.assertElementPresentByXPath("//div[@class='list']");
    tester.assertElementPresentByXPath("//div[@id=‘c' and .='0 items']");
    tester.clickElementByXPath("//div[@class='album-
buy']/input[contains(@value,'Buy Album')]");
    tester.assertElementPresentByXPath("//div[@id=‘c' and .='1 item']");
    tester.clickElementByXPath("//div[@id='cart']//a");
    tester.assertElementPresentByXPath("//div[@id='ribbon-single-
line']/h1[contains(., 'Shopping Cart')]");




                                                                    19
Source code example (jWebUnit) – 2/3

public class TestShoppingCart extends BaseTest {
  @Test
  public void test() {
    beginAt("/cart/index");
    tester.assertTextPresent("Your cart is empty.");
    tester.setScriptingEnabled(true);
    beginAt("/album/list?sort=albumName&max=20");
    tester.assertElementPresentByXPath("//div[@class='list']");
    tester.assertElementPresentByXPath("//div[@id=‘c' and .='0 items']");
    tester.clickElementByXPath("//div[@class='album-
buy']/input[contains(@value,'Buy Album')]");
    tester.assertElementPresentByXPath("//div[@id=‘c' and .='1 item']");
    tester.clickElementByXPath("//div[@id='cart']//a");
    tester.assertElementPresentByXPath("//div[@id='ribbon-single-
line']/h1[contains(., 'Shopping Cart')]");




                                                                    20
Source code example (jWebUnit) – 3/3

public class TestShoppingCart extends BaseTest {
  @Test
  public void test() {
    beginAt("/cart/index");
    tester.assertTextPresent("Your cart is empty.");
    tester.setScriptingEnabled(true);
    beginAt("/album/list?sort=albumName&max=20");
    tester.assertElementPresentByXPath("//div[@class='list']");
    tester.assertElementPresentByXPath("//div[@id=‘c' and .='0 items']");
    tester.clickElementByXPath("//div[@class='album-
buy']/input[contains(@value,'Buy Album')]");
    tester.assertElementPresentByXPath("//div[@id=‘c' and .='1 item']");
    tester.clickElementByXPath("//div[@id='cart']//a");
    tester.assertElementPresentByXPath("//div[@id='ribbon-single-
line']/h1[contains(., 'Shopping Cart')]");




                                                                    21
Source code example (Selenium) – 1/2

public class TestManageChart extends CatalogMerchTestBase {
    @Test
    public void testManageChart() throws Throwable {
        driver.get(baseUrl + "#top.store[1].manage_charts");
        waitV("btn-add-chart”);
        WebElement elm = driver.findElement(By.id("btn-add-chart"));
        click(elm);

        Alert alert = getAlert();
        alert.sendKeys(newChartName);
        alert.dismiss();
        waitInvAjax();




                                                                       22
Source code example (Selenium) – 2/2

public class TestManageChart extends CatalogMerchTestBase {
    @Test
    public void testManageChart() throws Throwable {
        driver.get(baseUrl + "#top.store[1].manage_charts");
        waitV("btn-add-chart");
        WebElement elm = driver.findElement(By.id("btn-add-chart"));
        click(elm);

        Alert alert = getAlert();
        alert.sendKeys(newChartName);
        alert.dismiss();
        waitInvAjax();




                                                                       23
Experience

Time spent. Grouped by task type

25
20
15
10
                                   Before
  5
                                   After
  0




                                      24
Conclusion & Questions

It’s functional testing
It’s worth it!


Note:
Write code with low TCO!
Perform code review!
Don’t let user story overstep the sprint!
                                             25
Auriga At a Glance
 World leader in R&D outsourcing
    - #1 Engineering Services Outsourcing (ESO) provider
    - #15 in Top-20 Global Outsourcing Vendors
    - Global Services 100 and Global Outsourcing 100
      company
    - Top 10 Offshore Eastern and Central Europe
    - Top 10 Software R&D Service Providers
 In business since 1990
    - First in Russia to do offshore software services
 300 employees
 Headquartered in the U.S.
    - Incorporated in the U.S. in 1993
 Engineering centers in
    - Russia: Moscow, Nizhny Novgorod, Rostov-on-Don
    - EU: Vilnius, Lithuania
 Main Domains: Technologies and Verticals
    -   System Level, Embedded   -   Technology (s/w and h/w)
    -   Mobile                   -   Finance
    -   Document Management      -   Healthcare
    -   Portals                  -   Telecom
    -   Social Web               -   Logistics
    -   Media and Web            -   Government
                                 -   Security


                                                                26
Contacts




              Thank You!

      Sergey.Karpushin@auriga.com




                                    27

Más contenido relacionado

La actualidad más candente

Alliance2011 goldcoast Farid
Alliance2011 goldcoast FaridAlliance2011 goldcoast Farid
Alliance2011 goldcoast FaridFarid Vaswani
 
Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007Rabble .
 
Quickly Testing Qt Desktop Applications
Quickly Testing Qt Desktop ApplicationsQuickly Testing Qt Desktop Applications
Quickly Testing Qt Desktop ApplicationsClare Macrae
 
San Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker PresentationSan Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker PresentationClever Moe
 
Implementing Quality on a Java Project
Implementing Quality on a Java ProjectImplementing Quality on a Java Project
Implementing Quality on a Java ProjectVincent Massol
 
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Alan Richardson
 
081107 Sammy Eclipse Summit2
081107   Sammy   Eclipse Summit2081107   Sammy   Eclipse Summit2
081107 Sammy Eclipse Summit2mkempka
 
Stop (de)bugging me - ICON UK 2013
Stop (de)bugging me - ICON UK 2013Stop (de)bugging me - ICON UK 2013
Stop (de)bugging me - ICON UK 2013Mark Leusink
 
Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Steven Smith
 
Extracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails AppsExtracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails AppsJosh Nichols
 
Advanced Selenium Workshop
Advanced Selenium WorkshopAdvanced Selenium Workshop
Advanced Selenium WorkshopClever Moe
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and EasybIakiv Kramarenko
 
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)Hendrik Ebbers
 
1 aleksandr gritsevski - attd example using
1   aleksandr gritsevski - attd example using1   aleksandr gritsevski - attd example using
1 aleksandr gritsevski - attd example usingIevgenii Katsan
 
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Wolfgang Grieskamp
 
Grails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & FunctionalGrails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & Functional2Paths Solutions Ltd.
 

La actualidad más candente (20)

Alliance2011 goldcoast Farid
Alliance2011 goldcoast FaridAlliance2011 goldcoast Farid
Alliance2011 goldcoast Farid
 
Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007
 
Quickly Testing Qt Desktop Applications
Quickly Testing Qt Desktop ApplicationsQuickly Testing Qt Desktop Applications
Quickly Testing Qt Desktop Applications
 
San Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker PresentationSan Jose Selenium Meet-up PushToTest TestMaker Presentation
San Jose Selenium Meet-up PushToTest TestMaker Presentation
 
Implementing Quality on a Java Project
Implementing Quality on a Java ProjectImplementing Quality on a Java Project
Implementing Quality on a Java Project
 
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
 
081107 Sammy Eclipse Summit2
081107   Sammy   Eclipse Summit2081107   Sammy   Eclipse Summit2
081107 Sammy Eclipse Summit2
 
Stop (de)bugging me - ICON UK 2013
Stop (de)bugging me - ICON UK 2013Stop (de)bugging me - ICON UK 2013
Stop (de)bugging me - ICON UK 2013
 
JavaFX Pitfalls
JavaFX PitfallsJavaFX Pitfalls
JavaFX Pitfalls
 
Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016
 
Extracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails AppsExtracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails Apps
 
Cnc scala-presentation
Cnc scala-presentationCnc scala-presentation
Cnc scala-presentation
 
Advanced Selenium Workshop
Advanced Selenium WorkshopAdvanced Selenium Workshop
Advanced Selenium Workshop
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
 
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)
 
1 aleksandr gritsevski - attd example using
1   aleksandr gritsevski - attd example using1   aleksandr gritsevski - attd example using
1 aleksandr gritsevski - attd example using
 
Test
TestTest
Test
 
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
 
Grails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & FunctionalGrails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & Functional
 
Testing untestable code - DPC10
Testing untestable code - DPC10Testing untestable code - DPC10
Testing untestable code - DPC10
 

Similar a Automated integration tests for ajax applications (с. карпушин, auriga)

Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Fwdays
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinSigma Software
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building AndroidDroidcon Berlin
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance testBryan Liu
 
Android Unit Test
Android Unit TestAndroid Unit Test
Android Unit TestPhuoc Bui
 
Lecture (Software Testing).pptx
Lecture (Software Testing).pptxLecture (Software Testing).pptx
Lecture (Software Testing).pptxskknowledge
 
谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testabilitydrewz lin
 
Implementing quality in Java projects
Implementing quality in Java projectsImplementing quality in Java projects
Implementing quality in Java projectsVincent Massol
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...knowdiff
 
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
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Roberto Franchini
 
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!SPB SQA Group
 
Quadratisch. Praktisch. Gut. K8s-native Quality Assurance mit Testkube @ Java...
Quadratisch. Praktisch. Gut. K8s-native Quality Assurance mit Testkube @ Java...Quadratisch. Praktisch. Gut. K8s-native Quality Assurance mit Testkube @ Java...
Quadratisch. Praktisch. Gut. K8s-native Quality Assurance mit Testkube @ Java...QAware GmbH
 
6 weeks summer training in software testing,ludhiana
6 weeks summer training in software testing,ludhiana6 weeks summer training in software testing,ludhiana
6 weeks summer training in software testing,ludhianadeepikakaler1
 
6 weeks summer training in software testing,jalandhar
6 weeks summer training in software testing,jalandhar6 weeks summer training in software testing,jalandhar
6 weeks summer training in software testing,jalandhardeepikakaler1
 
6months industrial training in software testing, ludhiana
6months industrial training in software testing, ludhiana6months industrial training in software testing, ludhiana
6months industrial training in software testing, ludhianadeepikakaler1
 
6months industrial training in software testing, jalandhar
6months industrial training in software testing, jalandhar6months industrial training in software testing, jalandhar
6months industrial training in software testing, jalandhardeepikakaler1
 
Operating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud MicroservicesOperating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud MicroservicesNoriaki Tatsumi
 

Similar a Automated integration tests for ajax applications (с. карпушин, auriga) (20)

Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building Android
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance test
 
Android Unit Test
Android Unit TestAndroid Unit Test
Android Unit Test
 
Lecture (Software Testing).pptx
Lecture (Software Testing).pptxLecture (Software Testing).pptx
Lecture (Software Testing).pptx
 
Unit tests and TDD
Unit tests and TDDUnit tests and TDD
Unit tests and TDD
 
谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability
 
Implementing quality in Java projects
Implementing quality in Java projectsImplementing quality in Java projects
Implementing quality in Java projects
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
 
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
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
 
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
ITGM8. Всеволод Брекелов (Grid Dinamics) Component tests. let's do that!
 
Quadratisch. Praktisch. Gut. K8s-native Quality Assurance mit Testkube @ Java...
Quadratisch. Praktisch. Gut. K8s-native Quality Assurance mit Testkube @ Java...Quadratisch. Praktisch. Gut. K8s-native Quality Assurance mit Testkube @ Java...
Quadratisch. Praktisch. Gut. K8s-native Quality Assurance mit Testkube @ Java...
 
6 weeks summer training in software testing,ludhiana
6 weeks summer training in software testing,ludhiana6 weeks summer training in software testing,ludhiana
6 weeks summer training in software testing,ludhiana
 
6 weeks summer training in software testing,jalandhar
6 weeks summer training in software testing,jalandhar6 weeks summer training in software testing,jalandhar
6 weeks summer training in software testing,jalandhar
 
6months industrial training in software testing, ludhiana
6months industrial training in software testing, ludhiana6months industrial training in software testing, ludhiana
6months industrial training in software testing, ludhiana
 
6months industrial training in software testing, jalandhar
6months industrial training in software testing, jalandhar6months industrial training in software testing, jalandhar
6months industrial training in software testing, jalandhar
 
Operating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud MicroservicesOperating a High Velocity Large Organization with Spring Cloud Microservices
Operating a High Velocity Large Organization with Spring Cloud Microservices
 

Más de Mobile Developer Day

Dmitry Tarasov "Tarasov mobile" Chaos control
Dmitry Tarasov "Tarasov mobile" Chaos controlDmitry Tarasov "Tarasov mobile" Chaos control
Dmitry Tarasov "Tarasov mobile" Chaos controlMobile Developer Day
 
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )Mobile Developer Day
 
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )Mobile Developer Day
 
«традиционные сми как приложения»
«традиционные сми как приложения»«традиционные сми как приложения»
«традиционные сми как приложения»Mobile Developer Day
 
«Ip в мобильных играх», виктор залётов, herocraft
«Ip в мобильных играх», виктор залётов, herocraft«Ip в мобильных играх», виктор залётов, herocraft
«Ip в мобильных играх», виктор залётов, herocraftMobile Developer Day
 
«особенности проектирования I pad приложений для высших руководителей», алекс...
«особенности проектирования I pad приложений для высших руководителей», алекс...«особенности проектирования I pad приложений для высших руководителей», алекс...
«особенности проектирования I pad приложений для высших руководителей», алекс...Mobile Developer Day
 

Más de Mobile Developer Day (6)

Dmitry Tarasov "Tarasov mobile" Chaos control
Dmitry Tarasov "Tarasov mobile" Chaos controlDmitry Tarasov "Tarasov mobile" Chaos control
Dmitry Tarasov "Tarasov mobile" Chaos control
 
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
 
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
гибкий подход к тестированию ‘умных’ электронных систем.( а. вдовин, Auriga )
 
«традиционные сми как приложения»
«традиционные сми как приложения»«традиционные сми как приложения»
«традиционные сми как приложения»
 
«Ip в мобильных играх», виктор залётов, herocraft
«Ip в мобильных играх», виктор залётов, herocraft«Ip в мобильных играх», виктор залётов, herocraft
«Ip в мобильных играх», виктор залётов, herocraft
 
«особенности проектирования I pad приложений для высших руководителей», алекс...
«особенности проектирования I pad приложений для высших руководителей», алекс...«особенности проектирования I pad приложений для высших руководителей», алекс...
«особенности проектирования I pad приложений для высших руководителей», алекс...
 

Último

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
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
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
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
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
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
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
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
 
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
 
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
 

Último (20)

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
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
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
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
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
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
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
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
 
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...
 
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
 

Automated integration tests for ajax applications (с. карпушин, auriga)

  • 1. Automated integration tests for AJAX applications Overview DEVELOPER GARAGE 2012 April 17, Nizhny Novgorod
  • 2. Justification  Who is part of development team? Who is using …  automated integration (functional) testing  unit-testing  manual testing … to track quality?  Why or how? 2
  • 4. Motivation – goals •Reliability of the product at any moment •Less time for bugs – more time for development •Feel free to add new features – it’s safe 4
  • 5. Motivation – issues •Manual testing is slow •Hard to determine guilty commit 5
  • 6. Reliability at any moment Worst case is: The goal is: 6
  • 7. Automated tests for AJAX web-applications 7
  • 8. Challenges - I •Recent framework compared to unit testing •Full-featured container required •New approach (API) •Lack of tools •Relatively faster, but …. relatively slow 8
  • 9. Challenges - II •Asynchronous behavior •Tricky to configure Hudson/Jenkins •Complicated staging environment configuration •Lack of experienced QA engineers 9
  • 10. Solutions Challenges • Recent framework compared to unit testing • Tricky to configure Hudson/Jenkins • Lack of experienced QA engineers Solution • Well… Everything happens for the first time • Research, study and teach 10
  • 11. Solutions Challenges • Complicated staging environment configuration Solution • Test driven application architecture – planning in advance is a key • Use IoC based approach for applications 11
  • 12. Solutions Challenge •Requires full-featured container •Requires new approach (API) Solution •Use Selenium, jWebUnit 12
  • 13. Solutions Challenge  Tools… Just few of them Solution  jWebUnit −In case of simple ajax −Turn off javascript if not needed (save 30 seconds)  Selenium −Need to control items visibility −Need to test against real browser 13
  • 14. Solutions Challenge • Relatively faster, but… relatively slow Solution • Still much faster than manual tests • Define AllInOne suite for quick check • Run full set of tests on CI • Use distributed technologies (i.e. Selenium Grid) 14
  • 15. Solutions Challenge • Hard to determine guilty commit • Intend to add new features safely Solution • Test all before commit - or at least - • Email notification from CI that commit produced regression 15
  • 16. Solutions Challenge •Asynchronous behavior Solution •Use wait() approach •Use Thread.sleep() after each action •Be aware of DOM inconsistency 16
  • 17. Experience Our experience with AJAX apps testing: •GWT application (100% AJAX) •GWTTestCase is not recommended for functional testing •Regular WEB 2.0 application 17
  • 18. The architecture Server-side running in test environment AJAX Test Cases HTML + JavaScript container Test Cases Test Case running client-side jUnit-style tests Selenium, jWebUnit 18
  • 19. Source code example (jWebUnit) – 1/3 public class TestShoppingCart extends BaseTest { @Test public void test() { beginAt("/cart/index"); tester.assertTextPresent("Your cart is empty."); tester.setScriptingEnabled(true); beginAt("/album/list?sort=albumName&max=20"); tester.assertElementPresentByXPath("//div[@class='list']"); tester.assertElementPresentByXPath("//div[@id=‘c' and .='0 items']"); tester.clickElementByXPath("//div[@class='album- buy']/input[contains(@value,'Buy Album')]"); tester.assertElementPresentByXPath("//div[@id=‘c' and .='1 item']"); tester.clickElementByXPath("//div[@id='cart']//a"); tester.assertElementPresentByXPath("//div[@id='ribbon-single- line']/h1[contains(., 'Shopping Cart')]"); 19
  • 20. Source code example (jWebUnit) – 2/3 public class TestShoppingCart extends BaseTest { @Test public void test() { beginAt("/cart/index"); tester.assertTextPresent("Your cart is empty."); tester.setScriptingEnabled(true); beginAt("/album/list?sort=albumName&max=20"); tester.assertElementPresentByXPath("//div[@class='list']"); tester.assertElementPresentByXPath("//div[@id=‘c' and .='0 items']"); tester.clickElementByXPath("//div[@class='album- buy']/input[contains(@value,'Buy Album')]"); tester.assertElementPresentByXPath("//div[@id=‘c' and .='1 item']"); tester.clickElementByXPath("//div[@id='cart']//a"); tester.assertElementPresentByXPath("//div[@id='ribbon-single- line']/h1[contains(., 'Shopping Cart')]"); 20
  • 21. Source code example (jWebUnit) – 3/3 public class TestShoppingCart extends BaseTest { @Test public void test() { beginAt("/cart/index"); tester.assertTextPresent("Your cart is empty."); tester.setScriptingEnabled(true); beginAt("/album/list?sort=albumName&max=20"); tester.assertElementPresentByXPath("//div[@class='list']"); tester.assertElementPresentByXPath("//div[@id=‘c' and .='0 items']"); tester.clickElementByXPath("//div[@class='album- buy']/input[contains(@value,'Buy Album')]"); tester.assertElementPresentByXPath("//div[@id=‘c' and .='1 item']"); tester.clickElementByXPath("//div[@id='cart']//a"); tester.assertElementPresentByXPath("//div[@id='ribbon-single- line']/h1[contains(., 'Shopping Cart')]"); 21
  • 22. Source code example (Selenium) – 1/2 public class TestManageChart extends CatalogMerchTestBase { @Test public void testManageChart() throws Throwable { driver.get(baseUrl + "#top.store[1].manage_charts"); waitV("btn-add-chart”); WebElement elm = driver.findElement(By.id("btn-add-chart")); click(elm); Alert alert = getAlert(); alert.sendKeys(newChartName); alert.dismiss(); waitInvAjax(); 22
  • 23. Source code example (Selenium) – 2/2 public class TestManageChart extends CatalogMerchTestBase { @Test public void testManageChart() throws Throwable { driver.get(baseUrl + "#top.store[1].manage_charts"); waitV("btn-add-chart"); WebElement elm = driver.findElement(By.id("btn-add-chart")); click(elm); Alert alert = getAlert(); alert.sendKeys(newChartName); alert.dismiss(); waitInvAjax(); 23
  • 24. Experience Time spent. Grouped by task type 25 20 15 10 Before 5 After 0 24
  • 25. Conclusion & Questions It’s functional testing It’s worth it! Note: Write code with low TCO! Perform code review! Don’t let user story overstep the sprint! 25
  • 26. Auriga At a Glance  World leader in R&D outsourcing - #1 Engineering Services Outsourcing (ESO) provider - #15 in Top-20 Global Outsourcing Vendors - Global Services 100 and Global Outsourcing 100 company - Top 10 Offshore Eastern and Central Europe - Top 10 Software R&D Service Providers  In business since 1990 - First in Russia to do offshore software services  300 employees  Headquartered in the U.S. - Incorporated in the U.S. in 1993  Engineering centers in - Russia: Moscow, Nizhny Novgorod, Rostov-on-Don - EU: Vilnius, Lithuania  Main Domains: Technologies and Verticals - System Level, Embedded - Technology (s/w and h/w) - Mobile - Finance - Document Management - Healthcare - Portals - Telecom - Social Web - Logistics - Media and Web - Government - Security 26
  • 27. Contacts Thank You! Sergey.Karpushin@auriga.com 27