SlideShare a Scribd company logo
1 of 23
Download to read offline
Testing Your Application on / for
       Google App Engine
                          Narinder Kumar
                       Inphina Technologies




                                       1
Agenda
   Problem Context
   App Engine Testing Framework
       Local DataStore Testing
       Authentication API Testing
       Memcache Testing
   Google Cloud Cover – An Overview



                                       2
Easy to build, Easy to Maintain,
         Easy to Scale




                                   3
Why Testing
   To verify correctness
    of the code
   To be assured of
    continued
    correctness of old
    code
   To avoid surprises
   To safely make large
    refactorings
I feel sad and naked without Good Test Coverage
                              Max Ross (Member of Google App Engine Team)   4
Do we need App Engine Specific
     Testing Strategies ?




                                 5
Our Goal
To be able to test in our local environment using
   Spring
   Maven
   JPA/JDO
   JUnit
   Continuous Integration



                                                6
Google Infrastructure Services
   DataStore
   Memcache
   TaskQueue
   Authentication
   ...




                                       7
App Engine Testing Framework
   LocalServiceTestHelper
       LocalDataStoreServiceTestConfig
       LocalMemCacheServiceTestConfig
       LocalTaskQueueTestConfig
       LocalUserServiceTestConfig
       ...




                                          8
Local Data Store Testing




                           9
Step 1 : Make RunTime Libraries
        Available Locally
 <dependency>
     <groupid>com.google.appengine</groupid>
     <artifactid>appengine-testing</artifactid>
     <version>1.3.4</version>
     <scope>test</scope>
 </dependency>
 <dependency>
     <groupid>com.google.appengine</groupid>
     <artifactid>appengine-api-labs</artifactid>
     <version>1.3.4</version>
     <scope>test</scope>
 </dependency>
 <dependency>
     <groupid>com.google.appengine</groupid>
     <artifactid>appengine-api-stubs</artifactid>
     <version>1.3.4</version>
     <scope>test</scope>
 </dependency>


 Some of these libraries are not available in Central Maven
                        Repositories                          10
