SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Automated testing
      testing at every stage
Exposition: characters

             • Michelle Krejci
                – a.k.a. craychee
                – a.k.a. dev_meshev



  • Promet Source
    – www.prometsource.com
Exposition: characters
                        • Selenium*
                           – a.k.a. Selenium IDE
                           – a.k.a. Selenium RC
                           – a.k.a. Selenium Webdriver


 *Actually, these are not at all the same. To wit:
 Selenium IDE = development enviroment to create scripts
 Selenium RC = Refers to Selenium 1 executable
 Selenium Webdriver = Selenium 2 executable
Exposition: characters
             • PHPUnit
               – a.k.a. the testing standard of the
                 PHP community
               – a.k.a. the successor of SimpleTest
Exposition: characters
               • Jenkins
                  – a.k.a. Hudson
                  – a.k.a. A developer‟s most
                    dependable butler
Exposition: characters
              • Chef
                – a.k.a. An opscode product
                – a.k.a. the answer to all your
                  server-configuration-related
                  prayers
Exposition: characters
              • xvfb
                – a.k.a. X virtual framer
                – a.k.a. what you need to run
                  Selenium on a headless
Exposition: characters
              • Phing
                – a.k.a. Phing Is Not GNU make
                – a.k.a. Apache Ant for PHP
                – a.k.a. a build system for PHP
                – a.k.a. what you will need to
                  run deeper regression, metric,
                  and user acceptance testing
Exposition: the setting
                        – During development
 Lots     of clicking
                        – After every update
                        – If someone somehow has the
                          time: on a regular basis as
                          part of on-going support.
Development: rising action
             The Solution: Roll Call Testing
                – Use Selenium scripts to verify that elements
                  such as ids, divs, and text are present on a
                  regular basis (e.g., after updates, during
                  development, on a regular basis)
Development: rising action
             Roll Call Tests
                – Each page gets its own test.
                – Each test must start and end at the
                  home page.
                   • Verify that all blocks and links are
                     present using the VerifyElement
                     command.
                   • Do not use “assert” or this will halt all
                     tests if element or text is not present.
Development: rising action

                                     Tools needed to write tests
                                          – Selenium IDE¹
                                          – PHPUnit bindings²
                                          – Xpath plug-in³


¹ Selenium IDE:
    –   https://addons.mozilla.org/en-
        US/firefox/addon/selenium-ide/
² PHP bindings:
    –   https://addons.mozilla.org/en-
        US/firefox/addon/selenium-ide-php-formatters/?src=ss
³ Xpath-checker add on:
    –   https://addons.mozilla.org/en-US/firefox/addon/xpath-
        checker/?src=search
Development: rising action
                       Selenium IDE
                       1.   Starting point.
                       2.   Controls
                       3.   Record actions (not needed for
                            creating roll call tests, recommend using
                            right click and select command)
                       4.   Name of tests (should be named
                            after page)
                       5.   The display
                       6.   View and edit selected
                            command
                       7.   Reference of commands
Development: rising action
                               Tools needed to run tests locally
                                     – Selenium webdriver
                                     – PHP Unit
                                     – PHP Unit Selenium Exstentions



• Installing Selenium Webdriver:
   –   http://www.danstraw.com/installing-selenium-
       server-2-as-a-service-on-ubuntu/2010/09/23/

• Installing PHP Unit & Extensions:
   –   http://www.phpunit.de/manual/current/en/install
       ation.html
Development: rising action
Start Selenium Webdriver:   In a new tab,
                            run command phpunit*:




                             *In this example, I am using a bootstrap
                             file. I have created a parent class that
                             each page extends. In the parent class, I
                             test the branding elements of each page.
Development: rising action
         Now, let‟s automate it:
