服务器
go test -coverprofile=c.out 生成覆盖文件
package main
import (
"errors"
"fmt"
"io/ioutil"
"net/http..."
"net/http/httptest"
"os"
"strings"
"testing"
)
func errPanic(writer http.ResponseWriter, request...()
request := httptest.NewRequest(http.MethodGet, "http://www.imooc.com", nil)
f(response, request...浏览器显示具体的覆盖率和具体覆盖部分
http测试
通过使用假的request/response(在httptest库中,速度快,密度细,像单元测试)
通过起服务器(集成度高,代码覆盖量大)
四.查看文档.../加载配置信息,使生效
在命令行执行godoc -http=localhost:6060后, 直接在浏览器,访问 http://localhost:6060/pkg/
用注释写文档
在测试中加入example