Documentation
¶
Overview ¶
Package testerator is TEST execution accelERATOR for GoogleAppEngine/Go starndard environment.
When you call the `aetest.NewInstance`, dev_appserver.py will spinup every time. This is very high cost operation. Testerator compress the time of dev_appserver.py operation.
following code launch dev server. It's slow (~4s).
opt := &aetest.Options{AppID: "unittest", StronglyConsistentDatastore: true} inst, err := aetest.NewInstance(opt)
testerator wrapped devserver spinup. for example.
func TestMain(m *testing.M) { _, _, err := testerator.SpinUp() if err != nil { fmt.Printf(err.Error()) os.Exit(1) } status := m.Run() err = testerator.SpinDown() if err != nil { fmt.Printf(err.Error()) os.Exit(1) } os.Exit(status) } func TestFooBar(t *testing.T) { _, c, err := testerator.SpinUp() if err != nil { t.Fatal(err.Error()) } defer testerator.SpinDown() // write some test! }
If you want to clean up Datastore or Search API or Memcache, You should import above packages.
import ( // do testerator feature setup _ "github.com/favclip/testerator/v3/datastore" _ "github.com/favclip/testerator/v3/memcache" )
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Setup ¶
type Setup struct { Instance aetest.Instance Disable1stGen bool RaisePanic bool Options *aetest.Options Context context.Context Setuppers []Helper Cleaners []Helper ResetThreshold int SpinDowns []chan struct{} sync.Mutex // contains filtered or unexported fields }
Setup contains aetest.Instance and other environment for setup and clean up.
var DefaultSetup *Setup
DefaultSetup uses from bare functions.
func (*Setup) AppendCleanup ¶
func (*Setup) AppendSetuppers ¶
func (*Setup) SpinDown ¶
SpinDown dev server.
This function clean up dev server environment. call each DefaultSetup.Cleaners. usually, it means cleanup Datastore and Search APIs and miscs. see document for SpinUp function.