Step 2 : Enhance Domain Classes
 <plugin>
            <groupid>org.datanucleus</groupid>
            <artifactid>maven-datanucleus-plugin</artifactid>
            <version>1.1.4</version>
            <configuration>
            <mappingincludes>**/domain/*.class</mappingincludes>
                 <verbose>true</verbose>
                 <enhancername>ASM</enhancername>
                 <api>JPA</api>
            </configuration>
            <executions>
                 <execution>
                      <phase>compile</phase>
                      <goals>
                          <goal>enhance</goal>
                      </goals>
                 </execution>
            </executions>
 ......
 <plugin>
                                                                   11
Prepare Run-Time Environment
        and Dependencies
@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners( { DependencyInjectionTestExecutionListener.class })
@ContextConfiguration(locations = { "classpath:test-applicationContext.xml",
"classpath:test-applicationContext-dao.xml"})
public class LocalDatastoreSpringTestCase extends TestCase {

  private final LocalServiceTestHelper helper =
     new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());

  @Before
  public void setUp() {
    helper.setUp();
  }

  @After
  public void tearDown() {
    helper.tearDown();
  }


                                                                               12
Write Specific Tests
public class EmployeeDaoSpringTest extends LocalDatastoreSpringTestCase {

    @Autowired
    private EmployeeDao employeeDao;

    @Test
    public void testShouldPersistEmployee() {
         Employee employee = new Employee();
         employee.setFirstName("Scott");
         employee.setLastName("Adams");
         employee.setHireDate(new Date());

        employeeDao.createEmployee(employee);

        Collection<employee> list = employeeDao.list();

        Assert.assertEquals(1, list.size());
    }


                                                                            13
Authentication API Testing
public class AuthenticationTest {

    private final LocalServiceTestHelper helper =
       new LocalServiceTestHelper(new LocalUserServiceTestConfig())
         .setEnvIsAdmin(true).setEnvIsLoggedIn(true);

    @Test
    public void testIsAdmin() {
      UserService userService = UserServiceFactory.getUserService();
      assertTrue(userService.isUserAdmin());
    }

    @Before
    public void setUp() {
      helper.setUp();
    }

    @After
    public void tearDown() {
      helper.tearDown();
    }
}
                                                                       14
Memcache Testing
public class LocalMemcacheTest {

       private final LocalServiceTestHelper helper =
          new LocalServiceTestHelper(new LocalMemcacheServiceTestConfig());

       @Test
       private void testInsert() {
          MemcacheService ms = MemcacheServiceFactory.getMemcacheService();
          assertFalse(ms.contains("yar"));
          ms.put("yar", "foo");
          assertTrue(ms.contains("yar"));
       }}

....
       // SetUp and Tear Down




                                                                              15
Google Cloud Cover – An Overview




                                   16
Key Features
   Provides ability to run your tests in Cloud
   Designed to run Existing Test Suites
   Tests Execute in Parallel
       Creates one Task Queue per Test
       Number of workers determined by Queue Config
   Allows to Run Large Test Suites faster : Acts as
    a Test Grid


                                                       17
How to Set it up
   Create a Standard GAE/J web application with
    all Production Code & Test Code and
    dependencies
   Add Cloud Cover Dependencies to WAR
   Create a TestRunner Config around your Test
    Suite
   Add Cloud Cover Servlet
      http://<your_app_id>/cloudcover.html

                                                  18
Google Cloud Cover in Action




                               19
Different from Normal Testing
   Each Test must complete in 30 seconds

   Application Code and Test Code must obey

    Sandbox restrictions

   Need to invoke Tests via HTTP



                                               20
Conclusions
   Local RunTime Environment very helpful

    during Development Phase

   Google Cloud Cover can be a good aid in

    certain areas but need more refinement



                                              21
nkumar@inphina.com

      www.inphina.com
http://thoughts.inphina.com


                              22
References
   http://code.google.com/appengine/docs/java/tools/localunittesting.html

   http://code.google.com/p/cloudcover/

   http://thoughts.inphina.com/2010/06/28/unit-testing-maven-based-jpa-application-on-gae/

   http://objectuser.wordpress.com/category/software-development/google-app-engine/

   http://code.google.com/events/io/2010/sessions.html#App%20Engine




                                                                                        23

More Related Content

What's hot

Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 javatwo2011
 
Apache Aries Overview
Apache Aries   OverviewApache Aries   Overview
Apache Aries OverviewIan Robinson
 
50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutes50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutesAntonio Goncalves
 
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013Arun Gupta
 
Fifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 MinutesFifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 Minutesglassfish
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5Arun Gupta
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Arun Gupta
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session ManagementFahad Golra
 
Java Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicJava Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicIMC Institute
 
What's new in JMS 2.0 - OTN Bangalore 2013
What's new in JMS 2.0 - OTN Bangalore 2013What's new in JMS 2.0 - OTN Bangalore 2013
What's new in JMS 2.0 - OTN Bangalore 2013Jagadish Prasath
 
OSGi and Eclipse RCP
OSGi and Eclipse RCPOSGi and Eclipse RCP
OSGi and Eclipse RCPEric Jain
 
Java servlets
Java servletsJava servlets
Java servletslopjuan
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jspJafar Nesargi
 

What's hot (20)

Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望
 
Apache Aries Overview
Apache Aries   OverviewApache Aries   Overview
Apache Aries Overview
 
50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutes50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutes
 
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
 
Fifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 MinutesFifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 Minutes
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5
 
Java Enterprise Edition
Java Enterprise EditionJava Enterprise Edition
Java Enterprise Edition
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session Management
 
Java Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicJava Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet Basic
 
JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
 
What's new in JMS 2.0 - OTN Bangalore 2013
What's new in JMS 2.0 - OTN Bangalore 2013What's new in JMS 2.0 - OTN Bangalore 2013
What's new in JMS 2.0 - OTN Bangalore 2013
 
J2EE-assignment
 J2EE-assignment J2EE-assignment
J2EE-assignment
 
OSGi and Eclipse RCP
OSGi and Eclipse RCPOSGi and Eclipse RCP
OSGi and Eclipse RCP
 
JEE Programming - 04 Java Servlets
JEE Programming - 04 Java ServletsJEE Programming - 04 Java Servlets
JEE Programming - 04 Java Servlets
 
Java servlets
Java servletsJava servlets
Java servlets
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
 
Servlet
Servlet Servlet
Servlet
 
Servlets
ServletsServlets
Servlets
 

Viewers also liked

Indic threads pune12-grammar of graphicsa new approach to visualization-karan
Indic threads pune12-grammar of graphicsa new approach to visualization-karanIndic threads pune12-grammar of graphicsa new approach to visualization-karan
Indic threads pune12-grammar of graphicsa new approach to visualization-karanIndicThreads
 
All In Stitches Campaign
All In Stitches CampaignAll In Stitches Campaign
All In Stitches Campaignjbutti
 
Commerce - Orchard Harvest Amsterdam 2013
Commerce - Orchard Harvest Amsterdam 2013Commerce - Orchard Harvest Amsterdam 2013
Commerce - Orchard Harvest Amsterdam 2013Bertrand Le Roy
 
MarkosTiris LSIS East England Learning Fair
MarkosTiris  LSIS East England Learning FairMarkosTiris  LSIS East England Learning Fair
MarkosTiris LSIS East England Learning FairJISC RSC Eastern
 
'Jisc RSC Eastern Learning Resources Managers forum Nov 2013 'Xtlearn informa...
'Jisc RSC Eastern Learning Resources Managers forum Nov 2013 'Xtlearn informa...'Jisc RSC Eastern Learning Resources Managers forum Nov 2013 'Xtlearn informa...
'Jisc RSC Eastern Learning Resources Managers forum Nov 2013 'Xtlearn informa...JISC RSC Eastern
 
Http2 is here! And why the web needs it
Http2 is here! And why the web needs itHttp2 is here! And why the web needs it
Http2 is here! And why the web needs itIndicThreads
 

Viewers also liked (6)

Indic threads pune12-grammar of graphicsa new approach to visualization-karan
Indic threads pune12-grammar of graphicsa new approach to visualization-karanIndic threads pune12-grammar of graphicsa new approach to visualization-karan
Indic threads pune12-grammar of graphicsa new approach to visualization-karan
 
All In Stitches Campaign
All In Stitches CampaignAll In Stitches Campaign
All In Stitches Campaign
 
Commerce - Orchard Harvest Amsterdam 2013
Commerce - Orchard Harvest Amsterdam 2013Commerce - Orchard Harvest Amsterdam 2013
Commerce - Orchard Harvest Amsterdam 2013
 
MarkosTiris LSIS East England Learning Fair
MarkosTiris  LSIS East England Learning FairMarkosTiris  LSIS East England Learning Fair
MarkosTiris LSIS East England Learning Fair
 
'Jisc RSC Eastern Learning Resources Managers forum Nov 2013 'Xtlearn informa...
'Jisc RSC Eastern Learning Resources Managers forum Nov 2013 'Xtlearn informa...'Jisc RSC Eastern Learning Resources Managers forum Nov 2013 'Xtlearn informa...
'Jisc RSC Eastern Learning Resources Managers forum Nov 2013 'Xtlearn informa...
 
Http2 is here! And why the web needs it
Http2 is here! And why the web needs itHttp2 is here! And why the web needs it
Http2 is here! And why the web needs it
 

Similar to Testing Your Application On Google App Engine

Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Appschrisb206 chrisb206
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with AppiumLuke Maung
 
Resume_sindhu
Resume_sindhu Resume_sindhu
Resume_sindhu Sindhu B
 
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)Tobias Schneck
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersJavan Rasokat
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with exampleshadabgilani
 
MuleSoft Nashik Virtual Meetup#4 - Implementing CI/CD pipeline for deploying ...
MuleSoft Nashik Virtual Meetup#4 - Implementing CI/CD pipeline for deploying ...MuleSoft Nashik Virtual Meetup#4 - Implementing CI/CD pipeline for deploying ...
MuleSoft Nashik Virtual Meetup#4 - Implementing CI/CD pipeline for deploying ...Jitendra Bafna
 
Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016Yves Hoppe
 
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic
 
Devfest 2023 - Service Weaver Introduction - Taipei.pdf
Devfest 2023 - Service Weaver Introduction - Taipei.pdfDevfest 2023 - Service Weaver Introduction - Taipei.pdf
Devfest 2023 - Service Weaver Introduction - Taipei.pdfKAI CHU CHUNG
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfLuca Mattia Ferrari
 
Top 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeTop 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeMark Meyer
 
Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Ortus Solutions, Corp
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
Firebase analytics event_201607
Firebase analytics event_201607Firebase analytics event_201607
Firebase analytics event_201607PRADA Hsiung
 
JBCN_Testing_With_Containers
JBCN_Testing_With_ContainersJBCN_Testing_With_Containers
JBCN_Testing_With_ContainersGrace Jansen
 

Similar to Testing Your Application On Google App Engine (20)

Google Cloud Platform
Google Cloud Platform Google Cloud Platform
Google Cloud Platform
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
 
Resume_sindhu
Resume_sindhu Resume_sindhu
Resume_sindhu
 
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
 
Junit_.pptx
Junit_.pptxJunit_.pptx
Junit_.pptx
 
Pyramid deployment
Pyramid deploymentPyramid deployment
Pyramid deployment
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
MuleSoft Nashik Virtual Meetup#4 - Implementing CI/CD pipeline for deploying ...
MuleSoft Nashik Virtual Meetup#4 - Implementing CI/CD pipeline for deploying ...MuleSoft Nashik Virtual Meetup#4 - Implementing CI/CD pipeline for deploying ...
MuleSoft Nashik Virtual Meetup#4 - Implementing CI/CD pipeline for deploying ...
 
Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016
 
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
 
Devfest 2023 - Service Weaver Introduction - Taipei.pdf
Devfest 2023 - Service Weaver Introduction - Taipei.pdfDevfest 2023 - Service Weaver Introduction - Taipei.pdf
Devfest 2023 - Service Weaver Introduction - Taipei.pdf
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdf
 
Top 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers MakeTop 10 Mistakes AngularJS Developers Make
Top 10 Mistakes AngularJS Developers Make
 
Codeception
CodeceptionCodeception
Codeception
 
Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
Firebase analytics event_201607
Firebase analytics event_201607Firebase analytics event_201607
Firebase analytics event_201607
 
JBCN_Testing_With_Containers
JBCN_Testing_With_ContainersJBCN_Testing_With_Containers
JBCN_Testing_With_Containers
 

More from IndicThreads

Understanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
Understanding Bitcoin (Blockchain) and its Potential for Disruptive ApplicationsUnderstanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
Understanding Bitcoin (Blockchain) and its Potential for Disruptive ApplicationsIndicThreads
 
Go Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang wayGo Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang wayIndicThreads
 
Building Resilient Microservices
Building Resilient Microservices Building Resilient Microservices
Building Resilient Microservices IndicThreads
 
App using golang indicthreads
App using golang  indicthreadsApp using golang  indicthreads
App using golang indicthreadsIndicThreads
 
Building on quicksand microservices indicthreads
Building on quicksand microservices  indicthreadsBuilding on quicksand microservices  indicthreads
Building on quicksand microservices indicthreadsIndicThreads
 
How to Think in RxJava Before Reacting
How to Think in RxJava Before ReactingHow to Think in RxJava Before Reacting
How to Think in RxJava Before ReactingIndicThreads
 
Iot secure connected devices indicthreads
Iot secure connected devices indicthreadsIot secure connected devices indicthreads
Iot secure connected devices indicthreadsIndicThreads
 
Real world IoT for enterprises
Real world IoT for enterprisesReal world IoT for enterprises
Real world IoT for enterprisesIndicThreads
 
IoT testing and quality assurance indicthreads
IoT testing and quality assurance indicthreadsIoT testing and quality assurance indicthreads
IoT testing and quality assurance indicthreadsIndicThreads
 
Functional Programming Past Present Future
Functional Programming Past Present FutureFunctional Programming Past Present Future
Functional Programming Past Present FutureIndicThreads
 
Harnessing the Power of Java 8 Streams
Harnessing the Power of Java 8 Streams Harnessing the Power of Java 8 Streams
Harnessing the Power of Java 8 Streams IndicThreads
 
Building & scaling a live streaming mobile platform - Gr8 road to fame
Building & scaling a live streaming mobile platform - Gr8 road to fameBuilding & scaling a live streaming mobile platform - Gr8 road to fame
Building & scaling a live streaming mobile platform - Gr8 road to fameIndicThreads
 
Internet of things architecture perspective - IndicThreads Conference
Internet of things architecture perspective - IndicThreads ConferenceInternet of things architecture perspective - IndicThreads Conference
Internet of things architecture perspective - IndicThreads ConferenceIndicThreads
 
Cars and Computers: Building a Java Carputer
 Cars and Computers: Building a Java Carputer Cars and Computers: Building a Java Carputer
Cars and Computers: Building a Java CarputerIndicThreads
 
Scrap Your MapReduce - Apache Spark
 Scrap Your MapReduce - Apache Spark Scrap Your MapReduce - Apache Spark
Scrap Your MapReduce - Apache SparkIndicThreads
 
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
 Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & DockerIndicThreads
 
Speed up your build pipeline for faster feedback
Speed up your build pipeline for faster feedbackSpeed up your build pipeline for faster feedback
Speed up your build pipeline for faster feedbackIndicThreads
 
Unraveling OpenStack Clouds
 Unraveling OpenStack Clouds Unraveling OpenStack Clouds
Unraveling OpenStack CloudsIndicThreads
 
Digital Transformation of the Enterprise. What IT leaders need to know!
Digital Transformation of the Enterprise. What IT  leaders need to know!Digital Transformation of the Enterprise. What IT  leaders need to know!
Digital Transformation of the Enterprise. What IT leaders need to know!IndicThreads
 
Architectural Considerations For Complex Mobile And Web Applications
 Architectural Considerations For Complex Mobile And Web Applications Architectural Considerations For Complex Mobile And Web Applications
Architectural Considerations For Complex Mobile And Web ApplicationsIndicThreads
 

More from IndicThreads (20)

Understanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
Understanding Bitcoin (Blockchain) and its Potential for Disruptive ApplicationsUnderstanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
Understanding Bitcoin (Blockchain) and its Potential for Disruptive Applications
 
Go Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang wayGo Programming Language - Learning The Go Lang way
Go Programming Language - Learning The Go Lang way
 
Building Resilient Microservices
Building Resilient Microservices Building Resilient Microservices
Building Resilient Microservices
 
App using golang indicthreads
App using golang  indicthreadsApp using golang  indicthreads
App using golang indicthreads
 
Building on quicksand microservices indicthreads
Building on quicksand microservices  indicthreadsBuilding on quicksand microservices  indicthreads
Building on quicksand microservices indicthreads
 
How to Think in RxJava Before Reacting
How to Think in RxJava Before ReactingHow to Think in RxJava Before Reacting
How to Think in RxJava Before Reacting
 
Iot secure connected devices indicthreads
Iot secure connected devices indicthreadsIot secure connected devices indicthreads
Iot secure connected devices indicthreads
 
Real world IoT for enterprises
Real world IoT for enterprisesReal world IoT for enterprises
Real world IoT for enterprises
 
IoT testing and quality assurance indicthreads
IoT testing and quality assurance indicthreadsIoT testing and quality assurance indicthreads
IoT testing and quality assurance indicthreads
 
Functional Programming Past Present Future
Functional Programming Past Present FutureFunctional Programming Past Present Future
Functional Programming Past Present Future
 
Harnessing the Power of Java 8 Streams
Harnessing the Power of Java 8 Streams Harnessing the Power of Java 8 Streams
Harnessing the Power of Java 8 Streams
 
Building & scaling a live streaming mobile platform - Gr8 road to fame
Building & scaling a live streaming mobile platform - Gr8 road to fameBuilding & scaling a live streaming mobile platform - Gr8 road to fame
Building & scaling a live streaming mobile platform - Gr8 road to fame
 
Internet of things architecture perspective - IndicThreads Conference
Internet of things architecture perspective - IndicThreads ConferenceInternet of things architecture perspective - IndicThreads Conference
Internet of things architecture perspective - IndicThreads Conference
 
Cars and Computers: Building a Java Carputer
 Cars and Computers: Building a Java Carputer Cars and Computers: Building a Java Carputer
Cars and Computers: Building a Java Carputer
 
Scrap Your MapReduce - Apache Spark
 Scrap Your MapReduce - Apache Spark Scrap Your MapReduce - Apache Spark
Scrap Your MapReduce - Apache Spark
 
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
 Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
 
Speed up your build pipeline for faster feedback
Speed up your build pipeline for faster feedbackSpeed up your build pipeline for faster feedback
Speed up your build pipeline for faster feedback
 
Unraveling OpenStack Clouds
 Unraveling OpenStack Clouds Unraveling OpenStack Clouds
Unraveling OpenStack Clouds
 
Digital Transformation of the Enterprise. What IT leaders need to know!
Digital Transformation of the Enterprise. What IT  leaders need to know!Digital Transformation of the Enterprise. What IT  leaders need to know!
Digital Transformation of the Enterprise. What IT leaders need to know!
 
Architectural Considerations For Complex Mobile And Web Applications
 Architectural Considerations For Complex Mobile And Web Applications Architectural Considerations For Complex Mobile And Web Applications
Architectural Considerations For Complex Mobile And Web Applications
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
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
 

Testing Your Application On Google App Engine

  • 1. Testing Your Application on / for Google App Engine Narinder Kumar Inphina Technologies 1
  • 2. Agenda  Problem Context  App Engine Testing Framework  Local DataStore Testing  Authentication API Testing  Memcache Testing  Google Cloud Cover – An Overview 2
  • 3. Easy to build, Easy to Maintain, Easy to Scale 3
  • 4. Why Testing  To verify correctness of the code  To be assured of continued correctness of old code  To avoid surprises  To safely make large refactorings I feel sad and naked without Good Test Coverage Max Ross (Member of Google App Engine Team) 4
  • 5. Do we need App Engine Specific Testing Strategies ? 5
  • 6. Our Goal To be able to test in our local environment using  Spring  Maven  JPA/JDO  JUnit  Continuous Integration 6
  • 7. Google Infrastructure Services  DataStore  Memcache  TaskQueue  Authentication  ... 7
  • 8. App Engine Testing Framework  LocalServiceTestHelper  LocalDataStoreServiceTestConfig  LocalMemCacheServiceTestConfig  LocalTaskQueueTestConfig  LocalUserServiceTestConfig  ... 8
  • 9. Local Data Store Testing 9
  • 10. Step 1 : Make RunTime Libraries Available Locally <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-testing</artifactid> <version>1.3.4</version> <scope>test</scope> </dependency> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-api-labs</artifactid> <version>1.3.4</version> <scope>test</scope> </dependency> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-api-stubs</artifactid> <version>1.3.4</version> <scope>test</scope> </dependency> Some of these libraries are not available in Central Maven Repositories 10
  • 11. Step 2 : Enhance Domain Classes <plugin> <groupid>org.datanucleus</groupid> <artifactid>maven-datanucleus-plugin</artifactid> <version>1.1.4</version> <configuration> <mappingincludes>**/domain/*.class</mappingincludes> <verbose>true</verbose> <enhancername>ASM</enhancername> <api>JPA</api> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>enhance</goal> </goals> </execution> </executions> ...... <plugin> 11
  • 12. Prepare Run-Time Environment and Dependencies @RunWith(SpringJUnit4ClassRunner.class) @TestExecutionListeners( { DependencyInjectionTestExecutionListener.class }) @ContextConfiguration(locations = { "classpath:test-applicationContext.xml", "classpath:test-applicationContext-dao.xml"}) public class LocalDatastoreSpringTestCase extends TestCase { private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); @Before public void setUp() { helper.setUp(); } @After public void tearDown() { helper.tearDown(); } 12
  • 13. Write Specific Tests public class EmployeeDaoSpringTest extends LocalDatastoreSpringTestCase { @Autowired private EmployeeDao employeeDao; @Test public void testShouldPersistEmployee() { Employee employee = new Employee(); employee.setFirstName("Scott"); employee.setLastName("Adams"); employee.setHireDate(new Date()); employeeDao.createEmployee(employee); Collection<employee> list = employeeDao.list(); Assert.assertEquals(1, list.size()); } 13
  • 14. Authentication API Testing public class AuthenticationTest { private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalUserServiceTestConfig()) .setEnvIsAdmin(true).setEnvIsLoggedIn(true); @Test public void testIsAdmin() { UserService userService = UserServiceFactory.getUserService(); assertTrue(userService.isUserAdmin()); } @Before public void setUp() { helper.setUp(); } @After public void tearDown() { helper.tearDown(); } } 14
  • 15. Memcache Testing public class LocalMemcacheTest { private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalMemcacheServiceTestConfig()); @Test private void testInsert() { MemcacheService ms = MemcacheServiceFactory.getMemcacheService(); assertFalse(ms.contains("yar")); ms.put("yar", "foo"); assertTrue(ms.contains("yar")); }} .... // SetUp and Tear Down 15
  • 16. Google Cloud Cover – An Overview 16
  • 17. Key Features  Provides ability to run your tests in Cloud  Designed to run Existing Test Suites  Tests Execute in Parallel  Creates one Task Queue per Test  Number of workers determined by Queue Config  Allows to Run Large Test Suites faster : Acts as a Test Grid 17
  • 18. How to Set it up  Create a Standard GAE/J web application with all Production Code & Test Code and dependencies  Add Cloud Cover Dependencies to WAR  Create a TestRunner Config around your Test Suite  Add Cloud Cover Servlet http://<your_app_id>/cloudcover.html 18
  • 19. Google Cloud Cover in Action 19
  • 20. Different from Normal Testing  Each Test must complete in 30 seconds  Application Code and Test Code must obey Sandbox restrictions  Need to invoke Tests via HTTP 20
  • 21. Conclusions  Local RunTime Environment very helpful during Development Phase  Google Cloud Cover can be a good aid in certain areas but need more refinement 21
  • 22. nkumar@inphina.com www.inphina.com http://thoughts.inphina.com 22
  • 23. References  http://code.google.com/appengine/docs/java/tools/localunittesting.html  http://code.google.com/p/cloudcover/  http://thoughts.inphina.com/2010/06/28/unit-testing-maven-based-jpa-application-on-gae/  http://objectuser.wordpress.com/category/software-development/google-app-engine/  http://code.google.com/events/io/2010/sessions.html#App%20Engine 23