HTTPS recording

Rational Performance Tester Under the Covers HTTP/HTTPS recording Page 1 of 17 “Rational Support Whitepaper” Ara Masrof Technical Support Professi...
Author: Dina Bailey
2 downloads 1 Views 603KB Size
Rational Performance Tester Under the Covers HTTP/HTTPS recording

Page 1 of 17

“Rational Support Whitepaper”

Ara Masrof Technical Support Professional: Client Technical Resolution Specialty March 9, 2010

Page 2 of 17

“Rational Support Whitepaper”

Introduction…………………………………………………………………………………….......…4 HTTP recording overview………………………………………………………………………….4 Initial Browser configuration settings……………………………………………………..4 Record time configuration settings………………………………………………………….9 Test Generation………………………………………………………………………………………15 Miscellaneous: HTTP recording against a non browser application………15 Troubleshooting Checklist………………………………………………………………………17

Page 3 of 17

“Rational Support Whitepaper”

Introduction This document was created to help technical support engineers along with end users to help troubleshoot issues related to HTTP/HTTPS recording and test generation. It was written using Rational Performance Tester 8.1.x After reviewing this material, users should have a strong foundation of the fundamentals of HTTP/HTTPS recording in Rational Performance Tester.

HTTP recording overview: Rational Performance Tester utilizes a proxy recorder to capture HTTP/HTTPS traffic to and from the client (in most cases a browser). Depending on the initial LAN configuration of the client, Rational Performance Tester will either use a SOCKS or an HTTP proxy to capture the traffic (This will be discussed in further detail later in this document). When a new recording is initiated, Rational Performance Tester will examine the LAN settings associated to the browser. For IE it does this by reading registry keys related to IE. For Mozilla/Firefox it reads the prefs.js file associated to the current user. Once this setting is known, Rational Performance Tester will modify them in order to route the traffic through its proxy recorder so it can be captured and then used to create an HTTPHTTPS test. The modifications are done through the registry (for IE) or user.js file (for Mozilla/Firefox). For IE users, this means your user account needs to be set with sufficient privilege to allow access and modification of the Windows registry. By default, Rational Performance Tester’s proxy recorder (Both SOCKS and HTTP) will run on the local computer at port 1080; this is editable via the preferences if you encounter a conflict at that port. The browser settings will stay in its modified state until the user’s stops the recording; they are then returned to their initial settings. Once the recording completes, Rational Performance Tester’s test generator builds a graphical HTTP/HTTPS Test based on the traffic that was captured.

Initial Browser configuration settings: Rational Performance Tester supports browser configurations that connect directly to the Web Server as well as connection via a HTTP/HTTPS proxy server. However, both IE and Firefox include multiple configuration options in this area and not all are supported. The first thing to confirm is if you are using a supported configuration setting prior to attempting a recording. IE configuration settings: As mentioned earlier, Rational Performance Tester supports both proxy and direct connections browser configurations. For direct connection the LAN settings edit box should look something like this (as seen below)

Page 4 of 17

“Rational Support Whitepaper”

Rational Performance Tester does not support any type of Automatic Configuration settings, this area must be disabled. Additionally, the “Bypass proxy….” setting needs to be disabled as well. For connection via a proxy the LAN settings edit box should look something like this (as seen below).

Page 5 of 17

“Rational Support Whitepaper”

As with the direct connection, Automatic Configuration settings must be disabled along with the “Bypass proxy….” setting. The Advanced settings should look like this.

Page 6 of 17

“Rational Support Whitepaper”

The Exceptions area must be empty. The Servers area should contain the name (or IP address) of the proxy server and the specific port it uses. You must specify the same proxy address for both HTTP and HTTPS. Firefox configuration settings The Firefox settings are very similar to IE’s. For direct connection the connection settings edit box should look something like this (as seen below)

Page 7 of 17

“Rational Support Whitepaper”

Rational Performance Tester does not support the ‘Auto-detect proxy setting for the network’ radio button or the ‘Automatic proxy configuration URL being enabled. For connection via a proxy the connection settings edit box should look something like this (as seen below).

Page 8 of 17

“Rational Support Whitepaper”

The ‘No Proxy for:” setting needs to be empty and the ‘Automatic proxy configuration URL” setting needs to be disabled. The proxy configuration area should contain the name (or IP address) of the proxy server and the specific port it uses. You must specify the same proxy address for both HTTP and HTTPS. If your browser is not configured with a supported configuration, a number of error messages will potentially be encountering during the recording and or test generation process. Be sure you are using a supported browser configuration prior to attempting a recording. If you need to make changes in your configuration settings be sure that you can still connected to the web server after the changes have been applied.

