Changes

Jump to: navigation, search

TestEngineering/Performance/Raptor/Mitmproxy

986 bytes added, 15:56, 2 November 2018
m
Recording a Mitmproxy Test Page improvements
/home/cltbld/tasks/task_1541153570/testing/raptor/mitmdump -k -q -s /home/cltbld/tasks/task_1541153570/build/tests/raptor/raptor/playback/alternate-server-replay.py /home/cltbld/tasks/task_1541153570/testing/raptor/facebook.mp
== Recording How to Record a Mitmproxy Test Page ==
Test pages used for Raptor pageload tests (i.e. raptor-tp6, raptor-gdocs) are mitmproxy recordings that are played back during the test (and ultimately loaded in Firefox via the local proxy). Each test page is a separate mitmproxy recording (*.mp) file, and all the page recordings for each suite are contained in a single zip for that suite (i.e. mitmproxy-recordings-raptor-tp6.zip) on tooltool.
The following process was used to record the mitmproxy page archives (on OSX):
1. Install Mitmproxy 2.X following the mitmproxy [http://docs.mitmproxy.org/en/stable/install.html installation instructions]. We use version 2.0.2 in production (and that was the version used to record the current pagesets). Note that we are unable to upgrade to a newer Mitmproxy because of some non-backwards compatible changes they made, see [https://bugzilla.mozilla.org/show_bug.cgi?id=1457274 Bug 1457274]).
2. Setup a local proxy in Firefox:
* Clear the browser history/cache
* In a terminal window start the mitmdump recording tool:
mitmdump -w /path/to/save/recording.mp
* Inside Firefox browse to the URL that you want to record (i.e. www.spacex.com)
* Wait for the page to be fully loaded and displayed
5. To test playing back your recorded page:
* Be sure you have the [https://searchfox.org/mozilla-central/rev/39cb1e96cf97713c444c5a0404d4f84627aee85d/testing/raptor/raptor/playback/alternate-server-replay.py custom playback script] available
* Start Firefox with the proxy still enabled
* With Mitmproxy NOT running, browse to your recorded URL (i.e. www.spacex.com); you'll just get an error saying that the proxy server is refusing connections
* In a terminal window, start Mitmproxy playback, using the custom playback script: mitmdump -k -s /path/to/savealternate-server-replay.py /path/to/recording.mp For example: mozilla-unified/obj-x86_64-apple-darwin17.7.0/testing/raptor $ ./mitmdump -k -s "/Users/rwood/mozilla-unified/testing/raptor/raptor/playback/alternate-server-replay.py /Users/rwood/Desktop/new_recordings/no_hero/google-search-no-hero.mp" NOTE: On some platforms you will need quotes around the args as used above. 
* In Firefox browse to the URL that you recorded already (i.e. www.spacex.com). This time the page will load successfully; it is actually loading the page from the local mitmdump archive file (*.mp) and not the external site
* You can actually turn off your local WiFi connection if you want and verify the page still loads
* In the terminal window press "ctrl + c" to stop the playback
Confirm
372
edits

Navigation menu