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. 《Python》线程之锁、信号量、事件、条件、定时器、队列

    一.锁 线程为什么要有锁: += .-= 赋值操作数据不安全(要经过取值.计算.放回值,3部操作) pop .append 都是数据安全的(只有添加和删除,一次操作) 队列也是数据安全的 1.同步锁 ...

  2. turtle

    画一组同切圆 输入 import turtle turtle.color('red') turtle.circle(30) turtle.circle(60) turtle.circle(90) tu ...

  3. UGUI动态绑定事件

    using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;using UnityEngine. ...

  4. pytest启动浏览器,失败用例截图

    1.conftest.py # coding:utf- from selenium import webdriver import pytest driver = None @pytest.mark. ...

  5. Linux:软件包安装

    软件包安装 一.rpm安装 1.挂载系统:mount /dev/cdrom/ /mnt/cdrom/ 2.进入相应的目录(Centos7 为Packages,有一些是Server):cd /mnt/c ...

  6. 记一次给nginx的web服务器目录加软链接

    先期情况和问题 已安装好nginx服务器和相关配置.nginx的web目录是/usr/share/nginx/html. 现在的问题是希望把web目录换成/root/nginx/html/,但是不更改 ...

  7. Python 数据处理库 pandas 入门教程

    Python 数据处理库 pandas 入门教程2018/04/17 · 工具与框架 · Pandas, Python 原文出处: 强波的技术博客 pandas是一个Python语言的软件包,在我们使 ...

  8. TCP/IP协议的四个层及作用

  9. 在线播放Video/PDF/JPG

    Label1.Text = Play(url, , ); public string Play(string url, int width, int height) { string strTmp = ...

  10. 使用 TortoiseSVN 创建 svn branch

    1.使用TortoiseSVN->Repo-browser进入仓库. 2.选择需要创建分支的文件->Copy to 添加分支路径后,点击ok Rename:trunk路径 格式:https ...