package 测试

import (
"fmt"
"github.com/magiconair/properties/assert"
"net/http"
"net/http/httptest"
"testing"
) func TestPing(t *testing.T) { for i:=0; i<10; i++ { t.Run("sds", func(t *testing.T) {
t.Parallel()
r := setupRouter()
w := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/ping", nil)
if err != nil {
return
}
r.ServeHTTP(w, req) assert.Equal(t, w.Code, 200)
assert.Equal(t, w.Body.String(), "pong")
assert.Equal(t, w.Body.String(), "pong")
})
} } func BenchmarkPing(b *testing.B) {
b.SetParallelism(100)
for i := 0; i < b.N; i++ { b.RunParallel(func(pb *testing.PB) {
fmt.Println(i)
r := setupRouter() w := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/ping", nil)
if err != nil {
return
}
b.SetBytes(100)
for pb.Next() {
r.ServeHTTP(w, req)
} })
} }

最新文章

  1. how2heap分析系列:2_fastbin_dup
  2. Java基础学习(四)
  3. [原]简易android反编译教程
  4. jquery validate 在ajax提交表单下的验证方法
  5. Linux下执行程序出现 Text file busy 提示时的处理方式
  6. spring applicationContext.xml 文件
  7. shell入门之变量测试 分类: 学习笔记 linux ubuntu 2015-07-10 15:49 31人阅读 评论(0) 收藏
  8. python Debug 单步调试
  9. [虚拟化/云][全栈demo] 为qemu增加一个PCI的watchdog外设(一)
  10. HDU5804--Price List
  11. nyoj940 A dp problem 打表
  12. 【C++】undered_map的用法总结(1)
  13. ngnix使用超时响应时间配置避坑一例
  14. spring @Value注解#和$区别
  15. html中img图片居中
  16. laravel 安装步骤
  17. android 手机不能断点
  18. 【Python】python3实现网页爬虫下载图片
  19. 微信小游戏 50M那部分的缓存机制的使用
  20. jquery closest &amp; parent比较

热门文章

  1. Java 之 Response 发送验证码案例
  2. react native错误排查-TypeError: window.deltaUrlToBlobUrl is not a function
  3. 高阶函数概念以及map/filter/reduce
  4. 申请软件著作权,wps显示代码行号功能
  5. Android笔记(七十五) Android中的图片压缩
  6. 【Mybatis异常】 org.apache.ibatis.binding.BindingException: Parameter &#39;storeId&#39; not found. Available parameters are [form, param1]
  7. Oracle11g安装步骤(CentOS7)
  8. Python入门篇-functools
  9. cmdb资产管理2
  10. centos7最小安装后无法联网解决方法