Forum Discussion

Thomas_Fuller's avatar
Thomas_Fuller
Occasional Contributor
15 years ago

What is the best way to reuse a login step?

Hi,

I have a series of tests which all require the  "authenticate" web service to be called before they are executed. I also have a test case which is called "authenticate" with valid data and verifies that the results returned by the server are correct.

What I'd like to do is reuse this test case for other test cases that require authentication instead of copying the authentication test step all over my project (which is messy and if it changes the modification will need to be reflected everywhere).

Can you please provide me with some guidance regarding what is the most appropriate way to achieve what I'm looking to do?

FYI: I have tried using a "Run TestCase" test step however it appears to lose the session even though I have "Maintain HTTP session" enabled on both test steps.

Thanks for your help,

Tom

6 Replies

  • Hi Tom,

    the Run TestCase TestStep should be the way to go, since 3.5 it has a "Copy HTTP Session" setting in its options dialog that should get around the related issue you are having, can you give that a try?

    regards!

    /Ole
    eviware.com
  • Hi!

    If checked it will propagate the HTTP Session used by the calling testcase to the target one; any changes made to it will affect the calling testcase when it continues.. maybe there should be an option to disable this (ie create a copy of the session and not use the same instance)?

    regards!

    /Ole
    eviware.com
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    So the session already exists in the calling test case, it just is not populated?

    What Tom wants (I think) is to originate the session in the called (inner) test case and pass it back to the calling (outer) test case.
  • Good point!

    He would still have to check the "Maintain HTTP Session" setting in both the calling and target testcases for now.. lets see what he comes up with!

    regards,

    /Ole
    eviware.com
  • Thomas_Fuller's avatar
    Thomas_Fuller
    Occasional Contributor
    eviware support wrote:

    Hi Tom,

    the Run TestCase TestStep should be the way to go, since 3.5 it has a "Copy HTTP Session" setting in its options dialog that should get around the related issue you are having, can you give that a try?

    regards!

    /Ole
    eviware.com


    This works.

    Thanks,

    Tom