Forum Discussion

Lagencie's avatar
Lagencie
Frequent Contributor
8 years ago

Running Tests in my opened Browser

As I have tested with a few different tools so far, this question seems rather logic to me, but it seems as it is not working in testcomplete...

 

Can I open a browser where I want to run to tests, which TC will use for the whole test.

 

Right now I have the problem that I have multiple open browsers, which would fit the search pattern, so I want TC to use the browser id, that he opened with the Run Browser command in TC and execute all the tests on this opened browser.

4 Replies

  • shankar_r's avatar
    shankar_r
    Community Hero

    Best approach would close all browsers before starting your test. this is will reduce your headache.

     

    However, if you business need is like that then you can try with latest Browser Index in-order to TestComplete stay with browser which you opened

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    In a keyword test or script, if you use the Run Browser operation or the Browsers.Item().Run method, when you reference Aliases.browser then in your tests, it will use whatever was just run.

     

    However, as shankar_r, unless there is a legitimate business reason to have multiple browsers open while you're running the tests, I'd recommend shutting them all down before you kick off your tests.  It just generally saves confusion.

    • Lagencie's avatar
      Lagencie
      Frequent Contributor

      Well, the reason is the development phase of the test - I dont want to close all my open working tabs / documentations / whatever I have open during the process where I create and test the test I am writing ...

       

      I would have to close my running application multiple times and go back to the state where I am, creating the testcase. Now I am used to have the tab open, create the namemappings and then test it step by step with a new Browser not touching my open Browsers (test requirements / documentations / manuals whatever)

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        This is why the environment I use for developing automation (a dedicated VM) is different than my actual desktop where I do all my other work.  That way I don't "pollute" my clean room with clutter of documentation, open browser instances, etc.  I'd highly recommend doing something like this.

         

        In the meantime, most modern browsers (IE, FireFox, Chrome) have the ability that, when you close a session, you can have it "save" all your open tabs so that, when you re-run the browser, it will pick up where you left off.  So, when you start your "playback" to check what you've done, close and save your browser tabs first, then run your test.

         

        Think of it as the same thing you would do in a manufacturing environment... you don't test a substance, device, machine, etc., in an environment with a lot of variation... you strictly control the environment so that tests are repeatable and assured to be unaffected by outside influences.  Perhaps not always in a "clean room" but any QA lab at a manufacturing firm would have controlled environments for their tests.  In our case, you're testing a web page in a particular browser. Anything else running on that machine, including other browsers, could potentially pollute your "sample" making your test unreliable.