Development: rising action
                Add a ruby build script:*
 #!/user/bin/env ruby

 current_dir = File.dirname(__FILE__)
 bootstrap_file = "MCMC.php” //if parent class
 build_dir = "build"

 Dir[File.join(current_dir), '*'].each do |file|
   puts file
   if file != bootstrap_file and File.file?(file)
     cmd = "phpunit --log-junit
 #{build_dir}/#{file}.selenium.xml /*--bootstrap
 #{bootstrap_file} #{file}*/"
     print cmd
     system(cmd)
   end
 end
                    *No. It does not need to be ruby.
Development: rising action
           Create a git repo:*


 $git init newrepo




                     *Yes. Use git.
Development: rising action
          Configure Jenkins Server:
            – Add xvfb
               There is a script in /root that has the commands to start the selenium service w/
               Xvfb in a script named „start_selenium.sh‟


            – Install the following plugins
               •   analysis-core
               •   Analysis-collector
               •   Checkstyle
               •   Dry
               •   Phing
               •   Plot
               •   pmd
Development: rising action
Configure Jenkins Job:
  – Specify source
Development: rising action
Configure Jenkins Job:
  – Specify triggers:
Development: rising action
Configure Jenkins Job:
  – Specify build command:
Development: rising action
Sit back and admire how clever you are:
Development:
At this point you might start thinking:
               Let‟s automate everything!
Development: falling action
                Continuous delivery*




    *image from: http://en.wikipedia.org/wiki/Continuous_delivery
Development: falling action
Test-driven dev:
  – Build tests
  – Then modules
Development: falling action
 User acceptance tests that leverage Drupal*
  abstract class DrupalTestCase extends PHPUnit_Framework_TestCase { }




                  *https://github.com/weitzman/upal
Development: falling action
     There are people working on this:
understanding




  Phpunit needs to be
  leveraged for Drupal




