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

Forcing thread identity for a test list

6 Answers 111 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sammy78
Top achievements
Rank 2
Sammy78 asked on 10 Jul 2012, 12:02 PM
Hi,
I was wondering if there was a way to force thread identity for a test list. I'm currently working on an intranet site and I have to test different user profiles on one of our dev servers. The thing is that we don't do "login"; the site takes the logged in identity. For manual testing and verification, we've developed a script that forces the desired identity (all browser windows must be closed for it to work), THEN opens a browser window and opens the site . But with test studio, the browser opens as soon as you want to record a test.

Any help would be appreciated.
Thank you

Sam

6 Answers, 1 is accepted

Sort by
0
Accepted
Cody
Telerik team
answered on 10 Jul 2012, 06:02 PM
Hello,

I'm not sure what you mean by "force thread identity". That sounds like a programming term, but I'm not sure you meant thread programming in this context.

For recording, you can always use our "Attach to Existing Instance" feature. But I'm concerned about test playback. Our playback mechanism MUST launch a new browser window to work. It cannot connect to an existing browser instance during test playback.

To overcome this you can implement your own Test Extension DLL and add code to the OnBeforeTestStarted method. This method gets control before Test Studio launches the browser.

Greetings,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Sammy78
Top achievements
Rank 2
answered on 10 Jul 2012, 06:45 PM
Hi Cody,
Thanks for the reply. I've read the page on Test Extention DLL and it would most likely solve my problem, except for one tiny detail that I'm not sure of: Will deploying into the \Telerik\Test Studio\Bin\Plugins\ folder will make the code run for every test list that I run, from any project? Because I only need this done on a single test project.
0
Accepted
Cody
Telerik team
answered on 10 Jul 2012, 07:14 PM
Hi,

You are correct, the code will run for all test lists for all projects unconditionally.

To handle this you can filter when the code is activated with something like this:

/// <summary>
/// This function is called just before a Test Studio test list starts executing.
/// NOTE: Is NOT called when using Visual Studio test list.
/// </summary>
/// <param name="list">The test list about to be executed.</param>
public void OnBeforeTestListStarted(TestList list)
{
    if (list.TestListName == "Special Test List")
    {
        // Insert code here that sets the user authentication
    }

There are other properties off of the TestList parameter you could use instead if you like. It's completely up to you how you filter when your custom code will/won't be executed.

Kind regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Sammy78
Top achievements
Rank 2
answered on 11 Jul 2012, 03:23 PM
Hi Cody,
That's a great suggestion! Thanks a lot. I'll keep it in mind. 
It seems that the first solution that we thought about won't work because of a few factor. BUT now, I'm able to get a windows logon when we get to the site. So I'm thinking that this will help for another solution, but when I try to record a test, it only says "Handle 'Generic' dialog." as step. Where do I have to put in the values so that the test logs me in?

Thanks
0
Sammy78
Top achievements
Rank 2
answered on 11 Jul 2012, 03:33 PM
Nevermind! I found out how. :) 
Thanks a lot for all your help!

Sincerely, Sam
0
Cody
Telerik team
answered on 11 Jul 2012, 09:11 PM
Hi,

Excellent! Thank you for the update.

All the best,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Sammy78
Top achievements
Rank 2
Answers by
Cody
Telerik team
Sammy78
Top achievements
Rank 2
Share this question
or