Skip to content

Testing library for Go App Engine, giving you an appengine.Context fake that forwards to a dev_appserver.py child process.

License

Notifications You must be signed in to change notification settings

mzimmerman/appenginetesting

 
 

Repository files navigation

appenginetesting

Build Status

This package provides an automated way to test Go based appengine applications. It differs from the appengine/aetest package as with appenginetesting the real application can be run alongside a stub module.*

E.g., Your application has the default module and two other modules (default, A, and B). You can run your application under appenginetesting and perform tests against it. Using the []ModuleConfig under Options tells what modules to start (default, A, and B) and appenginetesting additionally starts up a "mock" Context that can be used to generate and maniuplate data for testing.

Features

  • Login/Logout
  • Modules (formerly Backends)
  • Task Queues
  • Using *testing.T to Log (only spew logs on test failure)
  • Logging the SDK output to console (often helpful in debugging) (LogChild)
  • Data Generation
  • Leverages automatic creation/updating of index.yaml based on unit tests

History

It's a combined fork of gae-go-testing and aetest with a number

Installation

Before using this library, you have to install appengine SDK.

This library can be installed as following :

$ go get -u github.com/mzimmerman/appenginetesting

Usage

The documentation has some basic examples. Also see the example application.

func TestMyApp(t *testing.T) {
        c, err := appenginetesting.NewContext(&appenginetesting.Options{
                Debug:   appenginetesting.LogDebug,
                Testing: t,
        })
        if err != nil {
                t.Fatalf("Could not get a context - %v", err)
        }
        defer c.Close()
        // do things
        c.Debugf("Log stuff")
}

goapp test

For the details of various Options that can be used in NewContext, see http://godoc.org/github.com/mzimmerman/appenginetesting#Options

About

Testing library for Go App Engine, giving you an appengine.Context fake that forwards to a dev_appserver.py child process.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%