Enterprise Build And Test In The Cloud

7,807 views

Published on

Enterprise Build And Test In The Cloud
ApacheCon EU 2009 Amsterdam
http://www.carlossanchez.eu

Building and testing software can be a time and resource consuming task. Cloud computing / on demand services like Amazon EC2 allow a cost-effective way to scale applications, and applied to building and testing software can reduce the time needed to find and correct problems, meaning a reduction also in time and costs. Properly configuring your build tools (Maven, Ant,...), continuous integration servers (Continuum, Cruise Control,...), and testing tools (TestNG, Selenium,...) can allow you to run all the build/testing process in a cloud environment, simulating high load environments, distributing long running tests to reduce their execution time, using different environments for client or server applications,... and in the case of on-demand services like Amazon EC2, pay only for the time you use it. In this presentation we will introduce a development process and architecture using popular open source tools for the build and test process such as Apache Maven or Ant for building, Apache Continuum as continuous integration server, TestNG and Selenium for testing, and how to configure them to achieve the best results and performance in several typical use cases (long running testing processes, different client platforms,...) by using he Amazon Elastic Computing Cloud EC2, and therefore reducing time and costs compared to other solutions.

Published in: Technology
1 Comment
9 Likes
Statistics
Notes
  • Would you please send me the presentation to dvelev@unwe.acad.bg ? Thank you !
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
7,807
On SlideShare
0
From Embeds
0
Number of Embeds
833
Actions
Shares
0
Downloads
0
Comments
1
Likes
9
Embeds 0
No embeds

