SlideShare una empresa de Scribd logo
1 de 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/

Más contenido relacionado

Más de 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
 

Más de 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
 

Último

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Último (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

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/

Notas del editor

  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