Drupal culture
Development: the resolution
                                  Let‟s make it work.
 •    protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post
     comments', 'skip comment approval')) {
 •     // Create a role with the given permission set.
 •     if (!($rid = $this->drupalCreateRole($permissions))) {
 •       return FALSE;
 •     }
 •     // Create a user assigned to that role.
 •     $edit = array();
 •     $edit['name'] = $this->randomName();
 •     $edit['mail'] = $edit['name'] . '@example.com';
 •     $edit['roles'] = array($rid => $rid);
 •     $edit['pass'] = user_password();
 •     $edit['status'] = 1;
 •
          $account = user_save(drupal_anonymous_user(), $edit);

 •    $this->assertTrue(!empty($account->uid), t('User created with name %name and pass
     %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login'));
 •    if (empty($account->uid)) {
 •      return FALSE;
 •    }

 •        // Add the raw password so that we can log in as this user.
 •        $account->pass_raw = $edit['pass'];
 •        return $account;
 •    }

Weitere ähnliche Inhalte

Was ist angesagt?

Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With SeleniumDeepak Mittal
 
Introduction to Selenium Webdriver - SpringPeople
Introduction to Selenium Webdriver - SpringPeopleIntroduction to Selenium Webdriver - SpringPeople
Introduction to Selenium Webdriver - SpringPeopleSpringPeople
 
Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Session on Selenium 4 : What’s coming our way? by Hitesh PrajapatiSession on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Session on Selenium 4 : What’s coming our way? by Hitesh PrajapatiAgile Testing Alliance
 
Jenkins & Selenium
Jenkins & SeleniumJenkins & Selenium
Jenkins & Seleniumadamcarmi
 
Making Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI AutomationMaking Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI AutomationRuslan Strazhnyk
 
Testing Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumTesting Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumBrian Jordan
 
Session on Launching Selenium Grid and Running tests using docker compose and...
Session on Launching Selenium Grid and Running tests using docker compose and...Session on Launching Selenium Grid and Running tests using docker compose and...
Session on Launching Selenium Grid and Running tests using docker compose and...Agile Testing Alliance
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorFlorian Fesseler
 
JavaScript Testing VIA Selenium
JavaScript Testing VIA SeleniumJavaScript Testing VIA Selenium
JavaScript Testing VIA SeleniumAdam Christian
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Smarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automationSmarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automationRIA RUI Society
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaEdureka!
 
Selenium 2: The Future of Selenium is now!
Selenium 2: The Future of Selenium is now!Selenium 2: The Future of Selenium is now!
Selenium 2: The Future of Selenium is now!AutomatedTester
 
Selenium Automation at Incapsula
Selenium Automation at IncapsulaSelenium Automation at Incapsula
Selenium Automation at Incapsulaadamcarmi
 
Selenium Java for Beginners by Sujit Pathak
Selenium Java for Beginners by Sujit PathakSelenium Java for Beginners by Sujit Pathak
Selenium Java for Beginners by Sujit PathakSoftware Testing Board
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin MishraPravin Mishra
 

Was ist angesagt? (20)

Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With Selenium
 
Introduction to Selenium Webdriver - SpringPeople
Introduction to Selenium Webdriver - SpringPeopleIntroduction to Selenium Webdriver - SpringPeople
Introduction to Selenium Webdriver - SpringPeople
 
Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Session on Selenium 4 : What’s coming our way? by Hitesh PrajapatiSession on Selenium 4 : What’s coming our way? by Hitesh Prajapati
Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati
 
Jenkins & Selenium
Jenkins & SeleniumJenkins & Selenium
Jenkins & Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Making Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI AutomationMaking Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI Automation
 
Selenium
SeleniumSelenium
Selenium
 
Testing Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumTesting Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS Curriculum
 
Session on Launching Selenium Grid and Running tests using docker compose and...
Session on Launching Selenium Grid and Running tests using docker compose and...Session on Launching Selenium Grid and Running tests using docker compose and...
Session on Launching Selenium Grid and Running tests using docker compose and...
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
JavaScript Testing VIA Selenium
JavaScript Testing VIA SeleniumJavaScript Testing VIA Selenium
JavaScript Testing VIA Selenium
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Smarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automationSmarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automation
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | Edureka
 
Selenium 2: The Future of Selenium is now!
Selenium 2: The Future of Selenium is now!Selenium 2: The Future of Selenium is now!
Selenium 2: The Future of Selenium is now!
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
Selenium Automation at Incapsula
Selenium Automation at IncapsulaSelenium Automation at Incapsula
Selenium Automation at Incapsula
 
Java selenium web driver
Java selenium web driverJava selenium web driver
Java selenium web driver
 
Selenium Java for Beginners by Sujit Pathak
Selenium Java for Beginners by Sujit PathakSelenium Java for Beginners by Sujit Pathak
Selenium Java for Beginners by Sujit Pathak
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin Mishra
 

Andere mochten auch

Scaling Drupal & Deployment in AWS
Scaling Drupal & Deployment in AWSScaling Drupal & Deployment in AWS
Scaling Drupal & Deployment in AWS永对 陈
 
Streamlining Testing with Visual Studio 2012
Streamlining Testing with Visual Studio 2012Streamlining Testing with Visual Studio 2012
Streamlining Testing with Visual Studio 2012Imaginet
 
Amazon AWS and Drupal
Amazon AWS and DrupalAmazon AWS and Drupal
Amazon AWS and Drupalpixelcat
 
Glitches bugsandimportanceofgoodprogramming
Glitches bugsandimportanceofgoodprogrammingGlitches bugsandimportanceofgoodprogramming
Glitches bugsandimportanceofgoodprogrammingSridhar Pandurangiah
 
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)DOCOMO Innovations, Inc.
 
Hong Kong Drupal User Group - Sep 13th
Hong Kong Drupal User Group - Sep 13thHong Kong Drupal User Group - Sep 13th
Hong Kong Drupal User Group - Sep 13thWong Hoi Sing Edison
 
Managing Content in Drupal with Workbench
Managing Content in Drupal with WorkbenchManaging Content in Drupal with Workbench
Managing Content in Drupal with WorkbenchAcquia
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Cogapp
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI TestingShai Raiten
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8nagpalprachi
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with CodeceptionJeremy Coates
 