No notes for slide





















  • 10








  • 15







  • 20









  • 25

















  • 30






























  • 35















  • Enterprise Build And Test In The Cloud

    1. Enterprise Build & Test in the Cloud Carlos Sanchez March 27, 2009
    2. About me During the day Sr. Solutions Architect at G2iX At night Member of Apache Maven PMC, Continuum, Archiva Eclipse IAM co-lead
    3. Index The tools Maven Integration Tests Maven & Selenium Adding Continuum to the Mix Testing in Different Environments And Now in the Cloud
    4. The tools
    5. Build Apache Maven
    6. Maven Build tool and more Dependency management Execution of unit /integration tests Start/stop application server Automatic application deployment
    7. How many?
    8. Test cases TestNG
    9. TestNG Unit/integration tests parameterized tests parallel testing
    10. How many?
    11. Integration tests Selenium
    12. 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
    13. How many?
    14. Continuous Integration Apache Continuum
    15. Apache Continuum Tight integration with Apache Maven dependency handling Trigger builds when integration tests change when the webapp changes when the webapp dependencies change
    16. How many?
    17. Cloud Computing Amazon Web Services
    18. Amazon Web Services
    19. Amazon Web Services Amazon S3 storage
    20. Amazon Web Services Amazon S3 storage Amazon SQS queue service
    21. Amazon Web Services Amazon S3 storage Amazon SQS queue service Amazon Mechanical Turk manpower
    22. Amazon Web Services Amazon S3 storage Amazon SQS queue service Amazon Mechanical Turk manpower Amazon EC2 computation
    23. How many?
    24. Maven integration tests
    25. The webapp to test appfuse-struts
    26. A new Maven project appfuse-selenium <groupId>org.appfuse</groupId> <artifactId>appfuse-selenium</artifactId> <version>2.0.2-SNAPSHOT</version> <packaging>war</packaging> <name>AppFuse Selenium testing</name>
    27. that depends on appfuse-struts <dependency> <groupId>org.appfuse</groupId> <artifactId>appfuse-struts</artifactId> <version>2.0.2</version> <type>war</type> </dependency>
    28. using Cargo to run it automatically <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId>
    29. Record Selenium tests SeleniumIDE
    30. ... as Java
    31. test cases ...using Selenium API public void setUp() throws Exception { setUp(quot;http://localhost:18880/quot;, quot;*chromequot;); } public void testNew() throws Exception { selenium.open(quot;/mainMenu.htmlquot;); selenium.click(quot;link=Administrationquot;); selenium.waitForPageToLoad(quot;30000quot;); selenium.type(quot;j_passwordquot;, quot;adminquot;); selenium.click(quot;rememberMequot;); selenium.click(quot;//input[@name='login']quot;); selenium.waitForPageToLoad(quot;30000quot;); selenium.click(quot;link=Edit Profilequot;); selenium.waitForPageToLoad(quot;30000quot;); selenium.click(quot;link=Main Menuquot;); selenium.waitForPageToLoad(quot;30000quot;); selenium.click(quot;link=Edit Profilequot;); selenium.waitForPageToLoad(quot;30000quot;); selenium.click(quot;document.forms[0].elements[24]quot;); selenium.waitForPageToLoad(quot;30000quot;); }
    32. breakpoint we have Selenium tests in Maven IT project
    33. Maven & Selenium
    34. Selenium Architecture Selenium server
    35. Maven & Selenium Start Selenium server locally Run integration tests Stop selenium server
    36. Selenium Maven plugin http://mojo.codehaus.org/ selenium-maven-plugin selenium:start-server selenium:stop-server
    37. configuration <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>
    38. ------------------------------------------------------- TESTS ------------------------------------------------------- Running TestSuite log4j:WARN No appenders could be found for logger (com.thoughtworks.selenium.grid.tools.ThreadSafeSeleniumSessionStorage). log4j:WARN Please initialize the log4j system properly. DEBUG [btpool0-5] UserAction.edit(117) | checking for remember me login... DEBUG [btpool0-8] LookupDaoHibernate.getRoles(20) | Retrieving all role names... DEBUG [btpool0-8] StartupListener.setupContext(102) | Drop-down initialization complete [OK] INFO [btpool0-8] ReloadAction.execute(34) | reload complete, reloading user back to: http://localhost: 18880/admin/activeUsers.html DEBUG [btpool0-3] UserAction.edit(117) | checking for remember me login... DEBUG [btpool0-3] UserAction.edit(117) | checking for remember me login... Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 89.703 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [cargo:stop {execution: stop-container}] 2009-03-23 16:41:42.176:/appfuse-selenium-2.0.2-SNAPSHOT:INFO: Closing Spring root WebApplicationContext [INFO] [install:install] [INFO] Installing /Users/csanchez/dev/maestro/appfuse-selenium/target/appfuse-selenium-2.0.2-SNAPSHOT.war to /Users/csanchez/.m2/repository/org/appfuse/appfuse-selenium/2.0.2-SNAPSHOT/appfuse-selenium-2.0.2- SNAPSHOT.war [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 minutes 20 seconds [INFO] Finished at: Mon Mar 23 16:41:45 CET 2009 [INFO] Final Memory: 43M/63M [INFO] ------------------------------------------------------------------------ 2009-03-23 16:41:46.168::INFO: Shutdown hook executing 2009-03-23 16:41:46.169::INFO: Shutdown hook complete
    39. breakpoint Selenium tests in Maven IT project running locally in the browser
    40. Adding Continuum to the Mix
    41. Continuum
    42. Continuum Build the webapp if
    43. Continuum Build the webapp if the webapp changes
    44. Continuum Build the webapp if the webapp changes the dependencies change
    45. Continuum Build the webapp if the webapp changes the dependencies change Run the integration tests
    46. Continuum Build the webapp if the webapp changes the dependencies change Run the integration tests if the ITs change
    47. Continuum Build the webapp if the webapp changes the dependencies change Run the integration tests if the ITs change if the webapp changes
    48. Continuum Add appfuse-struts Add appfuse-selenium
    49. Selenium headless Most likely needed Use *nix X Virtual Frame Buffer In Maven selenium:xvfb
    50. breakpoint Selenium tests in Maven IT project running locally in the browser triggered by Continuum when there is any change to webapp, tests or dependencies
    51. Testing in different environments
    52. Multi environment
    53. Multi environment Multiple Browsers
    54. Multi environment Multiple Browsers Multiple Operating Systems
    55. Parallel Run tests in parallel in each browser several browsers per test
    56. Parallel Faster testing Load testing Credits: XKCD
    57. Selenium Grid
    58. TestNG properties Allows to run the same tests in different environments and in parallel
    59. TestNG properties <suite name=quot;Examplequot; parallel=quot;testsquot; thread-count=quot;3quot;> <test name=quot;iexplorequot;> <parameter name=quot;browserquot; value=quot;*iexplorequot;/> <packages> <package name=quot;org.appfuse.webapp.seleniumquot; /> </packages> </test> <test name=quot;firefox2quot;> <parameter name=quot;browserquot; value=quot;*firefox2quot;/> <packages> <package name=quot;org.appfuse.webapp.seleniumquot; /> </packages> </test> <test name=quot;operaquot;> <parameter name=quot;browserquot; value=quot;*operaquot;/> <packages> <package name=quot;org.appfuse.webapp.seleniumquot; /> </packages> </test> </suite>
    60. TestNG properties <suite name=quot;Examplequot; parallel=quot;testsquot; thread-count=quot;3quot;> <test name=quot;iexplorequot;> <parameter name=quot;browserquot; value=quot;*iexplorequot;/> <packages> <package name=quot;org.appfuse.webapp.seleniumquot; /> </packages> </test> <test name=quot;firefox2quot;> <parameter name=quot;browserquot; value=quot;*firefox2quot;/> <packages> <package name=quot;org.appfuse.webapp.seleniumquot; /> </packages> </test> <test name=quot;operaquot;> <parameter name=quot;browserquot; value=quot;*operaquot;/> <packages> <package name=quot;org.appfuse.webapp.seleniumquot; /> </packages> </test> </suite>
    61. breakpoint Selenium tests in Maven IT project running locally in several browsers
    62. and now in the Cloud
    63. Machines cost money
    64. Machines cost money Bandwidth costs money
    65. Machines cost money Bandwidth costs money Electricity costs money
    66. Machines cost money Bandwidth costs money Electricity costs money Server administration costs money
    67. Machines cost money Bandwidth costs money Electricity costs money Server administration costs money
    68. Resource Optimization test servers working 10-20% of the time
    69. Predictions cost money Infrastructure Cost $ time Source: Amazon
    70. Predictions cost money Infrastructure Cost $ Predicted Demand time Source: Amazon
    71. Predictions cost money Infrastructure Cost $ Predicted Demand Traditional Hardware time Source: Amazon
    72. Predictions cost money Infrastructure Cost $ Large Capital Expenditure Predicted Demand Traditional Hardware time Source: Amazon
    73. Predictions cost money Infrastructure Cost $ Predicted Demand Traditional Hardware time Source: Amazon
    74. Predictions cost money Infrastructure Cost $ Predicted Demand Traditional Hardware Actual Demand time Source: Amazon
    75. Predictions cost money Infrastructure Cost $ Predicted Demand Opportunity Traditional Cost Hardware Actual Demand time Source: Amazon
    76. Predictions cost money Infrastructure Cost $ You just lost customers Predicted Demand Opportunity Traditional Cost Hardware Actual Demand time Source: Amazon
    77. Predictions cost money Infrastructure Cost $ Predicted Demand Traditional Hardware Actual Demand Automated Virtualization time Source: Amazon
    78. Availability Can you get 3000 machines in 3 days?
    79. Amazon EC2 Elastic Compute Cloud Machines on demand
    80. Amazon EC2 pay per hour same price for 10 machines / 1 hour 1 machine / 10 hours unlimited number of machines start in couple minutes
    81. AMIs Amazon Machine Images Bundle your own
    82. Countless possibilities Internet Explorer Firefox 2 Opera Safari Firefox 3 Firefox 2 no OS X :(
    83. Amazon AMIs Create AMIs for different environments to test
    84. Amazon AMIs Read user data to customize the images at runtime where is the Selenium Hub
    85. Maven EC2 plugin in progress http://mojo.codehaus.org/maven- ec2-plugin start Amazon AMIs stop at the end of the build pass on user data
    86. Workflow
    87. Starting point Selenium Continuum Hub SVN Jetty Master AMI Amazon EC2
    88. Starting point Selenium OS X Continuum Hub SVN Jetty Master AMI
    89. Build is triggered Selenium OS X Continuum Hub SVN Jetty Master AMI
    90. Start Images Selenium OS X Continuum Hub SVN Jetty Master AMI Windows Server 2003 Windows Server 2003 Linux Linux
    91. Register with Hub Selenium OS X Continuum Hub SVN Jetty Master AMI Windows Server 2003 Windows Server 2003 Linux Linux
    92. Tests call Selenium Selenium OS X Continuum Hub SVN Jetty Master AMI Windows Server 2003 Windows Server 2003 Linux Linux
    93. Distribute tests Selenium OS X Continuum Hub SVN Jetty Master AMI Windows Server 2003 Windows Server 2003 Linux Linux
    94. Run tests against webapp Selenium OS X Continuum Hub SVN Jetty Master AMI Windows Server 2003 Windows Server 2003 Linux Linux
    95. Return results to Hub Selenium OS X Continuum Hub SVN Jetty Master AMI Windows Server 2003 Windows Server 2003 Linux Linux
    96. Return results to builder Selenium OS X Continuum Hub SVN Jetty Master AMI Windows Server 2003 Windows Server 2003 Linux Linux
    97. Kill Images Selenium OS X Continuum Hub SVN Jetty Master AMI Windows Server 2003 Windows Server 2003 Linux Linux
    98. Questions?
    99. eu z. he nc sa s lo ar c w. ww Thanks g r .o e ch pa a s@ rlo ca

    ×