Micro Focus QTP (UFT) Forums
Running QTP Scripts on multiple SAP Test Environments - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Running QTP Scripts on multiple SAP Test Environments (/Thread-Running-QTP-Scripts-on-multiple-SAP-Test-Environments)



Running QTP Scripts on multiple SAP Test Environments - Newom85 - 09-01-2009

We recently started to use QTP to automate our SAP test cases. Our company has a variety of custom SAP screens and transactions that need to be tested on a bi-monthly basis. We also use Quality Center to track testing. We have three different test environments:
1.) Training
2.) Development
3.) QA

Now for my question. Is there any way to have my QTP scripts run on a certain environment (server...Training, Dev & QA) so that I do not have to manually update my test script record & run settings prior to execution.

Currently before I run my test I need to log into QTP and change the Record & Run settings server to the environment being tested. This is cumbersome since we have nearly 150 separate test scripts.

Any help would be appreciated.


RE: Running QTP Scripts on multiple SAP Test Environments - basanth27 - 09-01-2009

The above mentioned query can be resolved.

Two important notes,

1. Set the record and run settings to "Run on any open browser"
2. Research about QTP AOM.

Let me know if it helps !


RE: Running QTP Scripts on multiple SAP Test Environments - Newom85 - 09-01-2009

We had security problems with running on any open browser. Someone accidentally ran a test on a production system that created and posted invoices. We would not like to run on open browser if at all possible.
I will try AOM script.


RE: Running QTP Scripts on multiple SAP Test Environments - basanth27 - 09-01-2009

Best Practice -
Close all the active Browsers. Open the browser you need and then pass the required Url.


RE: Running QTP Scripts on multiple SAP Test Environments - lotos - 08-02-2010

A good way to not have problems with opened browsers, you can use Browser().Close method at the end of each test (or within the last action, last step), or you can write a function as next and use it where you'll need it:

Code:
[b]Public Function[/b] CloseBrowser
    Reporter.[b]Filter[/b] = rfDisableAll
[color=#808000]'closing the browser[/color]
        [b]If[/b] Browser([color=#FF6347]"URL:=http://environment1/.*"[/color]).Exist [b]Then[/b]
            Browser([color=#FF6347]"URL:=http://environment1/.*"[/color]).[b]Close[/b]
        [b]End IF[/b]

        [b]If[/b] Browser([color=#FF6347]"URL:=environment2/.*"[/color]).Exist [b]Then[/b]
            Browser([color=#FF6347]"URL:=environment2/.*"[/color]).[b]Close[/b]
        [b]End IF[/b]
    Reporter.[b]Filter[/b] = rfEnableAll
End Function

to call this function from the *.qfl file, use in you test next:
CloseBrowser 'that's it

it's working very good in all my tests..