假设我书写了很多测试用例,测试用例中都有:require 'test/unit'
后来我想把很多这样的测试用例组织在一起运行,我使用了两个require:
require 'test/unit'
require 'test/unit/ui/console/testrunner'
于是我运行如下用例集合:
include Test::Unit::UI::Console
testcases = [TC_AddPeople]
testcases.each{|testcase|
TestRunner.run(testcase)}
我得到的错误提示如下:
Loaded suite TC_AddPeople
uninitialized constant Test::Unit::TestCase::STARTED_OBJECT
D:/Ruby193New/lib/ruby/gems/1.9.1/gems/test-unit-2.5.5/lib/test/unit/ui/console/testrunner.rb:80:in `attach_to_mediator'
D:/Ruby193New/lib/ruby/gems/1.9.1/gems/test-unit-2.5.5/lib/test/unit/ui/testrunner.rb:23:in `start'
D:/Ruby193New/lib/ruby/gems/1.9.1/gems/test-unit-2.5.5/lib/test/unit/ui/testrunnerutilities.rb:24:in `run' 在google,baidu里面,都没能搜索出这个问题的解决方案
这应该是test/unit的一个bug,解决方案就是:
在不需要用require 'test/unit'的地方,尽量不要用require ‘test/unit'
去掉测试用例集合中的require 'test/unit'即可。

Watir: 在使用test/unit的时候要注意,不需要require的时候别require的更多相关文章

  1. C/C++ unit testing tools (39 found)---reference

    http://www.opensourcetesting.org/unit_c.php API Sanity AutoTest Description: An automatic generator ...

  2. nginx unit nodejs 模块试用(续)

      最新(应该是18 年了)nginx unit 发布了新的版本,对于nodejs 的支持有很大的改进,上次测试过,问题还是 比较多,这次使用新版本在测试下对于nodejs 的支持,以及以前block ...

  3. nginx unit nodejs 模块试用

      unit 对于nodejs 的支持是在10.25 发布的,基本能用,但是依然有好多问题,当前在测试的时候就发现,请求之后会block , 相关的issue 已经有人反馈了,最好使用源码编译,方便测 ...

  4. [Unit Testing] Mock a Node module's dependencies using Proxyquire

    Sometimes when writing a unit test, you know that the module you're testing imports a module that yo ...

  5. [Unit Testing] Unit Test a Function that Invokes a Callback with a Sinon Spy

    Unit testing functions that invoke callbacks can require a lot of setup code. Using sinon.spy to cre ...

  6. Watir单元库

    http://www.cnblogs.com/Javame/p/4045229.html test: #require 'net/http' #require 'uri' #url = URI.par ...

  7. 一分钟了解ruby中的单测

    之前用gtest写过很多c++的单测case, 对gtest的强大和灵活印象深刻:最近需要用ruby写一个小工具, 接触了下ruby, 写了代码就要写单测啊(好的单测确实对代码的健壮性和正确性保证上太 ...

  8. 开发者的利器:Docker 理解与使用

    困扰写代码的机器难免会被我们安装上各种各样的开发工具.语言运行环境和引用库等一大堆的东西,长久以来不仅机器乱七八糟,而且有些相同的软件还有可能会安装不同的版本,这样又会导致一个项目正常运行了,却不小心 ...

  9. Vue.js——60分钟webpack项目模板快速入门

    概述 browserify是一个 CommonJS风格的模块管理和打包工具,上一篇我们简单地介绍了Vue.js官方基于browserify构筑的一套开发模板.webpack提供了和browserify ...

随机推荐

  1. P3378 堆【模板】 洛谷

    https://www.luogu.org/problem/show?pid=3378 题目描述 如题,初始小根堆为空,我们需要支持以下3种操作: 操作1: 1 x 表示将x插入到堆中 操作2: 2 ...

  2. 1.关于无rospy.spin()调用多次callback 2. subscrib后面语句和callback函数运行顺序

    #!/usr/bin/env python import rospy from bzrobot_msgs.msg import bzr_WheelLinearVels #from threading ...

  3. Codeforces 961 E Tufurama

    Discription One day Polycarp decided to rewatch his absolute favourite episode of well-known TV seri ...

  4. Mysql学习记录点

    order by 数字,表示按照第几列来排序,可以从1开始,不能是0,也不能超过列数.

  5. Win10 LTSB版本安装

    win10 LTSB版本可以看作是 win10的阉割版,没有了几乎用不到还占资源的应用商店.小娜.没有了 EDGE只有IE11....云云 下载地址  https://msdn.itellyou.cn ...

  6. CF 558B(Amr and The Large Array-计数)

    B. Amr and The Large Array time limit per test 1 second memory limit per test 256 megabytes input st ...

  7. 几种自己主动运行js代码的方式

    近期在看jquery,发现他竟然能自己主动运行js代码,于是就查了下.收集了几种经常使用的实现方法 jquery的方法 使用场景:不论什么须要运行的js特效 $(document).ready(fun ...

  8. push代码到github时,每次都要输入用户名和密码的问题

    问题原由 我在Github上 建立了一个小项目TauStreamingServer,可是在每次push代码 的时候,都要求输入用户名和密码,很是麻烦. 如何才能避免每次都输入用户名和密码呢? 解决办法 ...

  9. WebService CXF Spring

    web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=" ...

  10. php新版本号废弃 preg_replace /e 修饰符

    近期serverphp版本号升级到了 5.6  发现出了非常多警告 preg_replace(): The /e modifier is deprecated, use preg_replace_ca ...