gotests介绍

gotests是一个Golang命令行工具 ,让Go测试变得容易。它根据目标源文件的函数和方法签名生成表驱动的测试(TDD)。任何测试文件中新的依赖都会被自动倒入

Demo

下面是gotests在使用Sublime Text 3插件时的情况。此外他还支持Emacs、Emacs、Vim、Atom Editor、Visual Studio Code和IntelliJ Goland。

Installation

Go最小版本 : Go 1.6

Use go get to install and update:

$ go get -u github.com/cweill/gotests/...

命令行可选参数如下:

  -all           为所有函数和方法生成go测试用例

  -excl          支持正则,为未匹配的函数和方法生成测试用例。优先级高于-only、-export和-all

  -exported      为导出的函数和方法生成GO测试。优先级高于 -all 和-only

  -i             在错误消息中打印测试输入

  -only          支持正则,只对匹配的函数生效,优先级高于 -all

  -w             将输出信息写入文件而非直接输出

  -nosubtests    关闭自动生成功能,仅对Go 1.7+有效

  -template_dir  可选参数,指定测试代码保存目录

使用demo(自动生成go测试用例):
gotests -all -w  xxx.go

goland-generate-test-cases-for-file ;

1, point current go file ,right menu ,select Generate ...

2,select "Tests for fiile ",

then it helped generate  main case for file ;

golang-test-tool-gotests的更多相关文章

  1. golang运算与循环等

    一.golang运算符 1.算术运算符 + 相加- 相减* 相乘/ 相除% 求余++ 自增-- 自减 2.关系运算符 == 等于!= 不等于> 大于< 小于>= 大于等于<= ...

  2. Golang资料集

    <Platform-native GUI library for Go> 介绍:跨平台的golang GUI库,支持Windows(xp以上),Unix,Mac OS X(Mac OS X ...

  3. go语言项目汇总

    Horst Rutter edited this page 7 days ago · 529 revisions Indexes and search engines These sites prov ...

  4. go语言,第三方包相对路径导入包引起的问题及解决方案(goquery)

    对go语言而言,跟踪init很显然包有且仅有一次被导入的可能. 但是重复引用了goquery包,后编译出现问题 项目涉及相关目录 ├── main.go└── parse    └── parse.g ...

  5. 高手问答精选:Go 语言 —— 云计算时代的 C 语言(类似于一个FAQ)

    Go 语言被称为云计算时代的 C 语言,它在软件开发效率和运行效率之间做出了绝佳的权衡.这使得它既适应于互联网应用的极速开发,又能在高并发.高性能的开发场景中如鱼得水.正因如此,许多互联网公司,尤其是 ...

  6. Grafana+Prometheus实现Ceph监控和钉钉告警-转载(云栖社区)

    获取软件包 最新的软件包获取地址 https://prometheus.io/download/ Prometheus 1.下载Prometheus $ wget https://github.com ...

  7. Golang tool:include spider library,image library and some other db library such as mysql,redis,mogodb,hbase,cassandra

    一.Go_tool This is a tool library for Golang.Dont't worry about not understant it! All comment writes ...

  8. 【Golang】 可以自动生成测试用例的库--gotests

    简介 gotests是一个Golang命令行工具,它可以使编写Go的测试代码变得容易.它能基于目标源文件的函数和方法生成数据驱动测试用例,并且在此过程会自动导入任何依赖. 下面是gotests在使用S ...

  9. gorename: easy refactoring tool for Golang[转]

    To inaugurate this attempt of blog, I’ll talk about gorename a small but incredibly useful tool I ju ...

  10. Golang汇编命令解读

    我们可以很容易将一个golang程序转变成汇编语言. 比如我写了一个main.go: package main func g(p int) int { return p+1; } func main( ...

随机推荐

  1. URL组成成分及各部分作用简介及urllib.parse / uri

    URL的一般格式为(带方括号[]的为可选项): protocol :// hostname[:port] / path / [;parameters][?query]#fragment urllib. ...

  2. [Leetcode 739]*还有几天会升温 Daily Temperatures

    [题目] Given a list of daily temperatures T, return a list such that, for each day in the input, tells ...

  3. Class file collision

    ecplise报错,提示:Class file collision (类文件冲突) 原因是:文件保存(编译)后,生成了class文件起了冲突,windows 系统认为Test.class 和test. ...

  4. cxf http 代码自动生成

    1.下载 cxf 直接进入镜像下载http://mirrors.tuna.tsinghua.edu.cn/apache/cxf/3.1.12/apache-cxf-3.1.12.zip 2.配置 CX ...

  5. netty pipeline.addLast

    pipeline有一个主要的实现类 DefaultChannelPipeline ,addLast顾名思义,就是在处理器链的最后添加一个channelHandler. 代码如下:@Override  ...

  6. MVC4.0实现批量删除

    HTML: @using(Html.BeginForm("Delete","Home")){    <div>    <input type= ...

  7. <Redis Advance><Pipelining><Memory Optimization><Expire><Transactions>

    Overview About Redis pipelining About Redis memory optimization About Redis expire About Redis trans ...

  8. L291

    If you are currently in the midst of planning a wedding, then I don't need to tell you how stressful ...

  9. js基础 三种弹出框 数据类型

    总结:js三个组成部分ES:语法DOM:对象模型 => 通过js代码与页面文档(出现在body中的所有可视化标签)进行交互BOM:对象模型 => 通过js代码与浏览器自带功能进行交互 引入 ...

  10. FCC JS基础算法题(7):Chunky Monkey(分割数组)

    题目描述: 把一个数组arr按照指定的数组大小size分割成若干个数组块. 例如:chunk([1,2,3,4],2)=[[1,2],[3,4]]; chunk([1,2,3,4,5],2)=[[1, ...