I got the Spec working in IronRuby! Thanks everyone. How can I get a detailed report (command line) when running the test? Currently, I only get the following: C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>ir test_prime.rb Loaded suite test_prime Started Finished in 0.015625 seconds. 0 tests, 0 assertions, 0 failures, 0 errors Also, for some reason it says "0 tests" here is my test_prime.rb file: require ''test/unit'' require ''rubygems'' require ''spec'' require File.dirname(__FILE__) + ''/bin/Debug/BusinessObjects.dll'' include BusinessObjects include Test::Unit describe PrimeService,"when 1 is passed to the prime service" do it "should return true" do primeService = PrimeService.new primeService.IsPrime(1) end end -- Posted via http://www.ruby-forum.com/.
See the test-spec documentation: http://test-spec.rubyforge.org/test-spec Reading about test-unit would be useful too: http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/ ________________________________________ From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] on behalf of Mohammad Azam [lists at ruby-forum.com] Sent: Monday, July 06, 2009 1:23 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Formatting the test result in Spec I got the Spec working in IronRuby! Thanks everyone. How can I get a detailed report (command line) when running the test? Currently, I only get the following: C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>ir test_prime.rb Loaded suite test_prime Started Finished in 0.015625 seconds. 0 tests, 0 assertions, 0 failures, 0 errors Also, for some reason it says "0 tests" here is my test_prime.rb file: require ''test/unit'' require ''rubygems'' require ''spec'' require File.dirname(__FILE__) + ''/bin/Debug/BusinessObjects.dll'' include BusinessObjects include Test::Unit describe PrimeService,"when 1 is passed to the prime service" do it "should return true" do primeService = PrimeService.new primeService.IsPrime(1) end end -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
I changed the code to this but still not picking up the test: describe PrimeService,"when 1 is passed to the prime service" do it "should return true" do primeService = PrimeService.new primeService.IsPrime(1).should == true end Mohammad Azam wrote:> I got the Spec working in IronRuby! Thanks everyone. > > How can I get a detailed report (command line) when running the test? > > Currently, I only get the following: > > > C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>ir > test_prime.rb > Loaded suite test_prime > Started > > Finished in 0.015625 seconds. > > 0 tests, 0 assertions, 0 failures, 0 errors > > Also, for some reason it says "0 tests" here is my test_prime.rb file: > > require ''test/unit'' > require ''rubygems'' > require ''spec'' > > require File.dirname(__FILE__) + ''/bin/Debug/BusinessObjects.dll'' > > include BusinessObjects > include Test::Unit > > describe PrimeService,"when 1 is passed to the prime service" do > > it "should return true" do > > primeService = PrimeService.new > primeService.IsPrime(1) > > end > > end-- Posted via http://www.ruby-forum.com/.
I had to configure the path for spec.bat using environment variables. Now, I can run the specifications using the following: spec test_prime.rb but I still need to format is nicely. --format nested does not work it complains that invalid --format parameter! -- Posted via http://www.ruby-forum.com/.
Mohammad Azam wrote:> I had to configure the path for spec.bat using environment variables. > > Now, I can run the specifications using the following: > > spec test_prime.rb > > but I still need to format is nicely. --format nested does not work it > complains that invalid --format parameter!Have you removed the test/unit require so that the test/unit runner data isn''t coming back? I think that was a red herring earlier in your post. Here''s the command I ran (full path to make sure I was running the right spec.bat): C:\OSS\ironruby\Merlin\Main\Bin\debug\spec.bat test.rb --format specdoc I got back the following output (from a script similar to yours): Some Simple assert - should show that 1 is equal to 1 Finished in 0.2343855 seconds 1 example, 0 failures -- Posted via http://www.ruby-forum.com/.
You are right! require test/unit was the problem. I removed it and it worked smoothly! Thanks, Azam -- Posted via http://www.ruby-forum.com/.
One other thing I noticed is that I have already installed win32console gem on my machine but for some reason whenever I use the color option it gives me the following output: C:\Projects\FirstLookAtIronRuby\FirstLookAtIronRuby\TestSuite>spec test_prime.rb --format specdoc --colour You must ''gem install win32console'' to use colour on Windows BusinessObjects::PrimeService when foo method is called - should return true Finished in 0.265625 seconds 1 example, 0 failures Thanks, Azam -- Posted via http://www.ruby-forum.com/.