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. 手动配置 Windows 时间服务

    手动配置 Windows 时间服务 要将内部时间服务器配置为与外部时间源同步,请按照下列步骤操作: 将服务器类型更改为 NTP. 为此,请按照下列步骤操作: 选择 “开始” . “运行”,键入 reg ...

  2. 二叉树实现,C++语言描述

    body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...

  3. Cracking The Coding Interview4.3

    //Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal h ...

  4. SQL3-查找各个部门当前(to_date='9999-01-01')领导当前薪水详情以及其对应部门编号dept_no

    题目描述 查找各个部门当前(to_date='9999-01-01')领导当前薪水详情以及其对应部门编号dept_noCREATE TABLE `dept_manager` (`dept_no` ch ...

  5. fftshift函数详解

    reference: https://ww2.mathworks.cn/help/matlab/ref/fftshift.html 一.实信号情况 因为实信号以fs为采样速率的信号在 fs/2处混叠, ...

  6. U盘如何去除写保护

    用一个简单而粗暴的方法去除U盘写保护: www.upantool.com/hfxf/xiufu//FormatTool.html#softdown 没有比这个更牛的软件了.

  7. kettle在linux下执行任务

    1.下载 最新版下载 7.1 https://community.hitachivantara.com/docs/DOC-1009855 准备 上传任务文件 .kjb,.ktr 上传mysql 驱动 ...

  8. GNU C的定义长度为0的数组

    在标准C和C++中,长度为0的数组是被禁止使用的.不过在GNU C中,存在一个非常奇怪的用法,那就是长度为0的数组,比如Array[0];很多人可能觉得不可思议,长度为0的数组是没有什么意义的,不过在 ...

  9. 进阶ES6 点滴认知

    1.let--不允许重复声明 根据http://es6.ruanyifeng.com/#docs/let 的例子,我竟然 报格式错误 说实话,我也没见过函数这样的写法......然后我就随意加了函数名 ...

  10. Python实现登陆的功能

    import datetimetoday=datetime.datetime.today()# 获取当前时间for i in range(3): username=input("请输入用户名 ...