PHP Codeception テスト -- 日本語
PHP Codeception テスト -- 日本語PHP Codeception テスト -- 日本語
PHP Codeception テスト -- 日本語Florent Batard
 
「スピード」と「品質」を実現するPHP開発チームの取り組み~AngularJS+FuelPHP+AspectMock~
「スピード」と「品質」を実現するPHP開発チームの取り組み~AngularJS+FuelPHP+AspectMock~「スピード」と「品質」を実現するPHP開発チームの取り組み~AngularJS+FuelPHP+AspectMock~
「スピード」と「品質」を実現するPHP開発チームの取り組み~AngularJS+FuelPHP+AspectMock~leverages_event
 
Behatで行う、E2Eテスト入門
Behatで行う、E2Eテスト入門Behatで行う、E2Eテスト入門
Behatで行う、E2Eテスト入門leverages_event
 
今、最もイケてるPHPフレームワークLaravel4
今、最もイケてるPHPフレームワークLaravel4今、最もイケてるPHPフレームワークLaravel4
今、最もイケてるPHPフレームワークLaravel4アシアル株式会社
 
「Selenium実践入門」で学ぶテスト自動化の世界
「Selenium実践入門」で学ぶテスト自動化の世界「Selenium実践入門」で学ぶテスト自動化の世界
「Selenium実践入門」で学ぶテスト自動化の世界Nozomi Ito
 
Dockerクイックツアー
DockerクイックツアーDockerクイックツアー
DockerクイックツアーEtsuji Nakai
 
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】Masahito Zembutsu
 

Andere mochten auch (20)

Scaling Drupal & Deployment in AWS
Scaling Drupal & Deployment in AWSScaling Drupal & Deployment in AWS
Scaling Drupal & Deployment in AWS
 
Streamlining Testing with Visual Studio 2012
Streamlining Testing with Visual Studio 2012Streamlining Testing with Visual Studio 2012
Streamlining Testing with Visual Studio 2012
 
Amazon AWS and Drupal
Amazon AWS and DrupalAmazon AWS and Drupal
Amazon AWS and Drupal
 
Drupal on vagrant-aws
Drupal on vagrant-awsDrupal on vagrant-aws
Drupal on vagrant-aws
 
Glitches bugsandimportanceofgoodprogramming
Glitches bugsandimportanceofgoodprogrammingGlitches bugsandimportanceofgoodprogramming
Glitches bugsandimportanceofgoodprogramming
 
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
How to Manage Your Cloud by Drupal (DrupalCon CPH 2010)
 
Hong Kong Drupal User Group - Sep 13th
Hong Kong Drupal User Group - Sep 13thHong Kong Drupal User Group - Sep 13th
Hong Kong Drupal User Group - Sep 13th
 
Managing Content in Drupal with Workbench
Managing Content in Drupal with WorkbenchManaging Content in Drupal with Workbench
Managing Content in Drupal with Workbench
 
Behat入門
Behat入門Behat入門
Behat入門
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with Codeception
 
PHP Codeception テスト -- 日本語
PHP Codeception テスト -- 日本語PHP Codeception テスト -- 日本語
PHP Codeception テスト -- 日本語
 
「スピード」と「品質」を実現するPHP開発チームの取り組み~AngularJS+FuelPHP+AspectMock~
「スピード」と「品質」を実現するPHP開発チームの取り組み~AngularJS+FuelPHP+AspectMock~「スピード」と「品質」を実現するPHP開発チームの取り組み~AngularJS+FuelPHP+AspectMock~
「スピード」と「品質」を実現するPHP開発チームの取り組み~AngularJS+FuelPHP+AspectMock~
 
Behatで行う、E2Eテスト入門
Behatで行う、E2Eテスト入門Behatで行う、E2Eテスト入門
Behatで行う、E2Eテスト入門
 
今、最もイケてるPHPフレームワークLaravel4
今、最もイケてるPHPフレームワークLaravel4今、最もイケてるPHPフレームワークLaravel4
今、最もイケてるPHPフレームワークLaravel4
 
