[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ci_reporter user guide?

Maung Augn

7/20/2007 11:31:00 PM

Hi,
I am new to ruby. I've googled for ci_reporter user guide, but i found
little helpful results. Could anyone have a clue where i can get support
for reporter? My real question is how to get xml output ruby. Earlier,
someone on the forum point me out that ci_reporter has this
functionality. ci_reporter has method called to_xml, but I don't really
know how to use it. Any help would be greatly appreciated.

Thanks,
maung

--
Posted via http://www.ruby-....

2 Answers

Maung Augn

7/23/2007 5:51:00 PM

0

Hi Nick,

Thanks for your response. I am very new to ruby, so please bear with me.
I am using Ruby, Watir and Test/unit, not Ruby on rails.
My first question will be if i can use ci_reporter with the tools i
mentioned above. I found out that I need to use ci_reporter with Rake.

What I am trying to achieve is that test login a website and check if
successful. I used test/unit assert to validate the result. I need to
get the output from running ruby as XML file so that I can use in
cruisecontrol application. But I don't know how to use to_xml method in
my rake file or ruby.


This is another question. Since I use test/unit, I put the following
line in my rake file:
require 'rubygems'
gem 'ci_reporter'
require 'ci/reporter/rake/test_unit' # use this if you're using
Test::Unit
according to the documentation. When try to run it, I got this error
message:
c:/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.3.3/lib/ci/reporter/rake/test_unit.rb:5:
undefined method `namespace' for main:Object (NoMethodError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from Rakefile.rb:3
I don't really know what is causing it.

Any help would be very appreciated.

Thanks,
maung





Nick Sieger wrote:
> On 7/20/07, Maung Aung <maung@atc-onlane.com> wrote:
>>
>> Hi,
>> I am new to ruby. I've googled for ci_reporter user guide, but i found
>> little helpful results. Could anyone have a clue where i can get support
>> for reporter? My real question is how to get xml output ruby. Earlier,
>> someone on the forum point me out that ci_reporter has this
>> functionality. ci_reporter has method called to_xml, but I don't really
>> know how to use it. Any help would be greatly appreciated.
>
>
> Re-reading your question, it sounds like you want a general to_xml
> method
> for Ruby objects. ci_reporter does not do this, it's meant to be used
> with
> your unit tests to generate xml reports (again see doco link). Perhaps
> you
> want to look at the xml serialization code in Rails, which requires you
> to
> use either simple hashes and arrays, or ActiveRecord.
>
> http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.ht...
> http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Conversions.ht...
> http://api.rubyonrails.org/classes/ActiveRecord/XmlSerialization.ht...
>
> /Nick

--
Posted via http://www.ruby-....

Matt Berney

7/27/2007 9:02:00 PM

0

I have the exact same issue...

1) Ruby 1.8.2-15, Watir-1.5.1192, ci_reporter 1.3.3
2) My tests are based on Watir::TestCase
3) I am able to run a simple test and generate XML output

How does one generate a stylesheet to display an HTML report?

<file: tc1.rb>
require 'watir'
require 'watir/testcase'
require 'ci/reporter/rake/test_unit_loader'
require 'test/unit/ui/console/testrunner'

class TC_MyTests < Watir::TestCase
def test_mytest1
assert(true, "Test passed")
end

def test_mytest2
assert(false, "Test failed")
end
end

<file TEST-TC-MyTests.xml>
<?xml version="1.0" encoding="UTF-8"?>
<testsuite assertions="2" time="0.016" tests="2" failures="1"
name="TC_MyTests"
errors="0">
<testcase assertions="1" time="0.0" name="test_mytest1">
</testcase>
<testcase assertions="0" time="0.016" name="test_mytest2">
<failure message="Test failed...."
type="Test::Unit::AssertionFailedError">
Test failed.
&lt;false&gt; is not true. (Test::Unit::AssertionFailedError)
tc1.rb:12:in `test_mytest2' </failure>
</testcase>
<system-out>
<![CDATA[]]>
</system-out>
<system-err>
<![CDATA[]]>
</system-err>
</testsuite>



Maung Aung wrote:
> Hi Nick,
>
> Thanks for your response. I am very new to ruby, so please bear with me.
> I am using Ruby, Watir and Test/unit, not Ruby on rails.
> My first question will be if i can use ci_reporter with the tools i
> mentioned above. I found out that I need to use ci_reporter with Rake.
>
> What I am trying to achieve is that test login a website and check if
> successful. I used test/unit assert to validate the result. I need to
> get the output from running ruby as XML file so that I can use in
> cruisecontrol application. But I don't know how to use to_xml method in
> my rake file or ruby.
>
>
> This is another question. Since I use test/unit, I put the following
> line in my rake file:
> require 'rubygems'
> gem 'ci_reporter'
> require 'ci/reporter/rake/test_unit' # use this if you're using
> Test::Unit
> according to the documentation. When try to run it, I got this error
> message:
> c:/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.3.3/lib/ci/reporter/rake/test_unit.rb:5:
> undefined method `namespace' for main:Object (NoMethodError)
> from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require'
> from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require'
> from Rakefile.rb:3
> I don't really know what is causing it.
>
> Any help would be very appreciated.
>
> Thanks,
> maung
>
>
>
>
>
> Nick Sieger wrote:
>> On 7/20/07, Maung Aung <maung@atc-onlane.com> wrote:
>>>
>>> Hi,
>>> I am new to ruby. I've googled for ci_reporter user guide, but i found
>>> little helpful results. Could anyone have a clue where i can get support
>>> for reporter? My real question is how to get xml output ruby. Earlier,
>>> someone on the forum point me out that ci_reporter has this
>>> functionality. ci_reporter has method called to_xml, but I don't really
>>> know how to use it. Any help would be greatly appreciated.
>>
>>
>> Re-reading your question, it sounds like you want a general to_xml
>> method
>> for Ruby objects. ci_reporter does not do this, it's meant to be used
>> with
>> your unit tests to generate xml reports (again see doco link). Perhaps
>> you
>> want to look at the xml serialization code in Rails, which requires you
>> to
>> use either simple hashes and arrays, or ActiveRecord.
>>
>> http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Array/Conversions.ht...
>> http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Conversions.ht...
>> http://api.rubyonrails.org/classes/ActiveRecord/XmlSerialization.ht...
>>
>> /Nick

--
Posted via http://www.ruby-....