© Fraunhofer IESE 1 © Fraunhofer IESE Isaias Silva https://www.linkedin.com/in/isaiasilva/ Introduction to the Functional Test Automation with Cucumber and Selenium
© Fraunhofer IESE 2 © Fraunhofer IESE 1. Introduction 1. Problem 2. Automation 2. BDD 3. Tools 1. Cucumber 2. Selenium 4. Demonstration Project Schedule
© Fraunhofer IESE 3 © Fraunhofer IESE Problem Absence of automation Big effort Reduced coverage of tests Big number of bugs
© Fraunhofer IESE 4 © Fraunhofer IESE Problem companies
© Fraunhofer IESE 5 © Fraunhofer IESE Proposed Solution
© Fraunhofer IESE 6 © Fraunhofer IESE Automation Test automation refers to activities and efforts that want to automate user tasks and actions with the system using specific tools that control the execution of tests and perform comparisons of actual results with expected results.
© Fraunhofer IESE 7 © Fraunhofer IESE Automation Benefits • Decreases runtime of regression tests • Ensure that planned tests run repeatedly without human intervention • Allows large and complex Test Execution to be performed manually • Optimization of resources • Free people to perform more creative tasks instead of having to perform tedious and repetitive manual tests
© Fraunhofer IESE 8 © Fraunhofer IESE Automation Strategy Create Test Cases Select Automation Test Cases Implementation Test Cases Execution of scripts Manage Refactor scripts Test report
© Fraunhofer IESE 9 © Fraunhofer IESE BDD - Behavior Driven Development
© Fraunhofer IESE 10 © Fraunhofer IESE BDD - Behavior Driven Development
© Fraunhofer IESE 11 © Fraunhofer IESE BDD - Behavior Driven Development
© Fraunhofer IESE 12 © Fraunhofer IESE BDD - Behavior Driven Development
© Fraunhofer IESE 13 © Fraunhofer IESE Tools automation
© Fraunhofer IESE 14 © Fraunhofer IESE Cucumber is a test automation tool that performs automated acceptance tests written in a behavioral-oriented development style (BDD) Cucumber allows collaboration with the intent to create a common understanding among all team members. https://cucumber.io/ Cucumber
© Fraunhofer IESE 15 © Fraunhofer IESE Cucumber Cucumber was originally created by members of the Ruby community to support the development of automated acceptance functional tests using the BDD technique Since then Cucumber has grown and been translated into several languages (Java, Ruby, JS, C # and PHP), thus allowing various developers to enjoy its advantages The BDD tests are composed and structured by keywords
© Fraunhofer IESE 16 © Fraunhofer IESE Cucumber
© Fraunhofer IESE 17 © Fraunhofer IESE Cucumber
© Fraunhofer IESE 18 © Fraunhofer IESE Cucumber
© Fraunhofer IESE 19 © Fraunhofer IESE Selenium Selenium is a set of tools for automation of web browsers. 1. Selenium IDE - Firefox plugin that allows the recording and execution of actions performed on a web page. 2. Selenium Remote Control – Allows you to run the script on more than one browser automatically 3. Selenium WebDriver – Allows you to natively emulate several browsers locally or in virtual machines by encoding
© Fraunhofer IESE 20 © Fraunhofer IESE Selenium IDE
© Fraunhofer IESE 21 © Fraunhofer IESE Selenium WebDriver
© Fraunhofer IESE 22 © Fraunhofer IESE Selenium Main commands • .get ("URL") // Go to page • .quit () // Close the browser • .getTitle () // Returns the Page Title • .findElement // Find a WebElement • .click () // Click on a WebElement • .sendKeys ("Text") // Type in a WebElement • .clear () // Clears the contents of a WebElement • .submit () // Submit a form
© Fraunhofer IESE 23 © Fraunhofer IESE Selenium
© Fraunhofer IESE 24 © Fraunhofer IESE Identifying Elements in Browser
© Fraunhofer IESE 25 © Fraunhofer IESE Identifying Elements in Browser + detail Identification by ID Ex. <Input type = "text" id = "name" /> • Identification by NAME Ex. <Textarea name = "name"> </ textarea> • CSS Identification Ex. <Button class = "btn btn-medium btn-save" /> • XPath identification Ex. // input [@ name = "cpf"] • DOM dom=document.getElementById('loginForm') (3) dom=document.forms['loginForm'] (3)
© Fraunhofer IESE 26 © Fraunhofer IESE Let's automate
© Fraunhofer IESE 27 © Fraunhofer IESE
© Fraunhofer IESE 28 © Fraunhofer IESE
© Fraunhofer IESE 29 © Fraunhofer IESE Referências

Introduction to the functional test automation with cucumber and selenium

  • 1.
    © Fraunhofer IESE 1 ©Fraunhofer IESE Isaias Silva https://www.linkedin.com/in/isaiasilva/ Introduction to the Functional Test Automation with Cucumber and Selenium
  • 2.
    © Fraunhofer IESE 2 ©Fraunhofer IESE 1. Introduction 1. Problem 2. Automation 2. BDD 3. Tools 1. Cucumber 2. Selenium 4. Demonstration Project Schedule
  • 3.
    © Fraunhofer IESE 3 ©Fraunhofer IESE Problem Absence of automation Big effort Reduced coverage of tests Big number of bugs
  • 4.
    © Fraunhofer IESE 4 ©Fraunhofer IESE Problem companies
  • 5.
    © Fraunhofer IESE 5 ©Fraunhofer IESE Proposed Solution
  • 6.
    © Fraunhofer IESE 6 ©Fraunhofer IESE Automation Test automation refers to activities and efforts that want to automate user tasks and actions with the system using specific tools that control the execution of tests and perform comparisons of actual results with expected results.
  • 7.
    © Fraunhofer IESE 7 ©Fraunhofer IESE Automation Benefits • Decreases runtime of regression tests • Ensure that planned tests run repeatedly without human intervention • Allows large and complex Test Execution to be performed manually • Optimization of resources • Free people to perform more creative tasks instead of having to perform tedious and repetitive manual tests
  • 8.
    © Fraunhofer IESE 8 ©Fraunhofer IESE Automation Strategy Create Test Cases Select Automation Test Cases Implementation Test Cases Execution of scripts Manage Refactor scripts Test report
  • 9.
    © Fraunhofer IESE 9 ©Fraunhofer IESE BDD - Behavior Driven Development
  • 10.
    © Fraunhofer IESE 10 ©Fraunhofer IESE BDD - Behavior Driven Development
  • 11.
    © Fraunhofer IESE 11 ©Fraunhofer IESE BDD - Behavior Driven Development
  • 12.
    © Fraunhofer IESE 12 ©Fraunhofer IESE BDD - Behavior Driven Development
  • 13.
    © Fraunhofer IESE 13 ©Fraunhofer IESE Tools automation
  • 14.
    © Fraunhofer IESE 14 ©Fraunhofer IESE Cucumber is a test automation tool that performs automated acceptance tests written in a behavioral-oriented development style (BDD) Cucumber allows collaboration with the intent to create a common understanding among all team members. https://cucumber.io/ Cucumber
  • 15.
    © Fraunhofer IESE 15 ©Fraunhofer IESE Cucumber Cucumber was originally created by members of the Ruby community to support the development of automated acceptance functional tests using the BDD technique Since then Cucumber has grown and been translated into several languages (Java, Ruby, JS, C # and PHP), thus allowing various developers to enjoy its advantages The BDD tests are composed and structured by keywords
  • 16.
    © Fraunhofer IESE 16 ©Fraunhofer IESE Cucumber
  • 17.
    © Fraunhofer IESE 17 ©Fraunhofer IESE Cucumber
  • 18.
    © Fraunhofer IESE 18 ©Fraunhofer IESE Cucumber
  • 19.
    © Fraunhofer IESE 19 ©Fraunhofer IESE Selenium Selenium is a set of tools for automation of web browsers. 1. Selenium IDE - Firefox plugin that allows the recording and execution of actions performed on a web page. 2. Selenium Remote Control – Allows you to run the script on more than one browser automatically 3. Selenium WebDriver – Allows you to natively emulate several browsers locally or in virtual machines by encoding
  • 20.
    © Fraunhofer IESE 20 ©Fraunhofer IESE Selenium IDE
  • 21.
    © Fraunhofer IESE 21 ©Fraunhofer IESE Selenium WebDriver
  • 22.
    © Fraunhofer IESE 22 ©Fraunhofer IESE Selenium Main commands • .get ("URL") // Go to page • .quit () // Close the browser • .getTitle () // Returns the Page Title • .findElement // Find a WebElement • .click () // Click on a WebElement • .sendKeys ("Text") // Type in a WebElement • .clear () // Clears the contents of a WebElement • .submit () // Submit a form
  • 23.
    © Fraunhofer IESE 23 ©Fraunhofer IESE Selenium
  • 24.
    © Fraunhofer IESE 24 ©Fraunhofer IESE Identifying Elements in Browser
  • 25.
    © Fraunhofer IESE 25 ©Fraunhofer IESE Identifying Elements in Browser + detail Identification by ID Ex. <Input type = "text" id = "name" /> • Identification by NAME Ex. <Textarea name = "name"> </ textarea> • CSS Identification Ex. <Button class = "btn btn-medium btn-save" /> • XPath identification Ex. // input [@ name = "cpf"] • DOM dom=document.getElementById('loginForm') (3) dom=document.forms['loginForm'] (3)
  • 26.
    © Fraunhofer IESE 26 ©Fraunhofer IESE Let's automate
  • 27.
    © Fraunhofer IESE 27 ©Fraunhofer IESE
  • 28.
    © Fraunhofer IESE 28 ©Fraunhofer IESE
  • 29.
    © Fraunhofer IESE 29 ©Fraunhofer IESE Referências

Editor's Notes

  • #4 Como implementar uma estratégia de automação de testes funcionais em uma empresa de TI, visando solucionar os problemas de grande esforço na execução de testes de regressão e cobertura de testes em cada Sprint (baseline) Ausência (Absence de automação) – é sentida no final do projeto e em cada sprint/baseline lançada onde há a necessidade de executar testes de regressão para verificar que não houve impacto/quebra em outras features e que na maioria das vezes não é realizado. Big effort (grande esforço) inicial para montar e estruturar os testes automáticos, bem como conhecimento técnico e prático da tecnologia e ferramentas Reduced cobertura (cobertura de reduzida de testes) – Identificar partes do código que ainda não foram testadas Big number bugs – Pela enorme quantidade de bugs, será que a organização focará em identificar, reportar, resolver ou bugs ou automatizar?
  • #5 Pirâmide não desejada por Mike Cohn - Mike Cohn é um dos colaboradores da invenção da metodologia de desenvolvimento de software Scrum . [1] Ele é um dos fundadores da Scrum Alliance [2] Ele é o dono da Mountain Goat Software, uma empresa que fornece treinamento em técnicas de desenvolvimento de software Scrum e Agile . https://www.mountaingoatsoftware.com/blog
  • #7 A automação de testes refere-se a atividades e esforços que desejam automatizar tarefas e ações do usuário com o sistema, usando ferramentas específicas que controlam a execução de testes e realizam comparações de resultados reais com resultados esperados.
  • #8 Diminui o tempo de execução dos testes de regressão Garantir que os testes planejados sejam executados repetidamente sem intervenção humana Permite que Execução de Teste grande e complexa seja executada manualmente Otimização de recursos Liberte as pessoas para realizar tarefas mais criativas em vez de realizar testes manuais tediosos e repetitivos
  • #10 O Behavior Driven Development (BDD) ou desenvolvimento orientado por comportamento foi inventado por Dan North no ano de 2000, quando Dan percebeu que muitas equipes tinham dificuldades de adotar e usar eficazmente o TDD, criado como uma versão melhorada do desenvolvimento orientado por testes (TDD, criado por Kent Beck). O BDD não é uma metodologia de desenvolvimento de software, tão pouco um substituto para o XP, Scrum, Kanban, OpenUP, RUP ou qualquer metodologia que o mercado atualmente oferece, mas sim, o BDD incorpora e melhora as ideias de muitas dessas metodologias, ajudando assim e tornando a vida da equipe de software mais fácil. Portanto, o BDD é um conjunto de práticas de engenharia de software projetado para ajudar as equipes a construir e entregar mais rápido software de alta qualidade.
  • #15 Pepino é uma ferramenta de automação de testes que executa testes de aceitação automatizados escritos em um estilo de desenvolvimento orientado a comportamento(BDD) Cucumber permite a colaboração com a intenção de criar um entendimento comum entre todos os membros da equipe.
  • #16 O Cucumber foi originalmente criado por membros da comunidade Ruby para apoiar o desenvolvimento de testes funcionais de aceitação automatizado utilizando a técnica BDD.  Desde então o Cucumber cresceu e foi traduzido em várias linguagens, inclusive o Java, permitindo assim que vários de desenvolvedores desfrutem de suas vantagens. Diante disso, vejamos a Figura 2, que ilustra uma visão geral do Cucumber.