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

Stopping browser closing after execution

11 Answers 326 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 26 Jul 2010, 04:49 PM
Hi,

After I've run a script it closes the browser, I am able to stop this?

Thank you,

Paul

11 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 26 Jul 2010, 05:41 PM
Hi Paul,

Yes it is possible though not really recommended and may have some unintended side effects (such as memory leaks and a 20 second delay when the test finishes). I'd like to better understand your testing scenario. Would you mind explaining to me why you want this behavior?

To accomplish it you need to override the CleanUp method in a code behind file. Use code like this:

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();
}

If you're not sure how to add the above code let me know and I'll provide more details.

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
0
Cody
Telerik team
answered on 29 Jul 2010, 10:03 PM
Hi Paul,

Just wanted to touch base with you. Did you get this problem resolved? Do you need any further assistance with this?

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
0
ray
Top achievements
Rank 1
answered on 26 Sep 2010, 09:27 PM
I would like to 'chain' two projects together.  Such as opening a window with a username & password and then I'd like to drop in a data driven spreadsheet while I'm sitting on the open window.  Is there a better way to accomplish this without 'chaining' the two test projects together?
0
Cody
Telerik team
answered on 27 Sep 2010, 01:06 AM
Hello ray,

I'm not totally certain what you are referring to by "two projects" but it sounds like a better approach would be to either use a test list or the Test as a step feature.

In Test as a step you are literally calling one test from another. So you can have a step in Test A call Test B. Further Test B can be data bound and it will run through all the rows of data before returning to Test A. From description you gave this approach sounds like the best solution.

In the QA Edition we also have the Test List feature. In a test list you specify which tests to execute and in which order. There is the "RecycleBrowser" property in the list of test list properties that you can check. When this is checked the currently active browser window will remain open in between each test and the next test will use that browser window.

Best wishes,
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
0
Mike
Top achievements
Rank 1
answered on 19 Nov 2013, 06:47 PM
I'm in a similar situation.

I want to create a project that performs the following:
1. Log in to the web app.
2. Load each item under the first Java menu one after the other.

That's it!  Then I want to have it load each item under the second Java menu...and then the third. 

So to accomplish this, I want this broken down into the following individual tests:
1. Log in
2. Load each item in the first Java menu
3. Load each item in the second Java menu

And then I want to be able to take #1 above and use it for a different Project.  And I'd like to take #2 and do the same, and #3 and do the same!

But how can I do this when after #1 executes, the darn window closes!  The only workaround I see is to record it all in one feel swoop.  But that means I can't reuse #1 in a different project?  

I'd like to have a library of individual tests I can call into Projects.  Your app, as far as I can see, doesn't easily permit this.
0
Cody
Telerik team
answered on 19 Nov 2013, 07:44 PM
Hello Mike,

The problem "keep the browser open when a test finishes" is part of the reason we added our Test-as-step feature. In the test automation scenario you just described create one main parent test that calls sub-tests for step 1 (login) step 2 (Load each item in the first Java menu) step 3 (Load each item in the second Java menu) and so on. Test Studio considers this one single complete test and will keep the browser open the entire time.

I hope this helps.

Regards,
Cody
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Mike
Top achievements
Rank 1
answered on 20 Nov 2013, 03:25 PM
Test As Step appears it may be good for modularizing and re-using tests, but what I want to do is this:

1. Record a few steps.
2. Play them back.
3. Pick up where they leave off and record a few more.
4. Play it all back again.
5. Pick up where it now leaves off and record a few more.

I can't see a way to do this since the darn browser closes every time...so every time I have to completely start again!

Currently I'm posting on another thread discussing Test Studio's failure to accurately record a simple two-field Log In process, but when I skipped over that and started within the web app I'm testing and found it couldn't just pick up and continue where I left off, that's a solid Strike 2 against the app (and we're only on Day 2 of my evaluation of Test Studio).

Why is this so difficult and non-intuitive when its something other apps simply do by a matter of course?  Couldn't there be a simple checkbox for "Close browser after execution" that I could activate or deactivate at will for each test?  I should not have to read forum posts on Day 1 just to get basic functionality working.
0
VASCOR
Top achievements
Rank 1
answered on 20 Nov 2013, 03:35 PM
Hi Mike,
If you want to record a few steps, play it back to make sure they work, then record more follow this:
1. Record your steps then close the browser (to stop recording)
2. Right click on the last step and go to Run - To here
This will run your test to the last step and then open the recording browser again so you can record more steps. Repeat as necessary until your test is complete.

Hope this helps ( I do this often).

0
Mike
Top achievements
Rank 1
answered on 20 Nov 2013, 03:45 PM
Thanks, Bob.  That sounds simple enough.  I'll give that a shot.
0
Daniel
Top achievements
Rank 2
answered on 20 Nov 2013, 06:35 PM
I was also in charge of evaluating various products for web automation.  I've only been using Telerik Test Studio/VS plugin for 2.5 months (1 of those was evaluation before purchase).  I've never done automation before.  I previously spent 10 years as a Systems Admin, and decided it was time for a career change.

I will say without a doubt the Telerik team cares about making sure you the product meets your need.  I've submitted 5 issues for Test Studio and 1 with the website.  One of those issues ended up being a bug that was submitted to the dev team to address.  The website issue was corrected by a team member completely rewriting the page within 24 hours of submission.

I have spent more time on these forums and in the User Guide (http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/overview.aspx) than I care to mention.  Heck, I've even answered more than a few questions because this community cares.  If I ever stumble on a step, I'm right here searching for an answer.  If I submit a question, I make sure to reference as many searches, documentation, and/or sample code as possible.

This is a great product that really simplifies web automation (I promise I'm not employed by Telerik).  Of course there are quirks, and some tweaking necessary just like any other product.  I've made modifications to my tests to start with.  I've learned not all steps are possible without code still (I use quite a bit for business logic).  In a month and a half, I've published 5 automations for use by various departments to address regressions and refreshes.  Had I used strictly Visual Studio Coded UI or another framework, I'd still be on number one of two.

I know this is a random post, but just had to toss it out there.
0
Cody
Telerik team
answered on 20 Nov 2013, 10:44 PM
Hi Mike,

Test As Step appears it may be good for modularizing and re-using tests, but what I want to do is this:

Bob has it correct, that's what our Run-to-Here feature is for. Thank you Bob for offering your assistance!

I should not have to read forum posts on Day 1 just to get basic functionality working.

I am sorry to hear that you're not finding the tool intuitive enough. Let's do keep in mind that Test Studio is a very advanced, and very feature rich, piece of software targeted at helping you deal with the very tough problem of UI/web test automation. Most people find they have to adjust and learn any new and advanced tool like Test Studio that is aimed at this type of challenge. FYI, we do offer training options aimed at those that are new to UI test automation and want to quickly get up to speed learning how to do it right and to quickly become efficient using Test Studio doing so.

Thank you Daniel for chipping in your comments as well.

Regards,
Cody
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Paul
Top achievements
Rank 1
Answers by
Cody
Telerik team
ray
Top achievements
Rank 1
Mike
Top achievements
Rank 1
VASCOR
Top achievements
Rank 1
Daniel
Top achievements
Rank 2
Share this question
or