SlideShare ist ein Scribd-Unternehmen logo
1 von 74
Build and Test
in the Cloud


Carlos Sanchez
MaestroDev
Hej!

Solutions Architect at
MaestroDev
Member of Apache
Software Foundation
Maven PMC, Continuum,
Archiva
Eclipse IAM co-lead
etc...
Index


            The tools
         why the Cloud?
       Distributed building
     Maven integration tests
       Maven & Selenium
Testing in different environments
      And now in the cloud
The tools
Build: Apache Maven



      Build tool and more
   Dependency management
Execution of unit/integration tests
  Start/stop application server
Automatic application deployment
Test Cases: TestNG




 Unit/integration tests
 parameterized tests
    parallel testing
Integration Tests: Selenium



    UI and Integration testing
     Tests run in the browser
   support for multiple browsers
      Tests can be recorded
no need for developers writing tests
       Selenium IDE Firefox plugin
Continuous Integration: Apache Continuum


      Tight integration with Apache Maven
               dependency handling
                  Trigger builds
          when integration tests change
            when the webapp changes
      when the webapp dependencies change
               Distributed building
Cloud Computing: Amazon Web Services


              Amazon S3
                storage
             Amazon SQS
             queue service
         Amazon Mechanical Turk
               manpower
             Amazon EC2
              computation
why the cloud?
$$$




      Machines cost money
     Bandwidth costs money
     Electricity costs money
Server administration costs money
Resource Optimization




    build servers can be repurposed
test servers working 10-20% of the time
   ability to do expensive builds/tests
         for a short amount of time
Predictions cost money
Infrastructure
    Cost $




                                          time
                        Source: Amazon
Predictions cost money
Infrastructure
    Cost $




                                          Predicted
                                          Demand




                                             time
                        Source: Amazon
Predictions cost money
Infrastructure
    Cost $




                                          Predicted
                                          Demand

                                          Traditional
                                          Hardware




                                             time
                        Source: Amazon
Predictions cost money
Infrastructure
    Cost $



       Large
       Capital
     Expenditure


                                            Predicted
                                            Demand

                                            Traditional
                                            Hardware




                                               time
                          Source: Amazon
Predictions cost money
Infrastructure
    Cost $




                                          Predicted
                                          Demand

                                          Traditional
                                          Hardware




                                             time
                        Source: Amazon
Predictions cost money
Infrastructure
    Cost $




                                          Predicted
                                          Demand

                                          Traditional
                                          Hardware


                                           Actual
                                          Demand




                                             time
                        Source: Amazon
Predictions cost money
Infrastructure
    Cost $




                                                   Predicted
                                                   Demand

                                     Opportunity   Traditional
                                       Cost        Hardware


                                                    Actual
                                                   Demand




                                                      time
                        Source: Amazon
Predictions cost money
Infrastructure
    Cost $



                                                   You just lost
                                                    customers




                                                               Predicted
                                                               Demand

                                     Opportunity                   Traditional
                                       Cost                        Hardware


                                                                    Actual
                                                                   Demand




                                                                      time
                        Source: Amazon
Predictions cost money
Infrastructure
    Cost $




                                          Predicted
                                          Demand

                                          Traditional
                                          Hardware


                                           Actual
                                          Demand

                                           Automated
                                          Virtualization




                                              time
                        Source: Amazon
Availability




Can you get 3000 machines in 3 days?
Amazon EC2




Elastic Compute Cloud

Machines on demand
Amazon EC2

pay per hour
same price for
10 machines / 1 hour
1 machine / 10 hours
unlimited number of
machines
start in couple minutes
AMIs
AMIs

Amazon Machine Images
AMIs

Amazon Machine Images




   Bundle your own
Distributed building
Credits: XKCD
Continuum


Master Continuum server
 Centralized management
    Builds, users, output,...
       Can build too
Distributed build agents
      distribute load
 different environments
different networks/clouds
Distributed builds




               Coupling
Maven dependencies determine parallelism
             Environments
       OS, JDK, installed libraries...
                 VM size
Configuration




        Use properties
 Allow customizing environments
    -Djetty.port=8081
-Dweb.host=184.73.250.39
Configuration

Use settings.xml       <settings>

