Questions tagged [testunit]

Test-unit is a unit testing library in Ruby. It was part of the standard library in Ruby 1.8, and there's a compatibility layer in the standard library of Ruby 1.9.

Test-unit is a unit testing library in Ruby. It was part of the standard library in Ruby 1.8, and there's a compatibility layer in the standard library of Ruby 1.9.

Test::Unit (test-unit) is unit testing framework for Ruby, based on xUnit principles. These were originally designed by Kent Beck, creator of extreme programming software development methodology, for Smalltalk's SUnit. It allows writing tests, checking results and automated testing in Ruby.

366 questions
0
votes
1 answer

What command line options are available for test/unit in ruby 1.9.1?

What command line options are available if you're using the Test::Unit compatibility layer in ruby 1.9.1? Background: ruby test/test_all.rb --help provides information on what command line options are available in ruby 1.8.7, but not in ruby 1.9.1…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
0
votes
1 answer

Using define_method to create a dynamic test-unit case also runs placeholder value

So, I'm using the parrallel gem to create a set of test cases that can run concurrently. I have the test case names specified in a yaml and through the parallel process each test case name assigned to the global var $t. I then use define_method to…
YoDK
  • 447
  • 1
  • 4
  • 13
0
votes
2 answers

In Ruby's Test::Unit::TestCase, is there a way for a test method to access the total number of methods about to be tested?

i.e. as I compose my test suites to include other suites as well as test cases, is there a global count of how many tests the TestRunner has executed, will be executing? Any way I can progammatically access that count?
someguy
  • 3,153
  • 3
  • 20
  • 10
0
votes
0 answers

Display messages in test/unit result

I want to display the message after test is passed. Where i need to print the message so that i can get in result of test. require 'test/unit' class MyTest < Test::Unit::TestCase def sample begin count = 0 5.times do …
Galet
  • 5,853
  • 21
  • 82
  • 148
0
votes
1 answer

Test Unit Capybara not able to get query last inserted record

I am using test unit with fixtures using the standard rails testing framework. I am running some tests using capybara and I am unable to find the last inserted record when I run my model find after the insert. I open up my database editor and I see…
Jacob Waller
  • 4,119
  • 3
  • 26
  • 32
0
votes
0 answers

Rails 3.0 + Test::Unit - I18n.locale diverges from config.i18n.default_locale

If I put the following in my unit test: puts Inventarizace::Application.config.i18n.default_locale puts I18n.locale i get :cz for the first one (as expected), but :en for the second, resulting in locale lookup failures (with keys starting with…
Incanus
  • 21
  • 4
0
votes
1 answer

Server not starting when using Capybara and Selenium Firefox

I'm not 100% sure what is happening but I seem to have configured Capybara how the README suggests using selenium as the default_driver in Test::Unit. My test_helper looks like this ENV['RAILS_ENV'] ||= 'test' require…
joewoodward
  • 263
  • 4
  • 10
0
votes
1 answer

Idiomatic Test::Unit equivalent of expect {}.to change {}.by(x)

Right now, I am simply using assert_equal twice - before and after the execution, and it does not hurt much. But I have used RSpec before and liked the readability of the expect{}.to change idiom. I cannot simply use RSpec in this project - not my…
kostja
  • 60,521
  • 48
  • 179
  • 224
0
votes
2 answers

Changing a variable when Ruby unit test fails

I am using Ruby Unit test in code like below. assert_equal(x, 'strin') I want to change a variable if this test fails and test should be still fail. How can I do that? I did the same in python using following code. try: …
Chamila Wijayarathna
  • 1,815
  • 5
  • 30
  • 54
0
votes
1 answer

Problems running Test::Unit with Guard on Rails 4.1.1 and Ruby 2.1.2

I'm upgrading an app from Rails 3.2 using Ruby 2.0 to Rails 4.1 using Ruby 2.1. Running our Test::Unit tests with rake test works perfectly fine, but running the tests with guard is a failure. 15:30:14 - INFO - Guard::Test 2.0.5 is running, with…
naikipl
  • 471
  • 3
  • 5
0
votes
1 answer

I want to know how long it takes to execute each test step

The test below runs great... I just want to know specifically how long each test step takes. The test was originally exported from the selenium firefox plugin to ruby. My plan is to add one more additional step that verifies the 'average chute…
Jen
  • 109
  • 1
  • 12
0
votes
1 answer

How to use transactional fixtures in test unit

When i run test cases, i don't want to store records in my databases. How can i achieve it. Here is my code :- class Sample << Test::Unit::TestCase def setup # code end def teardown # code end def test_sample # code end end Am using the…
Galet
  • 5,853
  • 21
  • 82
  • 148
0
votes
1 answer

How can i test multiple Browsers in one Watir Script using test-unit gem

So this is not about running multiple browsers in parallel. Its the sequentially running IE11, then IE10, then FireFox, ALL of them on different Virtual Machines Connected to Selenium Grid2. Here is what i have, running ONE browser on ONE VM. File:…
kamal
  • 9,637
  • 30
  • 101
  • 168
0
votes
1 answer

How to test routes that don't include controller?

I'm using minitest in Rails to do testing, but I'm running into a problem that I hope a more seasoned tester can help me out with because I've tried looking everywhere for the answer, but it doesn't seem that anyone has run into this problem or if…
boo-urns
  • 10,136
  • 26
  • 71
  • 107
0
votes
0 answers

PASS_THROUGH_EXCEPTIONS constant(s) usage in test cases?

Can someone please explain usage of PASS_THROUGH_EXCEPTIONS, NOT_PASS_THROUGH_EXCEPTIONS, NOT_PASS_THROUGH_EXCEPTIONS_NAMES in test-unit gem ? Can they be customized?