marekj
2009-Jun-25 19:47 UTC
[rspec-users] When spec/test/unit is used then TestUnit Console Runner.run TestCase does not run testcases
Hi, I have some old test/unit testcases (used for browser acceptance tests) that I want to convert to rspec. I first started converting assertions to matchers and my tests ran fine using TestRunner.run method 1) Here is my test that works when Spec::Matchers were added to TestUnit only require ''test/unit'' require ''spec/expectations'' class Test::Unit::TestCase include Spec::Matchers end class Test_spec < Test::Unit::TestCase def test_a ''a''.should == ''a'' end end # TestRunner require ''test/unit/ui/console/testrunner'' puts "before runner some code" Test::Unit::UI::Console::TestRunner.run Test_spec puts "after runner some code" The reason I use TestRunner is for some browser driving and desktop cleanup and other non test stuff. Then console runner runs testcase and I follow with some other code (email, notifications etc...) When I now started using ''spec/test/unit'' the Console runner will not run tests. 2) here is the setup with ''spec/test/unit'' that does not run require ''spec/test/unit'' class Test_spec < Test::Unit::TestCase def test_a ''a''.should == ''a'' end end # This now will not run Test_spec class require ''test/unit/ui/console/testrunner'' puts "before runner" Test::Unit::UI::Console::TestRunner.run Test_spec puts "after runner" == I use rspec 1.2.7 (with Ruby 1.8.6 on Windows) Am I missing something? I would appreciate feedback Thanks. marekj Watirloo: Semantic Page Objects in UseCases http://github.com/marekj/watirloo/
David Chelimsky
2009-Jun-25 19:55 UTC
[rspec-users] When spec/test/unit is used then TestUnit Console Runner.run TestCase does not run testcases
On Thu, Jun 25, 2009 at 2:47 PM, marekj<marekj.com at gmail.com> wrote:> Hi, I have some old test/unit testcases (used for browser acceptance > tests) that I want to convert to rspec. > I first started converting assertions to matchers ?and my tests ran > fine using TestRunner.run method > > 1) Here is my test that works when Spec::Matchers were added to TestUnit only > > require ''test/unit'' > require ''spec/expectations'' > class Test::Unit::TestCase > ?include Spec::Matchers > end > > class Test_spec < Test::Unit::TestCase > ?def test_a > ? ?''a''.should == ''a'' > ?end > end > > # TestRunner > require ''test/unit/ui/console/testrunner'' > puts "before runner some code" > Test::Unit::UI::Console::TestRunner.run Test_spec > puts "after runner some code" > > The reason I use TestRunner is for some browser driving and desktop > cleanup and other non test stuff. > Then console runner runs testcase and I follow with some other code > (email, notifications etc...) > > When I now started using ''spec/test/unit'' the Console runner will not run tests. > > 2) here is the setup with ''spec/test/unit'' that does not run > > require ''spec/test/unit'' > class Test_spec < Test::Unit::TestCase > ?def test_a > ? ?''a''.should == ''a'' > ?end > end > > # This now will not run Test_spec class > require ''test/unit/ui/console/testrunner'' > puts "before runner" > Test::Unit::UI::Console::TestRunner.run Test_spec > puts "after runner" > > > == I use rspec 1.2.7 (with Ruby 1.8.6 on Windows) > > > Am I missing something?This is by design. When you run with RSpec, RSpec takes over the run, taking test/unit''s runner out of the picture. Sorry I can''t give you a better answer, except to say that future versions of RSpec may not suffer this problem. But that''s a few months off (at least), and just a gleam in my eye. Cheers, David> I would appreciate feedback > Thanks. > > > > marekj > > Watirloo: Semantic Page Objects in UseCases > http://github.com/marekj/watirloo/ > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
marekj
2009-Jun-25 20:14 UTC
[rspec-users] When spec/test/unit is used then TestUnit Console Runner.run TestCase does not run testcases
On Thu, Jun 25, 2009 at 2:55 PM, David Chelimsky<dchelimsky at gmail.com> wrote:> On Thu, Jun 25, 2009 at 2:47 PM, marekj<marekj.com at gmail.com> wrote: >> Hi, I have some old test/unit testcases (used for browser acceptance >> tests) that I want to convert to rspec. >> I first started converting assertions to matchers ?and my tests ran >> fine using TestRunner.run method >> ...snip... >> >> 2) here is the setup with ''spec/test/unit'' that does not run >> >> require ''spec/test/unit'' >> class Test_spec < Test::Unit::TestCase >> ?def test_a >> ? ?''a''.should == ''a'' >> ?end >> end >> >> # This now will not run Test_spec class >> require ''test/unit/ui/console/testrunner'' >> puts "before runner" >> Test::Unit::UI::Console::TestRunner.run Test_spec >> puts "after runner" >> >> >> Am I missing something? > > This is by design. When you run with RSpec, RSpec takes over the run, > taking test/unit''s runner out of the picture. Sorry I can''t give you a > better answer, except to say that future versions of RSpec may not > suffer this problem. But that''s a few months off (at least), and just > a gleam in my eye. > > Cheers, > DavidThanks David, And is there another mechanism I could use from Rspec that explicitly calls TestCase or ExampleGroup class? I just want to retain that mechanism of ''run some code then run tests then run some code'' This is for Watir Browser tests so I have workflow setup code that then drives test cases Thanks again marekj
David Chelimsky
2009-Jun-25 20:33 UTC
[rspec-users] When spec/test/unit is used then TestUnit Console Runner.run TestCase does not run testcases
On Thu, Jun 25, 2009 at 3:14 PM, marekj<marekj.com at gmail.com> wrote:> On Thu, Jun 25, 2009 at 2:55 PM, David Chelimsky<dchelimsky at gmail.com> wrote: >> On Thu, Jun 25, 2009 at 2:47 PM, marekj<marekj.com at gmail.com> wrote: >>> Hi, I have some old test/unit testcases (used for browser acceptance >>> tests) that I want to convert to rspec. >>> I first started converting assertions to matchers ?and my tests ran >>> fine using TestRunner.run method >>> ?...snip... >>> >>> 2) here is the setup with ''spec/test/unit'' that does not run >>> >>> require ''spec/test/unit'' >>> class Test_spec < Test::Unit::TestCase >>> ?def test_a >>> ? ?''a''.should == ''a'' >>> ?end >>> end >>> >>> # This now will not run Test_spec class >>> require ''test/unit/ui/console/testrunner'' >>> puts "before runner" >>> Test::Unit::UI::Console::TestRunner.run Test_spec >>> puts "after runner" >>> >>> >>> Am I missing something? >> >> This is by design. When you run with RSpec, RSpec takes over the run, >> taking test/unit''s runner out of the picture. Sorry I can''t give you a >> better answer, except to say that future versions of RSpec may not >> suffer this problem. But that''s a few months off (at least), and just >> a gleam in my eye. >> >> Cheers, >> David > > Thanks David, > And is there another mechanism I could use from Rspec that explicitly > calls TestCase or ExampleGroup class?Others have written custom runners before. It''s not really optimized for that but it''s doable. You may want to take a look at micronaut, which I believe is rspec and test/unit compatible and hackable.> I just want to retain that mechanism of ''run some code then run tests > then run some code'' > This is for Watir Browser tests so I have workflow setup code that > then drives test cases > > Thanks again > marekj > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users