「Selenium実践入門」で学ぶテスト自動化の世界
「Selenium実践入門」で学ぶテスト自動化の世界「Selenium実践入門」で学ぶテスト自動化の世界
「Selenium実践入門」で学ぶテスト自動化の世界
 
Dockerクイックツアー
DockerクイックツアーDockerクイックツアー
Dockerクイックツアー
 
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
 

Ähnlich wie Automated testing with Drupal

TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsTYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsMichael Lihs
 
Integration and Acceptance Testing
Integration and Acceptance TestingIntegration and Acceptance Testing
Integration and Acceptance TestingAlan Hecht
 
InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017Mandi Walls
 
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011camp_drupal_ua
 
WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!Taylor Lovett
 
Automated testing DrupalCamp in Asheville
Automated testing DrupalCamp in AshevilleAutomated testing DrupalCamp in Asheville
Automated testing DrupalCamp in AshevillePromet Source
 
Testing with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentTesting with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentMax Klymyshyn
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
Using Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityUsing Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityMandi Walls
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Amazon Web Services
 
Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflowcromwellryan
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDays Riga
 
Intro to Pentesting Jenkins
Intro to Pentesting JenkinsIntro to Pentesting Jenkins
Intro to Pentesting JenkinsBrian Hysell
 

Ähnlich wie Automated testing with Drupal (20)

Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsTYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
 
Integration and Acceptance Testing
Integration and Acceptance TestingIntegration and Acceptance Testing
Integration and Acceptance Testing
 
InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017
 
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
 
Session 2
Session 2Session 2
Session 2
 
Session 2
Session 2Session 2
Session 2
 
WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!
 
Automated testing DrupalCamp in Asheville
Automated testing DrupalCamp in AshevilleAutomated testing DrupalCamp in Asheville
Automated testing DrupalCamp in Asheville
 
Testing with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentTesting with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous Deployment
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Using Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure SecurityUsing Chef InSpec for Infrastructure Security
Using Chef InSpec for Infrastructure Security
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Maven
MavenMaven
Maven
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflow
 
Automated ui-testing
Automated ui-testingAutomated ui-testing
Automated ui-testing
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
 
Intro to Pentesting Jenkins
Intro to Pentesting JenkinsIntro to Pentesting Jenkins
Intro to Pentesting Jenkins
 
FV04_MostoviczT_RAD
FV04_MostoviczT_RADFV04_MostoviczT_RAD
FV04_MostoviczT_RAD
 

Mehr von Promet Source

How To Start Building Your Own Website With Drupal by Mary Chris Casis
How To Start Building Your Own Website With Drupal by Mary Chris CasisHow To Start Building Your Own Website With Drupal by Mary Chris Casis
How To Start Building Your Own Website With Drupal by Mary Chris CasisPromet Source
 
DrupalCamp Cebu 2018 R&F by Andrew Kucharski
DrupalCamp Cebu 2018 R&F by Andrew KucharskiDrupalCamp Cebu 2018 R&F by Andrew Kucharski
DrupalCamp Cebu 2018 R&F by Andrew KucharskiPromet Source
 
Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018
Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018
Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018Promet Source
 
Migrating to-Drupal-8 by Bryan Manalo
Migrating to-Drupal-8 by Bryan ManaloMigrating to-Drupal-8 by Bryan Manalo
Migrating to-Drupal-8 by Bryan ManaloPromet Source
 
Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018
Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018
Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018Promet Source
 
Drupal Development with Docker
Drupal Development with DockerDrupal Development with Docker
Drupal Development with DockerPromet Source
 
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8Promet Source
 
Web Accessibility in Drupal
Web Accessibility in DrupalWeb Accessibility in Drupal
Web Accessibility in DrupalPromet Source
 
Drupal Continuous Integration and devops - Beyond Jenkins
Drupal Continuous Integration and devops - Beyond JenkinsDrupal Continuous Integration and devops - Beyond Jenkins
Drupal Continuous Integration and devops - Beyond JenkinsPromet Source
 
