This is a migrated thread and some comments may be shown as answers.

Current User

1 Answer 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 08 Oct 2010, 04:58 PM
I need to dispose of some data after the test finishes, how do I go about getting the asp.net current logged in users ID (to query the DB)?

....also is it possible to have this test run as like a "Finally" step so it's run regardless of pass or fail?

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 12 Oct 2010, 11:18 PM
Hi Steve,

First, to have something executed regardless of pass or fail of the test you need to override the CleanUp method in code. Here's a sample:

public override void CleanUp()
{
    if (this.ExecutionContext.TestResult.Result == ArtOfTest.Common.Design.ResultType.Fail)
    {
        // The test has failed. Perform any action needed on failure.
        this.Log.CaptureBrowser(this.ActiveBrowser);
    }
    base.CleanUp();
}

For getting the currently logged on users ID, unfortunately there is no standard, even in the ASP.NET world. There are many ways people can get logged on and many ways for the web server to keep track of which user is logged on. Only your developer can tell you how it keeps track of who is currently logged on to that session. I take it you couldn't simply keep track of which user ID you used to login at the beginning of the test? 

Greetings,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Cody
Telerik team
Share this question
or