locked
Context across multiple web tests. RRS feed

  • Question

  • It appears that if I create a context that it only lasts to the end of the web test.

    Is there a way to create a context in WebTest1.webtest, then use it in webtest2.webtest, etc.

    If so do I have to do an ordered test for this to work?

     

    Thanks,

    Tom

    Thursday, February 23, 2006 11:34 PM

Answers

  • You could also use a singleton class to keep state across web tests. You could write a web test plugin to put values from the singleton class into the web test context before the test runs.

    Ed.

    Friday, February 24, 2006 2:40 PM
    Moderator

All replies

  • It is true that the web test context is scoped to an individual web test.

    Depending on your requirements, you may be able to use an environment variable to have a context value span multiple web tests.

    See the following post regarding use of an envioronment variable to override a context parameter.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=266377&SiteID=1

    Thanks,

    Rick

    Friday, February 24, 2006 12:14 AM
    Moderator
  • You could also use a singleton class to keep state across web tests. You could write a web test plugin to put values from the singleton class into the web test context before the test runs.

    Ed.

    Friday, February 24, 2006 2:40 PM
    Moderator
  • it sounds like the singleton class method would work best in my case; I'll have to research it further.

    Regardless I expect I will need to do ordered tests for this to work. Can you reference any examples?

     

    Thanks,

     

    Tom

    Friday, February 24, 2006 3:59 PM
  • I was successful in using a web test plugin to resolve my problem.

     

    The steps I took were:

    1) create a web test plugin as described in help. I updated the static variables only if they were blank (the 1st time)

    2) Created an ordered test.

    3) added the web test plugin to all the web tests in the ordered test.

    When the ordered test was run, the 1st web test 'set' the context variables, then the rest of the tests were able to use the contect variables.

     

    Thanks for all the help!

    Tom

    Sunday, February 26, 2006 4:10 PM