Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.

DevAppServerTestRunner

Stay organized with collections Save and categorize content based on your preferences.
com.google.appengine.tools.development.testing

Class DevAppServerTestRunner

  • java.lang.Object
    • BlockJUnit4ClassRunner
      • com.google.appengine.tools.development.testing.DevAppServerTestRunner


  • public class DevAppServerTestRunner
    extends BlockJUnit4ClassRunner
    A JUnit4 test runner that runs tests in the isolated classloader of a running app engine app. Test classes that are run with this test runner must also be annotated with DevAppServerTest. For example:
     @RunWith(DevAppServerTestRunner.class)
     @DevAppServerTest(MyTest.TestConfig.class)
     public void MyTest {
    
       private final LocalServiceTestHelper testHelper = new LocalServiceTestHelper(
         new LocalURLFetchServiceTestConfig(), new LocalDatastoreServiceTestConfig());
    
       public static class TestConfig extends BaseDevAppServerTestConfig {
    
         public File getSdkRoot() {
           return sdkRoot;
         }
    
         public File getAppDir() {
           return appDir;
         }
    
         public List getClasspath() {
           return urls;
         }
       }
    
       @Before
       public void setUpHelper() {
         testHelper.setUp();
       }
    
       @After
       public void tearDownHelper() {
         testHelper.tearDown();
       }
    
       @Test
       public void testEndToEnd() throws Exception {
         URLFetchService fetchService = URLFetchServiceFactory.getURLFetchService();
         HTTPResponse resp = fetchService.fetch(new URL("http://localhost:" +
           System.getProperty(DevAppServerTest.DEFAULT_PORT_SYSTEM_PROPERTY) + "/insertFoo?id=33"));
         assertEquals(200, resp.getResponseCode());
         DatastoreServiceFactory.getDatastoreService().get(KeyFactory.createKey("foo", 33));
       }
     }
     
    • Constructor Summary

      Constructors 
      Constructor and Description
      DevAppServerTestRunner(java.lang.Class<?> klass) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected void collectInitializationErrors(java.util.List<java.lang.Throwable> errors) 
      protected Statement withAfterClasses(Statement statement) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DevAppServerTestRunner

        public DevAppServerTestRunner(java.lang.Class<?> klass)
                               throws InitializationError
        Throws:
        InitializationError
    • Method Detail

      • collectInitializationErrors

        protected void collectInitializationErrors(java.util.List<java.lang.Throwable> errors)
      • withAfterClasses

        protected Statement withAfterClasses(Statement statement)