Current User

2 posts, 0 answers
  1. Steve
    Steve avatar
    1885 posts
    Member since:
    Dec 2008

    Posted 08 Oct 2010 Link to this post

    I need to dispose of some data after the test finishes, how do I go about getting the 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?
  2. Cody
    Cody avatar
    3354 posts

    Posted 12 Oct 2010 Link to this post

    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.

    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? 

    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
Back to Top