For user / agents        <profiles>
configuration               <profile>
                             <id>acme</id>
                             <activation>
                               <activeByDefault>true</activeByDefault>
                             </activation>
                             <properties>
                               <jetty.port>8081</jetty.port>
                               <web.host>184.73.250.39</web.host>
                             </properties>
                           </profile>
                         </profiles>

                       </settings>
Build agents in the cloud




                  Startup
     Automatically start with instance
                    API
Auto-connect to master when instance starts
        ie. using user-data on EC2
Starting more agents



         Not worth at build time
           Instance startup time
             Pay for full hours
                Use a pool
Keep a minimum number of instances in pool
        Start/Stop more as needed
Maven EC2 plugin




http://mojo.codehaus.org/maven-ec2-plugin
             start Amazon AMIs
         stop at the end of the build
              pass on user data
Multicloud APIs




           Java - JClouds
 http://code.google.com/p/jclouds/
     Python (+ Java) - libcloud
http://incubator.apache.org/libcloud/
Provisioning




          DevOps!
       Puppet / Chef
Manage instances automagically
class buildagent {
  $path="/usr/bin:/usr/sbin:/bin:/sbin"

 # Java 6
 package { jdk:
   ensure => "1.6.0_23-fcs",
   require => Class[yum],
 }

 # Builder
 user{ "builder":
   name        =>   builder,
   ensure      =>   present,
   home        =>   "/home/builder",
   managehome =>    true,
   shell       =>   "/bin/bash",
 }

  # Builder Agent packages
  $builder_agent_packages = ["maven", "continuum-buildagent", "subversion",
"xorg-x11-server-Xvfb", "xorg-x11-server-utils"]
  package {
    $builder_agent_packages:
      ensure => latest,
      require => [Package[jdk]]
  }
package {
  firefox:
    ensure =>    latest,#["3.6.9", "3.0.19"],
    require =>   Class[yum]
}

$settings_xml = "/home/builder/.m2/settings.xml"
file { "/home/builder/.m2":
  owner   => "builder",
  group   => "builder",
  mode    => "0600",
  ensure => directory,
  require => User["builder"],
}
file { $settings_xml :
  owner   => "builder",
  group   => "builder",
  mode    => "0600",
  content => template("builder/settings.xml.erb"),
  require => File["/home/builder/.m2"],
}

service { continuum-buildagent :
    enable     => true,
    ensure     => running,
    hasstatus => true,
    hasrestart => true,
    require    => [Package[continuum-buildagent], File[$settings_xml]]
}
Fear of change




                   Affects behavior
ability of doing things that could not be done before
            but requires new knowledge too
                   Embrace change!
Maven integration tests
The webapp to test

Apache Maven 2
Effective Implementation
 Centrepoint sample webapp
A new Maven project

Centrepoint
selenium-tests



          <groupId>com.effectivemaven.centrepoint</groupId>
          <artifactId>selenium-tests</artifactId>
          <version>1.0-SNAPSHOT</version>
          <name>Centrepoint Selenium Test Suite</name>
that depends on

Centrepoint webapp



       <dependency>
         <groupId>com.effectivemaven.centrepoint</groupId>
         <artifactId>webapp</artifactId>
         <version>${project.version}</version>
         <type>war</type>
       </dependency>
using Jetty plugin to run it

automatically




            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
Record Selenium tests

SeleniumIDE
as Java
test cases

using Selenium API       public void setUp() throws Exception {
                             setUp("http://localhost:18880/", "*chrome");
                         }
                         public void testNew() throws Exception {
                             selenium.open("/mainMenu.html");
                             selenium.click("link=Administration");
                             selenium.waitForPageToLoad("30000");
                             selenium.type("j_password", "admin");
                             selenium.click("rememberMe");
                             selenium.click("//input[@name='login']");
                             selenium.waitForPageToLoad("30000");
                             selenium.click("link=Edit Profile");
                             selenium.waitForPageToLoad("30000");
                             selenium.click("link=Main Menu");
                             selenium.waitForPageToLoad("30000");
                             selenium.click("link=Edit Profile");
                             selenium.waitForPageToLoad("30000");
                             selenium.click("document.forms[0].elements[24]");
                             selenium.waitForPageToLoad("30000");
                         }
Maven & Selenium
Selenium Architecture




