Try putting the atttribute on the class instead.
I think you will also need to change the code that looks up the
current browser context so that it recursively scans all parent
TestContexts to find the context that has the browser attached.
I should probably make those changes in the samples too and add a
couple of new samples to demo usage of the browser with fixture setup
and with test steps. Feel free to send me a patch if you get this done
before I do. :-)
Jeff
On Nov 9, 2009, at 5:15 AM, Dieter Menne <dieter.me...@menne-
biomed.de> wrote:
>
>
> I am using the MbUnit.Samples.WebTestingWithWatiN Samples coming with
> Version 3.2.0 of Gallio/MbUnit as a starter.
> The new Page-base syntax is very useful and gives a much more
> transparent design of Test Units.
>
> To simulate a larger web page with complex login, I tried to port a
> test that opens the browser once in the FixtureSetup, and performs
> several test without closing the browser. The example is shown below
> (paste it as a new class into the sample demo), but it fails with an
> error message in Fixture setup.
>
> "There is no current browser context. Does the test have a [Browser]
> attribute?"
>
> It works with the commented out individual GoTo(browser), but that's
> not what I want.
>
> How do I handle this case correctly? I know how to do it the classical
> way in WatiN, but is this possible the new way?
>
> Dieter
>
>
> using System.Diagnostics;
> using MbUnit.Framework;
> using MbUnit.Samples.WebTestingWithWatiN.Framework;
>
> namespace MbUnit.Samples.WebTestingWithWatiN
> {
> internal class MultipleGoogleSearchDemo : BrowserTestFixture
> {
> [Browser(BrowserType.IE)]
> [FixtureSetUp]
> public void FixtureSetup()
> {
> GoogleSearchPage.GoTo(Browser);
> }
>
> // [FixtureTearDown]
>
> [Test]
> [Browser(BrowserType.IE)]
> public void SuccessfulFiddleSearch()
> {
> // GoogleSearchPage.GoTo(Browser);
> Browser.Page<GoogleSearchPage>().Search("Fiddlesticks");
> Assert.Contains(Browser.Text, "Fiddlesticks");
> }
>
> [Test]
> [Browser(BrowserType.IE)]
> public void SuccessfulWatinSearch()
> {
> // GoogleSearchPage.GoTo(Browser);
> Browser.Page<GoogleSearchPage>().Search("WatiN");
> Assert.Contains(Browser.Text, "WatiN");
> }
> }
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/mbunituser?hl=en
-~----------~----~----~----~------~----~------~--~---