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

TestUnit Capybara.reset_sessions! for every test

So the following code works in isolation but if I run the full test suite it breaks if I remove: Capybara.reset_sessions! From my investigation the user can't sign in as they are already signed in. So my question is, is it typical to need to call…
Brettski
  • 1,061
  • 2
  • 12
  • 25
0
votes
3 answers

Continue assertion after failures in ruby

My assertion example is below, class test < Test::Unit::TestCase def test_users begin assert_equal(user.name, 'John') assert_equal(user.age, 30) assert_equal(user.zipcode, 500002) rescue Exception …
Galet
  • 5,853
  • 21
  • 82
  • 148
0
votes
2 answers

Error message when calling watir-webdriver test with Arguments

I'm trying to fix my tests so I can call them from the command line with enviromental variables, like what browser. I call it in a command prompt: ruby watir1_environment.rb -BROWSER=chrome And get the following error…
Skjoldan
  • 58
  • 3
0
votes
1 answer

How can I import inventory into Registroid P.O.S. using Ruby / Selenium / Test-Unit

If you're using Registroid (if you have to) then you probably know that there's no easy way to import your inventory. My girlfriend is starting a small pop-up boutique and she needed to import a few hundred rows of product data into Registroid. I've…
Jordan
  • 5,085
  • 7
  • 34
  • 50
0
votes
1 answer

Ruby on Rails 4 testunit skips validations

I'm trying to test validations on my Rails 4 application. The problem is that adding one specific validation all test passes, regardless if remaining validations are commented or not. Here's my code: # test/models/company_test.rb setup do …
rb-
  • 1
  • 1
0
votes
1 answer

How to specify controller name in test::unit

I have my brands controller in app/controllers/merchant/brands_controller.rb I'm trying to write a functional test for it. I've defined test class as require 'test_helper' class Merchant::BrandsControllerTest < ActionController::TestCase include…
VivekVarade123
  • 3,564
  • 4
  • 24
  • 31
0
votes
0 answers

TestUnit: Is database the same before each test method is called?

I'm trying to find a simple summary of the TestCase lifecycle. Basically, I want to know if I can assume the database state is the same before each test method is called. What I think happens is: I initialise running all tests for MyTestCase on the…
mahemoff
  • 44,526
  • 36
  • 160
  • 222
0
votes
2 answers

Showing only specific test case in test.log

I am writing Rails tests using the standard Test::Unit/TestCase. Is there any way to somehow filter what gets printed to the log, so that you only print the stack for specific test cases. I have a functional test file with many test cases in it, and…
mastaBlasta
  • 5,700
  • 1
  • 24
  • 26
0
votes
1 answer

Rake TestTask won't run Unit Tests

my rake TestTask looks like this Rake::TestTask.new(:tasks) do |t| t.libs << "test" t.test_files = FileList['tasks/tasks*.rb'] t.verbose = true end My unit test named tasks01.rb looks like this require_relative…
Zach
  • 885
  • 2
  • 8
  • 27
0
votes
0 answers

Authlogic and current_user

My functional tests are failing because current_user is not recognizing my authenticated users. Here is part of application_controller (there are other require_* filters too): def current_user return @current_user if defined?(@current_user) …
sscirrus
  • 55,407
  • 41
  • 135
  • 228
0
votes
2 answers

Why does my regex for "include?" not work?

I'm using Watir WebDriver and test/unit with Firefox. The following code works: assert(@browser.text.include?("Company employees")) Why does the following code not work? assert(@browser.text.include?(/Company employees/))
OldGrantonian
  • 597
  • 1
  • 8
  • 23
0
votes
1 answer

How to aggregate all assertion in testunit?

I am new into watir and I am using testunit for assertion. My script looks like this: Script1 -- has a test method which calls Script2 Script2 -- does all the work and validation. This has all assertion When i run my test case I have to run Script1,…
Pratik
  • 952
  • 2
  • 16
  • 31
0
votes
1 answer

Why is there an error in the following code?

I would be grateful for help in sorting the error in the following code: require 'rubygems' require 'watir' require 'watir-webdriver' require 'test/unit' class TestGoogle < Test::Unit::TestCase def setup @browser = Watir::Browser.new…
OldGrantonian
  • 597
  • 1
  • 8
  • 23
0
votes
1 answer

Shoulda statements are not executed in the order they are defined?

I'm trying to implement shoulda for test automation. I tried this code: require 'test/unit' require 'shoulda' require 'shoulda-context' class TestClass < Test::Unit::TestCase context 'Languages' do should 'Ruby' do puts 'Ruby' end …
Alpha
  • 13,320
  • 27
  • 96
  • 163
0
votes
1 answer

how can my gem know the path to its repository directory?

My gem semantictext has a bunch of test data that it reads for regression testing. Here's the project: http://github.com/dafydd/semantictext Here's an example test that I want to be able to run directly from the gem:…
Dafydd Rees
  • 6,941
  • 3
  • 39
  • 48