        Selenium
         server
Maven & Selenium




Start Selenium server locally
    Run integration tests
    Stop selenium server
Selenium Maven plugin




http://mojo.codehaus.org/selenium-maven-plugin

            selenium:start-server
            selenium:stop-server
Selenium Maven plugin

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>selenium-maven-plugin</artifactId>
  <version>1.0-rc-1</version>
  <executions>
    <execution>
      <id>start-selenium</id>
      <phase>pre-integration-test</phase>
      <goals>
         <goal>start-server</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <background>${selenium.background}</background>
  </configuration>
</plugin>
Testing in different
  environments
Multi environment

    Multiple Browsers




Multiple Operating Systems
Multi environment

    Multiple Browsers




Multiple Operating Systems
Multi environment

    Multiple Browsers




Multiple Operating Systems
Parallel




  Run tests in parallel
    in each browser
several browsers per test
      Load testing
Selenium Grid
TestNG properties




Allows to run the same tests in different environments

                    and in parallel
TestNG properties

<suite name="Example" parallel="tests" thread-count="3">
  <test name="iexplore">
    <parameter name="browser" value="*iexplore"/>
    <packages>
      <package name="com.effectivemaven.centrepoint.selenium" />
    </packages>
  </test>
  <test name="firefox2">
    <parameter name="browser" value="*firefox2"/>
    <packages>
      <package name="com.effectivemaven.centrepoint.selenium" />
    </packages>
  </test>
  <test name="opera">
    <parameter name="browser" value="*opera"/>
    <packages>
      <package name="com.effectivemaven.centrepoint.selenium" />
    </packages>
  </test>
</suite>
TestNG properties

<suite name="Example" parallel="tests" thread-count="3">
  <test name="iexplore">
    <parameter name="browser" value="*iexplore"/>
    <packages>
      <package name="com.effectivemaven.centrepoint.selenium" />
    </packages>
  </test>
  <test name="firefox2">
    <parameter name="browser" value="*firefox2"/>
    <packages>
      <package name="com.effectivemaven.centrepoint.selenium" />
    </packages>
  </test>
  <test name="opera">
    <parameter name="browser" value="*opera"/>
    <packages>
      <package name="com.effectivemaven.centrepoint.selenium" />
    </packages>
  </test>
</suite>
and now in the Cloud
Countless possibilities

Internet Explorer
Firefox 2
Opera
Safari
Firefox 3
Firefox 2
etc...
no OS X :(
Amazon AMIs




  Create AMIs for different environments to test
Read user data to customize the images at runtime
            where is the Selenium Hub
Linux




     Selenium headless
Use *nix X Virtual Frame Buffer

          In Maven
        selenium:xvfb
Windows



      Run Selenium Agent in user account
                not local service
    Selenium needs to have access to Desktop
          Disable password expiration
        Disable/Open windows firewall
netsh firewall add portopening TCP 8181 “Continuum BuildAgent”
     netsh firewall add portopening TCP 9000 “Selenium RC 9000”
Browser config


         Uninstall Internet Explorer Enhanced Security
                         Configuration
                         Windows 2003
    http://www.visualwin.com/IE-enhanced-security/ in Add/Remove programs
                               Windows 2008
http://windowsitpro.com/article/articleid/96159/how-do-i-turn-off-internet-explorer-
           enhanced-security-configuration-in-windows-server-2008.html
                              Safari/Firefox
                          Disable popup blocker
Questions?
Tak!

http://maestrodev.com
http://carlossanchez.eu
csanchez@maestrodev.com
carlos@apache.org
csanchez
Credits




                   Son of Man Lego
http://www.flickr.com/photos/hoyvinmayvin/4702772452/
                  XKCD - Compiling
                  http://xkcd.com/303/

Weitere ähnliche Inhalte

Mehr von Carlos Sanchez

Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...Carlos Sanchez
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous DeliveryUsing Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous DeliveryCarlos Sanchez
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-ServicesDivide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-ServicesCarlos Sanchez
 
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2daysUsing Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2daysCarlos Sanchez
 
Using Containers for Continuous Integration and Continuous Delivery
Using Containers for Continuous Integration and Continuous DeliveryUsing Containers for Continuous Integration and Continuous Delivery
Using Containers for Continuous Integration and Continuous DeliveryCarlos Sanchez
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-ServicesDivide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-ServicesCarlos Sanchez
 
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Carlos Sanchez
 
Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Carlos Sanchez
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCarlos Sanchez
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsCarlos Sanchez
 
From Monolith to Docker Distributed Applications. JavaOne
From Monolith to Docker Distributed Applications. JavaOneFrom Monolith to Docker Distributed Applications. JavaOne
From Monolith to Docker Distributed Applications. JavaOneCarlos Sanchez
 
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?Carlos Sanchez
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCarlos Sanchez
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsCarlos Sanchez
 
Scaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and KubernetesScaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and KubernetesCarlos Sanchez
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for TestingCarlos Sanchez
 
Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with KubernetesCarlos Sanchez
 
Scaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and KubernetesScaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and KubernetesCarlos Sanchez
 
Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with KubernetesCarlos Sanchez
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 

Mehr von Carlos Sanchez (20)

Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous DeliveryUsing Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous Delivery
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-ServicesDivide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-Services
 
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2daysUsing Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
 
Using Containers for Continuous Integration and Continuous Delivery
Using Containers for Continuous Integration and Continuous DeliveryUsing Containers for Continuous Integration and Continuous Delivery
Using Containers for Continuous Integration and Continuous Delivery
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-ServicesDivide and Conquer: Easier Continuous Delivery using Micro-Services
Divide and Conquer: Easier Continuous Delivery using Micro-Services
 
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
 
Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed Applications
 
From Monolith to Docker Distributed Applications. JavaOne
From Monolith to Docker Distributed Applications. JavaOneFrom Monolith to Docker Distributed Applications. JavaOne
From Monolith to Docker Distributed Applications. JavaOne
 
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed Applications
 
Scaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and KubernetesScaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and Kubernetes
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with Kubernetes
 
Scaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and KubernetesScaling Jenkins with Docker and Kubernetes
Scaling Jenkins with Docker and Kubernetes
 
Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with Kubernetes
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 

Kürzlich hochgeladen

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Build and Test in the Cloud

  • 1. Build and Test in the Cloud Carlos Sanchez MaestroDev
  • 2. Hej! Solutions Architect at MaestroDev Member of Apache Software Foundation Maven PMC, Continuum, Archiva Eclipse IAM co-lead etc...
  • 3. Index The tools why the Cloud? Distributed building Maven integration tests Maven & Selenium Testing in different environments And now in the cloud
  • 5. Build: Apache Maven Build tool and more Dependency management Execution of unit/integration tests Start/stop application server Automatic application deployment
  • 6. Test Cases: TestNG Unit/integration tests parameterized tests parallel testing
  • 7. Integration Tests: Selenium UI and Integration testing Tests run in the browser support for multiple browsers Tests can be recorded no need for developers writing tests Selenium IDE Firefox plugin
  • 8. Continuous Integration: Apache Continuum Tight integration with Apache Maven dependency handling Trigger builds when integration tests change when the webapp changes when the webapp dependencies change Distributed building
  • 9. Cloud Computing: Amazon Web Services Amazon S3 storage Amazon SQS queue service Amazon Mechanical Turk manpower Amazon EC2 computation
  • 11. $$$ Machines cost money Bandwidth costs money Electricity costs money Server administration costs money
  • 12. Resource Optimization build servers can be repurposed test servers working 10-20% of the time ability to do expensive builds/tests for a short amount of time
  • 13. Predictions cost money Infrastructure Cost $ time Source: Amazon
  • 14. Predictions cost money Infrastructure Cost $ Predicted Demand time Source: Amazon
  • 15. Predictions cost money Infrastructure Cost $ Predicted Demand Traditional Hardware time Source: Amazon
  • 16. Predictions cost money Infrastructure Cost $ Large Capital Expenditure Predicted Demand Traditional Hardware time Source: Amazon
  • 17. Predictions cost money Infrastructure Cost $ Predicted Demand Traditional Hardware time Source: Amazon
  • 18. Predictions cost money Infrastructure Cost $ Predicted Demand Traditional Hardware Actual Demand time Source: Amazon
  • 19. Predictions cost money Infrastructure Cost $ Predicted Demand Opportunity Traditional Cost Hardware Actual Demand time Source: Amazon
  • 20. Predictions cost money Infrastructure Cost $ You just lost customers Predicted Demand Opportunity Traditional Cost Hardware Actual Demand time Source: Amazon
  • 21. Predictions cost money Infrastructure Cost $ Predicted Demand Traditional Hardware Actual Demand Automated Virtualization time Source: Amazon
  • 22. Availability Can you get 3000 machines in 3 days?
  • 23. Amazon EC2 Elastic Compute Cloud Machines on demand
  • 24. Amazon EC2 pay per hour same price for 10 machines / 1 hour 1 machine / 10 hours unlimited number of machines start in couple minutes
  • 25. AMIs
  • 27. AMIs Amazon Machine Images Bundle your own
  • 30. Continuum Master Continuum server Centralized management Builds, users, output,... Can build too Distributed build agents distribute load different environments different networks/clouds
  • 31. Distributed builds Coupling Maven dependencies determine parallelism Environments OS, JDK, installed libraries... VM size
  • 32. Configuration Use properties Allow customizing environments -Djetty.port=8081 -Dweb.host=184.73.250.39
  • 33. Configuration Use settings.xml <settings> For user / agents <profiles> configuration <profile> <id>acme</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <jetty.port>8081</jetty.port> <web.host>184.73.250.39</web.host> </properties> </profile> </profiles> </settings>
  • 34. Build agents in the cloud Startup Automatically start with instance API Auto-connect to master when instance starts ie. using user-data on EC2
  • 35. Starting more agents Not worth at build time Instance startup time Pay for full hours Use a pool Keep a minimum number of instances in pool Start/Stop more as needed
  • 36. Maven EC2 plugin http://mojo.codehaus.org/maven-ec2-plugin start Amazon AMIs stop at the end of the build pass on user data
  • 37. Multicloud APIs Java - JClouds http://code.google.com/p/jclouds/ Python (+ Java) - libcloud http://incubator.apache.org/libcloud/
  • 38. Provisioning DevOps! Puppet / Chef Manage instances automagically
  • 39. class buildagent { $path="/usr/bin:/usr/sbin:/bin:/sbin" # Java 6 package { jdk: ensure => "1.6.0_23-fcs", require => Class[yum], } # Builder user{ "builder": name => builder, ensure => present, home => "/home/builder", managehome => true, shell => "/bin/bash", } # Builder Agent packages $builder_agent_packages = ["maven", "continuum-buildagent", "subversion", "xorg-x11-server-Xvfb", "xorg-x11-server-utils"] package { $builder_agent_packages: ensure => latest, require => [Package[jdk]] }
  • 40. package { firefox: ensure => latest,#["3.6.9", "3.0.19"], require => Class[yum] } $settings_xml = "/home/builder/.m2/settings.xml" file { "/home/builder/.m2": owner => "builder", group => "builder", mode => "0600", ensure => directory, require => User["builder"], } file { $settings_xml : owner => "builder", group => "builder", mode => "0600", content => template("builder/settings.xml.erb"), require => File["/home/builder/.m2"], } service { continuum-buildagent : enable => true, ensure => running, hasstatus => true, hasrestart => true, require => [Package[continuum-buildagent], File[$settings_xml]] }
  • 41. Fear of change Affects behavior ability of doing things that could not be done before but requires new knowledge too Embrace change!
  • 43. The webapp to test Apache Maven 2 Effective Implementation Centrepoint sample webapp
  • 44. A new Maven project Centrepoint selenium-tests <groupId>com.effectivemaven.centrepoint</groupId> <artifactId>selenium-tests</artifactId> <version>1.0-SNAPSHOT</version> <name>Centrepoint Selenium Test Suite</name>
  • 45. that depends on Centrepoint webapp <dependency> <groupId>com.effectivemaven.centrepoint</groupId> <artifactId>webapp</artifactId> <version>${project.version}</version> <type>war</type> </dependency>
  • 46. using Jetty plugin to run it automatically <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId>
  • 49. test cases using Selenium API public void setUp() throws Exception { setUp("http://localhost:18880/", "*chrome"); } public void testNew() throws Exception { selenium.open("/mainMenu.html"); selenium.click("link=Administration"); selenium.waitForPageToLoad("30000"); selenium.type("j_password", "admin"); selenium.click("rememberMe"); selenium.click("//input[@name='login']"); selenium.waitForPageToLoad("30000"); selenium.click("link=Edit Profile"); selenium.waitForPageToLoad("30000"); selenium.click("link=Main Menu"); selenium.waitForPageToLoad("30000"); selenium.click("link=Edit Profile"); selenium.waitForPageToLoad("30000"); selenium.click("document.forms[0].elements[24]"); selenium.waitForPageToLoad("30000"); }
  • 51. Selenium Architecture Selenium server
  • 52. Maven & Selenium Start Selenium server locally Run integration tests Stop selenium server
  • 53. Selenium Maven plugin http://mojo.codehaus.org/selenium-maven-plugin selenium:start-server selenium:stop-server
  • 54. Selenium Maven plugin <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <version>1.0-rc-1</version> <executions> <execution> <id>start-selenium</id> <phase>pre-integration-test</phase> <goals> <goal>start-server</goal> </goals> </execution> </executions> <configuration> <background>${selenium.background}</background> </configuration> </plugin>
  • 55. Testing in different environments
  • 56. Multi environment Multiple Browsers Multiple Operating Systems
  • 57. Multi environment Multiple Browsers Multiple Operating Systems
  • 58. Multi environment Multiple Browsers Multiple Operating Systems
  • 59. Parallel Run tests in parallel in each browser several browsers per test Load testing
  • 61.
  • 62.
  • 63. TestNG properties Allows to run the same tests in different environments and in parallel
  • 64. TestNG properties <suite name="Example" parallel="tests" thread-count="3"> <test name="iexplore"> <parameter name="browser" value="*iexplore"/> <packages> <package name="com.effectivemaven.centrepoint.selenium" /> </packages> </test> <test name="firefox2"> <parameter name="browser" value="*firefox2"/> <packages> <package name="com.effectivemaven.centrepoint.selenium" /> </packages> </test> <test name="opera"> <parameter name="browser" value="*opera"/> <packages> <package name="com.effectivemaven.centrepoint.selenium" /> </packages> </test> </suite>
  • 65. TestNG properties <suite name="Example" parallel="tests" thread-count="3"> <test name="iexplore"> <parameter name="browser" value="*iexplore"/> <packages> <package name="com.effectivemaven.centrepoint.selenium" /> </packages> </test> <test name="firefox2"> <parameter name="browser" value="*firefox2"/> <packages> <package name="com.effectivemaven.centrepoint.selenium" /> </packages> </test> <test name="opera"> <parameter name="browser" value="*opera"/> <packages> <package name="com.effectivemaven.centrepoint.selenium" /> </packages> </test> </suite>
  • 66. and now in the Cloud
  • 67. Countless possibilities Internet Explorer Firefox 2 Opera Safari Firefox 3 Firefox 2 etc... no OS X :(
  • 68. Amazon AMIs Create AMIs for different environments to test Read user data to customize the images at runtime where is the Selenium Hub
  • 69. Linux Selenium headless Use *nix X Virtual Frame Buffer In Maven selenium:xvfb
  • 70. Windows Run Selenium Agent in user account not local service Selenium needs to have access to Desktop Disable password expiration Disable/Open windows firewall netsh firewall add portopening TCP 8181 “Continuum BuildAgent” netsh firewall add portopening TCP 9000 “Selenium RC 9000”
  • 71. Browser config Uninstall Internet Explorer Enhanced Security Configuration Windows 2003 http://www.visualwin.com/IE-enhanced-security/ in Add/Remove programs Windows 2008 http://windowsitpro.com/article/articleid/96159/how-do-i-turn-off-internet-explorer- enhanced-security-configuration-in-windows-server-2008.html Safari/Firefox Disable popup blocker
  • 74. Credits Son of Man Lego http://www.flickr.com/photos/hoyvinmayvin/4702772452/ XKCD - Compiling http://xkcd.com/303/

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. 35\n
  44. 35\n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n