Drupal 8 Involvement with Promet Source
Drupal 8 Involvement with Promet SourceDrupal 8 Involvement with Promet Source
Drupal 8 Involvement with Promet SourcePromet Source
 
Using Commerce License for Premium Content on Drupal Sites
Using Commerce License for Premium Content on Drupal SitesUsing Commerce License for Premium Content on Drupal Sites
Using Commerce License for Premium Content on Drupal SitesPromet Source
 
Behavioral driven development with Behat
Behavioral driven development with BehatBehavioral driven development with Behat
Behavioral driven development with BehatPromet Source
 
Composer tools and frameworks for Drupal
Composer tools and frameworks for DrupalComposer tools and frameworks for Drupal
Composer tools and frameworks for DrupalPromet Source
 
Responsive Design Testing the Promet Way
Responsive Design Testing the Promet WayResponsive Design Testing the Promet Way
Responsive Design Testing the Promet WayPromet Source
 
Optimize and succeed your next Fixed Budget Project planning process
Optimize and succeed your next Fixed Budget Project planning process Optimize and succeed your next Fixed Budget Project planning process
Optimize and succeed your next Fixed Budget Project planning process Promet Source
 
Diy continuous integration
Diy continuous integrationDiy continuous integration
Diy continuous integrationPromet Source
 
Higher Ed Web 2013 presentation - Field of Dreams, build it and they will come
Higher Ed Web 2013 presentation - Field of Dreams, build it and they will comeHigher Ed Web 2013 presentation - Field of Dreams, build it and they will come
Higher Ed Web 2013 presentation - Field of Dreams, build it and they will comePromet Source
 
Getting agile with drupal
Getting agile with drupalGetting agile with drupal
Getting agile with drupalPromet Source
 
Project Estimation Presentation - Donte's 8th level of estimating level of ef...
Project Estimation Presentation - Donte's 8th level of estimating level of ef...Project Estimation Presentation - Donte's 8th level of estimating level of ef...
Project Estimation Presentation - Donte's 8th level of estimating level of ef...Promet Source
 
DrupalCon 2013 Making Support Fun & Profitable
DrupalCon 2013 Making Support Fun & ProfitableDrupalCon 2013 Making Support Fun & Profitable
DrupalCon 2013 Making Support Fun & ProfitablePromet Source
 

Mehr von Promet Source (20)

How To Start Building Your Own Website With Drupal by Mary Chris Casis
How To Start Building Your Own Website With Drupal by Mary Chris CasisHow To Start Building Your Own Website With Drupal by Mary Chris Casis
How To Start Building Your Own Website With Drupal by Mary Chris Casis
 
DrupalCamp Cebu 2018 R&F by Andrew Kucharski
DrupalCamp Cebu 2018 R&F by Andrew KucharskiDrupalCamp Cebu 2018 R&F by Andrew Kucharski
DrupalCamp Cebu 2018 R&F by Andrew Kucharski
 
Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018
Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018
Unit test in drupal 8 by Pratomo Ardianto Drupalcamp Cebu 2018
 
Migrating to-Drupal-8 by Bryan Manalo
Migrating to-Drupal-8 by Bryan ManaloMigrating to-Drupal-8 by Bryan Manalo
Migrating to-Drupal-8 by Bryan Manalo
 
Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018
Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018
Why and When to use Drupal by Luc Bezier - Drupalcamp Cebu 2018
 
Drupal Development with Docker
Drupal Development with DockerDrupal Development with Docker
Drupal Development with Docker
 
Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8Migrating Drupal 7 to Drupal 8
Migrating Drupal 7 to Drupal 8
 
Web Accessibility in Drupal
Web Accessibility in DrupalWeb Accessibility in Drupal
Web Accessibility in Drupal
 
Drupal Continuous Integration and devops - Beyond Jenkins
Drupal Continuous Integration and devops - Beyond JenkinsDrupal Continuous Integration and devops - Beyond Jenkins
Drupal Continuous Integration and devops - Beyond Jenkins
 