Record time configuration settings:

At record time, Rational Performance Tester first analyzes the initial LAN settings associated with the default browser (As set in the Rational Performance Tester preferences under Rational Performance Tester HTTP recording). Once it obtains this information, its makes the appropriate modifications to route the traffic

Page 9 of 17

“Rational Support Whitepaper”

through its proxy recorder in order to capture the data. In the case of the browser set up to connect directly to the server, Rational Performance Tester routs the traffic to its SOCKS proxy at port 1080 (Note, port 1080 is the default recording port but it can be changed via the preferences if needed). The SOCKS proxy captures the traffic which eventually gets generated into a viewable Test. How this is done depends on the type of browser being used. Internet Explorer At record time, Rational Performance Tester accesses the Windows registry at the following location: HKEY_CURRENT_USER\Software\Microsoft \Windows\CurrentVersion\Internet settings It looks at a number of keys including ProxyEnable and ProxyServer; based on these values it ‘knows’ the communication protocol the browser is initially set up with (i.e. whether it uses a proxy server or connects directly). In the case of the browser connecting directly to the AUT server, the ProxyEnable key will initially be set to ‘0’ (as seen below).

At record time, Rational Performance Tester will set this key with a value of 1 and also set the associated ProxyServer key to ‘socks=127.0.0.0.1:1080 (as seen below).

At this point, Rational Performance Tester has successfully modified the LAN configuration settings to route the traffic through its SOCKS proxy at 127.0.0.1:1080; the SOCKS proxy will capture the traffic to a file which then will be used generate an HTTP/HTTPS test. If you were to view LAN configuration of the browser while the recording is in process you see the same changes as well; these should mirror the registry settings.

Page 10 of 17

“Rational Support Whitepaper”

The settings will be returned to their initial values as soon as the recording is stopped. Firefox At record time, Rational Performance Tester accesses the prefs.js file for the current logged in user. It looks for the entry: user_pref("network.proxy.type", 0); The value 0 represents a direct connection (note, if there is no “network.proxy.type" entry in the file it will default to a direct connection). At record time Rational Performance Tester will create a user.js file that overrides the prefs.js file in terms of connection settings. If the initial connections are set to connect directly to the web server the contents of the user.js file will look something like this: user_pref("network.proxy.type",1); user_pref("network.proxy.socks","127.0.0.1"); user_pref("network.proxy.socks_port",1080); user_pref("network.proxy.socks_version",5); user_pref("network.proxy.no_proxies_on", "");

Page 11 of 17

“Rational Support Whitepaper”

user_pref("network.proxy.http", ""); user_pref("network.proxy.http_port",0); user_pref("network.proxy.ssl", ""); user_pref("network.proxy.ssl_port",0); If you view the connection settings while the recording is taking place the settings will look like this.

Once the recording is complete, the settings are returned to their initial settings. Recording with an existing HTTP/HTTPS proxy in place In the case of the browser set up to connect via a proxy to the Web Server, Rational Performance Tester routs the traffic to its internal HTTP/ HTTPS proxy at port 1080 (Note, port 1080 is the default recording port but it can be changed via the preferences if needed). The HTTP/HTTPS

Page 12 of 17

“Rational Support Whitepaper”

proxy captures the traffic which eventually gets generated into a HTTP/ HTTPS test. Test. How this is done depends on the type of browser being used. Internet Explorer At record time, Rational Performance Tester accesses the Windows registry at the following location: HKEY_CURRENT_USER\Software\Microsoft \Windows\CurrentVersion\Internet settings It looks at a number of keys including ProxyEnable and ProxyServer; based on these values it ‘knows’ the communication protocol the browser is initially set up with. In the case of the browser connecting via a proxy to the AUT, the ProxyEnable key will be set to ‘1’ and the ProxyServer key will include the specific Host (in this case IP address) and Port value of the proxy IE is set up to communicate with. (as seen below).

At record time, Rational Performance Tester will set the ProxyServer Key to the IP address of 127.0.0.1 and the Port 1080. This will be set for both the HTTP and the HTTPS entries.

At this point, Rational Performance Tester has successfully modified the LAN configuration settings To route the traffic through its HTTP proxy at 127.0.0.1:1080; the HTTP proxy will capture the traffic to a file which then will be used generate an HTTP/HTTPS test. If you were to view LAN configuration of the browser while the recording is in process you see the same changes as well; these should mirror the registry settings

Page 13 of 17

“Rational Support Whitepaper”

The settings will be returned to their initial values as soon as the recording is stopped. Firefox At record time, Rational Performance Tester accesses the prefs.js file for the current logged in user. It looks for the entry: user_pref("network.proxy.type", 1); The value 1 represents a manual proxy connection (i.e. the browser is set up to connect via a proxy server). At record time Rational Performance Tester will create a user.js file that overrides the prefs.js file in terms of connection settings. If the initial connections are set to connect directly to the web server the contents of the user.js file will look something like this: user_pref("network.proxy.type",1); user_pref("network.proxy.socks_version",5); user_pref("network.proxy.no_proxies_on", ""); user_pref("network.proxy.http","127.0.0.1"); user_pref("network.proxy.http_port",1080); user_pref("network.proxy.ssl","127.0.0.1"); user_pref("network.proxy.ssl_port",1080); If you view the connection settings while the recording is taking place the settings will look like this:

Page 14 of 17

“Rational Support Whitepaper”

Test Generation Once the user stops the recording (either by closing the browser or selecting the stop button) Rational Performance Tester will begin the process of generating an HTTP/HTTPS test. Behind the scenes, two files are created while the recording is ongoing, *.rec and *.recmodel files. When the recording is stopped, Rational Performance Tester uses these two files to build a third file, *.testsuite’; this is the graphical interpretation of the Test. Once created the *.testsuite file has no ties to the original *.rec and *.recmodel files. If you make edits to the *.testsuite those changes will not effect the *.rec and *.recmodel files. If for any reason the *.testsuite file becomes unusable, you can regenerate it using the both the *.rec and *.remodel files; this is documented in the Rational Performance Tester help under the topic “Generating a new test from a recorded session”.

Miscellaneous: HTTP recording against a non browser application

In most cases when attempting to capture HTTP/HTTPS traffic users will be using a browser as the client application. It is possible however to successfully record and capture HTTP/HTTPS data from a non browser client if the client can be appropriately configured.

Page 15 of 17

“Rational Support Whitepaper”

First and foremost, the non browser HTTP/HTTPS client must have the built in ability to be configured to communicate via a HTTP or SOCKS proxy server. This is required because Rational Performance Tester’s proxy recorder must be in play in order to capture the data. If the application can be configured to specify a proxy server than there are two options available to the user. 1) If the application can communicate via a SOCKS proxy then the recording process is pretty straight forward. Set the recording preferences (Window > Preferences -> Test -> Rational Performance Tester HTTP recording) for the Rational Performance Tester HTTP recorder to None for the Application to record dropdown list (as seen below)

