zoukankan      html  css  js  c++  java
  • golang-test-tool-gotests

    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 ; 

     

  • 相关阅读:
    Maven入门指南12:将项目发布到私服
    Groovy学习:第四章 Groovy特性深入
    jQuery部分疑问及小结
    Windows自动化---模拟鼠标键盘
    适配器
    object都有string
    spinner
    context
    OnclickListener
    学习-----领进门,看个人
  • 原文地址:https://www.cnblogs.com/lavin/p/10062375.html
Copyright © 2011-2022 走看看