jjzjj

XMind2TestCase

全部标签

ruby-on-rails - 如何在 ActionController::TestCase 请求中设置内容类型

我试图像这样在我的测试用例中执行获取:request.env['CONTENT_TYPE']='application/json'get:index,:application_name=>"Heka"虽然,它失败了:ActionView::MissingTemplate:Missingtemplatealarm_events/indexwith{:handlers=>[:builder,:haml,:erb,:rjs,:rhtml,:rxml],:locale=>[:en,:en],:formats=>[:html]尽管在我的Controller中我有:respond_to:html,

ruby - 如何从 Test::Unit::TestCase 获取堆栈跟踪

我正在测试一些Ruby代码并且有一个失败的Test::Unit::TestCase。不幸的是,失败报告只给我最上面的错误,而不是完整的堆栈跟踪。具体来说,它说:1)Failure:test_tp_make(TestScripts::TestTpMake)[test/test_scripts.rb:73]:Exceptionraised:>.引用的行号(73)是我的测试用例中assert_nothing_raised代码块的开始,它又开始了另一个代码块,该代码块又调用了一个大型库。我已经尝试使用--verbose标志运行测试,不幸的是这不会改变异常输出。我尝试查阅Test::Unit文档

ruby - 从 TestCase 调用 Sinatra 应用程序实例方法

我在Sinatra应用程序中有一个util方法,我想从我的TestCase进行测试.问题是我不知道如何调用它,如果我只使用app.util_method我有错误NameError:undefinedlocalvariableormethod'util_method'for#我的应用.rb:classMyAppmy_app_test.rb:require"my_app.rb"require"test/unit"require"rack/test"classMyAppTest 最佳答案 西纳特拉aliasesthenewmethodto

ruby - 什么时候使用 MiniTest::Unit::TestCase 与 MiniTest::Spec?

我一直在使用MiniTest学习TDD/BDD。我想弄清楚的是我的代码的哪些部分应该使用MiniTest::Unit::TestCase进行测试,哪些部分应该使用MiniTest::Spec进行测试。我了解单元测试和集成测试之间的区别,我似乎无法从网络上的示例中掌握的是TestCase和Spec是否都是单元测试,或者TestCase是否用于单元测试以及用于集成测试的规范?我是否应该在MiniTest::Unit::TestCase类中保留我的快速单元测试,在MiniTest::Spec期望中保留更长时间的集成测试,后者更经常描述功能?这有关系吗,还是个人喜好问题?

ruby-on-rails - 在 Ruby on Rails TestCase 中开启完整回溯

运行时只显示一行回溯:raketest输出:...ERRORshouldgetsearchforkeywords(1.93s)NoMethodError:undefinedmethod`features'for#/usr/lib/ruby/gems/1.9.1/gems/activemodel-3.1.0/lib/active_model/attribute_methods.rb:385:in`method_missing'...我需要更多行的回溯信息。我试过了rake测试--traceRails.backtrace_cleaner.remove_silencers!在config/i

ruby - 在 Ruby 的 Test::Unit::TestCase 中,如何覆盖初始化方法?

我正在为Test::Unit苦苦挣扎。当我想到单元测试时,我会想到每个文件一个简单的测试。但在Ruby的框架中,我必须改写:classMyTest但是每次调用test_*方法时都会运行设置和拆卸。这正是我不想要的。相反,我想要一个只为整个类(class)运行一次的设置方法。但是我似乎无法在不破坏TestCase的初始化的情况下编写自己的initialize()。这可能吗?还是我让这件事变得无可救药地复杂了? 最佳答案 如HalFulton的书“TheRubyWay”中所述。他覆盖了Test::Unit的self.suite方法,该方

c# - 有没有办法将委托(delegate)传递给 NUnit TestCase 或 TestFixture?

基本上,我希望能够将方法插入到NUnit中的TestCase或TestFixture中以改变行为。本质上我想这样做:[TestFixture]publicclassMethodTests{publicdelegatevoidSimpleDelegate();publicstaticvoidA(){//Dosomethingmeaningful}publicstaticvoidB(){//Dosomethingmeaningful}publicstaticvoidC(){//Dosomethingmeaningful}[TestCase(A,B,C)][TestCase(C,A,B)][

php - Laravel 4 PHP fatal error : Class 'Illuminate\Foundation\Testing\TestCase' not found

当我使用Laravel4运行phpunit时出现以下错误。PHPFatalerror:Class'Illuminate\Foundation\Testing\TestCase'notfoundinComposer.json"require":{"laravel/framework":"4.0.*","phpunit/phpunit":"3.7.*"},应用.php'Illuminate\Foundation\Testing\TestCase'我应该做什么? 最佳答案 看起来自动加载不包含新要求。请务必运行composerupdate

php - Symfony: fatal error :找不到类 'PHPUnit_Framework_TestCase'

使用Symfony2.0,我有一个在本地主机上正常工作的整个系统。现在我尝试将其上传到Internet托管。在处理一些错误后,我被困在这里:Fatalerror:Class'PHPUnit_Framework_TestCase'notfoundin/home/preparatest/www/Symfony/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php(顺便说一句,该类确实存在于该目录中)。有人通过这个吗?注意:我没有特别配置PHPUnit。我想它只是包含在一些Symfony包中。我真的不知道

php - fatal error : Class 'PHPUnit_Framework_TestCase' not found

我正在使用XAMPP1.8.1、Windows764位、NetbeansIDE7.4我已经安装了PHPUnit。当我运行代码时,出现以下错误。Fatalerror:Class'PHPUnit_Framework_TestCase'notfoundinD:\xampp\htdocs\PHPUnit\index.phponline6代码是:assertEquals(0,count($stack));array_push($stack,'foo');$this->assertEquals('foo',$stack[count($stack)-1]);$this->assertEquals(1