Modify the client application to communicate via a SOCKS proxy at port 1080 (this process would differ depending on the client application; you would need to consult with the application developer for details (Note; it is preferable to use SOCKS v5 versus SOCKS v4 if you have the choice). Once set, start a new recording; in the Recorder Control view you will see the following message:

“Recorder initialization completed. You may manually start application” At this point you can bring up your application and proceed with the recording 2) If the application cannot communicate through a SOCKS proxy and can only communicate via an HTTP proxy then its initial set up must be configured with an HTTP proxy (i.e. An HTTP proxy must be in place prior to recording). In this case, the user would set the set the recording preferences (Window -> Preferences -> Test -> Rational Performance Tester HTTP recording) for the Rational Performance

Page 16 of 17

“Rational Support Whitepaper”

Tester HTTP recorder to a browser (i.e. the default setting) and configure the browser to use the same proxy server as the application. Once set, start the recording; the browser will come and display the ‘Welcome to Performance Test Recording’. At this point minimize the browser and bring up the application. You will need to modify the proxy settings to point to Rational Performance Testers proxy recorder (127.0.0.1 port 1080); when the recording completes be sure to change the settings back to their original values.

Troubleshooting Checklist (use the beginning portion of the document as a guide) 







Prior to recording, confirm that the browsers LAN/Proxy settings conform to Rational Performance Tester’s supported configurations (Note: if you have to make modification to the LAN/PROXY settings always verify that you can still reach the desired site before beginning a new recording Once the recording has started and the ‘Welcome to Performance Test Recording’ page is displayed, verify the LAN/Proxy settings of the browser have appropriately modified. If no modifications are present, the logged in user most likely does not have sufficient privileges for the modification to take place. Run the command “netstat –a” and verify that the recording port (1080 be default) is present and in the LISTENING state

If any errors messages occur during the recording/Test Generation process they can be referenced in the Rational Performance Tester help under the topic Troubleshooting and Support -> Performance Testing Error Messages. The help content will include possible solutions to address the issue at hand

Page 17 of 17

“Rational Support Whitepaper”