From: Eric Hodel on
On Mar 3, 2010, at 12:57, Champak Ch wrote:

> Thanks Dan. I have modified the code snippet I sent earlier to include
> the details. I still get the same error.
>
> require 'test/unit/testsuite'
> require 'test/unit/ui/console/testrunner'
> require 'rubygems'
> gem 'test-unit'
> require 'test/unit'

If you're going to use the test-unit gem you must require files inside it after gem 'test-unit'
From: Ryan Davis on

On Mar 5, 2010, at 09:18 , Champak Ch wrote:

> I was unable to get the omit functionality working, even after I removed
> the first 2 require lines. The omit() function is not recognised at all.
>
> However, in my application, I have a bunch of testsuites which I run
> together. If I do not have omit, the script runs perfectly fine. But I
> am trying to include the omit functionality, so I can selectively run my
> tests within each test suite.

you can already selectively run tests via -n and -t. run your tests and tack on --help for info.



From: Champak Ch on
I simplified the code as much as possible below. omit is still not
recognised. Runs without any errors if omit() is removed. I am not sure
what I am really missing.

require 'test/unit'

class TC_MyTests < Test::Unit::TestCase
def test_01_login
puts "\nLogged in"
end

def test_02_omit
puts "\nHello 1"
omit()
puts "\nHello 2"
end

def test_03_logoff
puts "\nLogged off"
end
end
--
Posted via http://www.ruby-forum.com/.

From: Kouhei Sutou on
Hi,

In <9fe46c8b5818159d02e1d95a71ba5e25(a)ruby-forum.com>
"Re: Test::Unit::Omission - Unable to omit tests" on Sat, 6 Mar 2010 11:58:25 +0900,
Champak Ch <champaka(a)live.com> wrote:

> I simplified the code as much as possible below. omit is still not
> recognised. Runs without any errors if omit() is removed. I am not sure
> what I am really missing.
>
> require 'test/unit'
>
> class TC_MyTests < Test::Unit::TestCase
> def test_01_login
> puts "\nLogged in"
> end
>
> def test_02_omit
> puts "\nHello 1"
> omit()
> puts "\nHello 2"
> end
>
> def test_03_logoff
> puts "\nLogged off"
> end
> end

Please try the following code:

--
require 'rubygems'
gem 'test-unit'
require 'test/unit'

class TC_MyTests < Test::Unit::TestCase
def test_01_login
puts "\nLogged in"
end

def test_02_omit
puts "\nHello 1"
omit()
puts "\nHello 2"
end

def test_03_logoff
puts "\nLogged off"
end
end
--

Then run the file:

% ruby tc_my_tests.rb


Thanks,
--
kou

From: Champak Ch on
I get the following error when I run it as suggested above.

c:/ruby/lib/ruby/gems/1.8/gems/test-unit-2.0.6/lib/test/unit/autorunner.rb:120:in
`expand_path': couldn't find HOME environment -- expanding
`~/.test-unit.xml' (ArgumentError)
from
c:/ruby/lib/ruby/gems/1.8/gems/test-unit-2.0.6/lib/test/unit/autorunner.rb:120:in
`initialize'
from
c:/ruby/lib/ruby/gems/1.8/gems/test-unit-2.0.6/lib/test/unit/autorunner.rb:49:in
`new'
from
c:/ruby/lib/ruby/gems/1.8/gems/test-unit-2.0.6/lib/test/unit/autorunner.rb:49:in
`run'
from
c:/ruby/lib/ruby/gems/1.8/gems/test-unit-2.0.6/lib/test/unit.rb:321

Any suggestions?

-Champak.
--
Posted via http://www.ruby-forum.com/.