aetest.NewContext()是否需要参数?

I am learning how to create Golang tests for an Appengine app.

The documentation examples don't make sense to me.

https://cloud.google.com/appengine/docs/standard/go/tools/localunittesting/reference

Documentation seems to say you can create a context := aetest.NewContext()

When I attempt to do so, I'm getting an error that aetest.NewContext requires arguments.

$ go test -v  

./skincare_test.go:12: not enough arguments in call to aetest.NewContext  
    have ()  
    want (*aetest.Options)  
./skincare_test.go:12: assignment count mismatch: 3 = 2  
FAIL    _/Users/Bryan/work/gocode/skincarereview [build failed]  

content of skincare_test.go:

package skincare  

import (  
    "net/http"  
    "net/http/httptest"  
    "testing"  

    "appengine/aetest"  
)  

func TestIndexHandler(t *testing.T) {  
    ctx, done, err := aetest.NewContext()  
    if err != nil {  
        t.Fatal(err)  
    }  
    defer done()  

    req, err := http.NewRequest("GET", "/", nil)  
    if err != nil {  
        t.Fatal(err)  
    }  

    rr := httptest.NewRecorder()  
    handler := http.HandlerFunc(root) 

    handler.ServeHTTP(rr, req)  

    if status := rr.Code; status != http.StatusOK {  
        t.Errorf("handler returned wrong status code: got %v want %v",  
            status, http.StatusOK)  
    }  

    expected := "<div>Name"  
    if rr.Body.String() != expected {  
        t.Errorf("handler returned expected body: got %v want %v",  
            rr.Body.String(), expected)  
    }  
}

I learn best by looking at example code, where can I find examples of Tests for Go web applications that use Appengine datastore?

The examples in the documentation are so simple that I don't see how I'm supposed to do more complicated testing.

It says 2 things:

1) You are missing a required parameter *aetest.Options

2) that you can NOT assign result aetest.NewContext() that consist of 2 variable to a set of 3 variables.

Check what is the output of the function. I guess it is just (context.Context, error) - I suspect the done is moved to the *aetest.Options somehow.

Unfortunately my access to docs is blocked right now.

You are using the old version of the app engine package (appengine/aetest instead of google.golang.org/appengine/aetest). The newer version does not require arguments.