Drupal 8 Involvement with Promet Source
Drupal 8 Involvement with Promet SourceDrupal 8 Involvement with Promet Source
Drupal 8 Involvement with Promet Source
 
Using Commerce License for Premium Content on Drupal Sites
Using Commerce License for Premium Content on Drupal SitesUsing Commerce License for Premium Content on Drupal Sites
Using Commerce License for Premium Content on Drupal Sites
 
Behavioral driven development with Behat
Behavioral driven development with BehatBehavioral driven development with Behat
Behavioral driven development with Behat
 
Composer tools and frameworks for Drupal
Composer tools and frameworks for DrupalComposer tools and frameworks for Drupal
Composer tools and frameworks for Drupal
 
Responsive Design Testing the Promet Way
Responsive Design Testing the Promet WayResponsive Design Testing the Promet Way
Responsive Design Testing the Promet Way
 
Optimize and succeed your next Fixed Budget Project planning process
Optimize and succeed your next Fixed Budget Project planning process Optimize and succeed your next Fixed Budget Project planning process
Optimize and succeed your next Fixed Budget Project planning process
 
Diy continuous integration
Diy continuous integrationDiy continuous integration
Diy continuous integration
 
Higher Ed Web 2013 presentation - Field of Dreams, build it and they will come
Higher Ed Web 2013 presentation - Field of Dreams, build it and they will comeHigher Ed Web 2013 presentation - Field of Dreams, build it and they will come
Higher Ed Web 2013 presentation - Field of Dreams, build it and they will come
 
Getting agile with drupal
Getting agile with drupalGetting agile with drupal
Getting agile with drupal
 
Project Estimation Presentation - Donte's 8th level of estimating level of ef...
Project Estimation Presentation - Donte's 8th level of estimating level of ef...Project Estimation Presentation - Donte's 8th level of estimating level of ef...
Project Estimation Presentation - Donte's 8th level of estimating level of ef...
 
DrupalCon 2013 Making Support Fun & Profitable
DrupalCon 2013 Making Support Fun & ProfitableDrupalCon 2013 Making Support Fun & Profitable
DrupalCon 2013 Making Support Fun & Profitable
 

