If you want the thing to work across multiple test classes, you'll
need to create it as a global variable so it will be available to all
the classes and methods.

Then in whichever class runs last, close the report.

I'm playing with this CLReport class a bit to add a 'blocked' status
to deal with situations where a test can't be run.  e.g. lets say a
link is supposed to be present on a page..  so maybe you have to
specific tests in the greater test case that links on the page are
correct
 1) link exists with the right label
 2) link points to the right URL.

test 2 is dependant on test 1, if they link isn't there, you can
hardly test if the URL for it is correct can you?

Once I get done with that I'll try to upload the revised class to the
example's in the wiki, and maybe also provide a more advanced example
of using the report class across multiple text case classes

On Feb 5, 12:04 am, H2006 <[email protected]> wrote:
> Great! this works now.
>
> Question: I have multiple tests running inTestplan. If I use this in
> each file.. then it creates new result file for each testscript. Is it
> possible to have only one result file for testplan and all other
> scripts insert the output in the same?
>
> Thanks..
>
> On Jan 21, 6:47 am, JArkelen <[email protected]> wrote:
>
>
>
> > Can you put this:
>
> > r = CLReport.new()
> >   testReport = r.createReport('C:\\ruby\\results\\results.html')
>
> > in the class? In don't think if you make a cal for r in the class it
> > knows the report class when it is created outside?
>
> > On Jan 21, 2:57 am, H2006 <[email protected]> wrote:
>
> > > Here is the sample code for which i am trying to capture the output. .
> > > while running this code, I am not getting any error today but output
> > > is still not written to thefile. Can u please help
>
> > > begin
> > >   # Create the new report
> > >   r = CLReport.new()
> > >   testReport = r.createReport('C:\\ruby\\results\\results.html')
>
> > > class TC_run_demoTest
>
> > >   def self.suite
>
> > >     $browser = Watir::Browser.new
> > >     puts " Beginning oftest: "
> > >     $browser.goto("www.yahoo.com")
> > >     $browser.text_field(:name, "p").set("ruby")
> > >     $browser.button(:id, "searchsubmit").click
>
> > >      begin
> > >          assert($browser.text.include?("Programming Ruby") )
> > >             r.addtoReport(testReport, 'Foundteststring Programming Ruby',
> > > 'PASSED', 'Testpassed')
> > >      rescue => e
> > >             r.addtoReport(testReport, 'String not found', 'FAILED',
> > > 'testfailed')
> > >     end
> > >     $browser.close
> > >    end
> > > end
>
> > >     r.finishReport(testReport)
> > > rescue
> > >   # Send crash info to report
> > >     r.addtoReport(testReport, 'Testcrashed with reason '+$!,
> > > 'FAILED', 'Testcrashed!')
> > >     r.finishReport(testReport)
> > > end
>
> > > -------------------------------------------------------
>
> > > On Jan 17, 12:34 am, JArkelen <[email protected]> wrote:
>
> > > > Did you use this line to create the variable:
> > > > r = CLReport.new()
>
> > > > Please post your code so I can have a look.
>
> > > > On Jan 16, 10:13 pm, H2006 <[email protected]> wrote:
>
> > > > > Hi
>
> > > > > I am trying to use this class but constantly getting Error: HTML
> > > > >Resultfileis created  but Noresultsadded.
> > > > > Can someone help please ??
>
> > > > > "  1) Error:
> > > > > test_print_assertion(TC_demo):
> > > > > NameError: undefined local variable or method `r' for #<TC_demo:
> > > > > 0x3a4682c>
> > > > >     temp.rb:49:in `test_print_assertion'
>
> > > > > Thanks.
>
> > > > > On Jan 16, 2:56 am, Jagdeep Jain <[email protected]> wrote:
>
> > > > > > Thanks A lot JArkelen,
>
> > > > > > This is exciting :-)
> > > > > > I have started using this Class ;-)
>
> > > > > > On Jan 15, 8:03 pm, JArkelen <[email protected]> wrote:
>
> > > > > > >http://wiki.openqa.org/display/WTR/HTML+report+class
>
> > > > > > > On Jan 15, 7:53 am, Jagdeep Jain <[email protected]> wrote:
>
> > > > > > > > I got it through Rspec:
> > > > > > > > spec usingrspec.rb --format html > testresult.html
>
> > > > > > > > On Jan 15, 11:31 am, Jagdeep Jain <[email protected]> 
> > > > > > > > wrote:
>
> > > > > > > > > I want to populate Watirresultsto HTML format. Is there any 
> > > > > > > > > way to
> > > > > > > > > do this?
> > > > > > > > > Or is there any way to have all 'puts' goes to HTMLfile?- 
> > > > > > > > > Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to