Automated testing with Drupal

  • 1. Automated testing testing at every stage
  • 2. Exposition: characters • Michelle Krejci – a.k.a. craychee – a.k.a. dev_meshev • Promet Source – www.prometsource.com
  • 3. Exposition: characters • Selenium* – a.k.a. Selenium IDE – a.k.a. Selenium RC – a.k.a. Selenium Webdriver *Actually, these are not at all the same. To wit: Selenium IDE = development enviroment to create scripts Selenium RC = Refers to Selenium 1 executable Selenium Webdriver = Selenium 2 executable
  • 4. Exposition: characters • PHPUnit – a.k.a. the testing standard of the PHP community – a.k.a. the successor of SimpleTest
  • 5. Exposition: characters • Jenkins – a.k.a. Hudson – a.k.a. A developer‟s most dependable butler
  • 6. Exposition: characters • Chef – a.k.a. An opscode product – a.k.a. the answer to all your server-configuration-related prayers
  • 7. Exposition: characters • xvfb – a.k.a. X virtual framer – a.k.a. what you need to run Selenium on a headless
  • 8. Exposition: characters • Phing – a.k.a. Phing Is Not GNU make – a.k.a. Apache Ant for PHP – a.k.a. a build system for PHP – a.k.a. what you will need to run deeper regression, metric, and user acceptance testing
  • 9. Exposition: the setting – During development Lots of clicking – After every update – If someone somehow has the time: on a regular basis as part of on-going support.
  • 10. Development: rising action The Solution: Roll Call Testing – Use Selenium scripts to verify that elements such as ids, divs, and text are present on a regular basis (e.g., after updates, during development, on a regular basis)
  • 11. Development: rising action Roll Call Tests – Each page gets its own test. – Each test must start and end at the home page. • Verify that all blocks and links are present using the VerifyElement command. • Do not use “assert” or this will halt all tests if element or text is not present.
  • 12. Development: rising action Tools needed to write tests – Selenium IDE¹ – PHPUnit bindings² – Xpath plug-in³ ¹ Selenium IDE: – https://addons.mozilla.org/en- US/firefox/addon/selenium-ide/ ² PHP bindings: – https://addons.mozilla.org/en- US/firefox/addon/selenium-ide-php-formatters/?src=ss ³ Xpath-checker add on: – https://addons.mozilla.org/en-US/firefox/addon/xpath- checker/?src=search
  • 13. Development: rising action Selenium IDE 1. Starting point. 2. Controls 3. Record actions (not needed for creating roll call tests, recommend using right click and select command) 4. Name of tests (should be named after page) 5. The display 6. View and edit selected command 7. Reference of commands
  • 14. Development: rising action Tools needed to run tests locally – Selenium webdriver – PHP Unit – PHP Unit Selenium Exstentions • Installing Selenium Webdriver: – http://www.danstraw.com/installing-selenium- server-2-as-a-service-on-ubuntu/2010/09/23/ • Installing PHP Unit & Extensions: – http://www.phpunit.de/manual/current/en/install ation.html
  • 15. Development: rising action Start Selenium Webdriver: In a new tab, run command phpunit*: *In this example, I am using a bootstrap file. I have created a parent class that each page extends. In the parent class, I test the branding elements of each page.
  • 16. Development: rising action Now, let‟s automate it:
  • 17. Development: rising action Add a ruby build script:* #!/user/bin/env ruby current_dir = File.dirname(__FILE__) bootstrap_file = "MCMC.php” //if parent class build_dir = "build" Dir[File.join(current_dir), '*'].each do |file| puts file if file != bootstrap_file and File.file?(file) cmd = "phpunit --log-junit #{build_dir}/#{file}.selenium.xml /*--bootstrap #{bootstrap_file} #{file}*/" print cmd system(cmd) end end *No. It does not need to be ruby.
  • 18. Development: rising action Create a git repo:* $git init newrepo *Yes. Use git.
  • 19. Development: rising action Configure Jenkins Server: – Add xvfb There is a script in /root that has the commands to start the selenium service w/ Xvfb in a script named „start_selenium.sh‟ – Install the following plugins • analysis-core • Analysis-collector • Checkstyle • Dry • Phing • Plot • pmd
  • 20. Development: rising action Configure Jenkins Job: – Specify source
  • 21. Development: rising action Configure Jenkins Job: – Specify triggers:
  • 22. Development: rising action Configure Jenkins Job: – Specify build command:
  • 23. Development: rising action Sit back and admire how clever you are:
  • 24. Development: At this point you might start thinking: Let‟s automate everything!
  • 25. Development: falling action Continuous delivery* *image from: http://en.wikipedia.org/wiki/Continuous_delivery
  • 26. Development: falling action Test-driven dev: – Build tests – Then modules
  • 27. Development: falling action User acceptance tests that leverage Drupal* abstract class DrupalTestCase extends PHPUnit_Framework_TestCase { } *https://github.com/weitzman/upal
  • 28. Development: falling action There are people working on this:
  • 29.
  • 30. understanding Phpunit needs to be leveraged for Drupal Drupal culture
  • 31. Development: the resolution Let‟s make it work. • protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'skip comment approval')) { • // Create a role with the given permission set. • if (!($rid = $this->drupalCreateRole($permissions))) { • return FALSE; • } • // Create a user assigned to that role. • $edit = array(); • $edit['name'] = $this->randomName(); • $edit['mail'] = $edit['name'] . '@example.com'; • $edit['roles'] = array($rid => $rid); • $edit['pass'] = user_password(); • $edit['status'] = 1; • $account = user_save(drupal_anonymous_user(), $edit); • $this->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login')); • if (empty($account->uid)) { • return FALSE; • } • // Add the raw password so that we can log in as this user. • $account->pass_raw = $edit['pass']; • return $account; • }