OLD | NEW |
(Empty) | |
| 1 # Web Page Replay |
| 2 Web Page Replay (WprGo) is a performance testing tool written in Golang for |
| 3 recording and replaying web pages. WprGo is currently used in Telemetry for |
| 4 Chrome benchmarking purposes. This requires go 1.8 and above. This has not been |
| 5 tested with earlier versions of go. It is supported on Windows, MacOS and Linux. |
| 6 |
| 7 ## Required packages |
| 8 |
| 9 ``` |
| 10 go get github.com/codegangsta/cli |
| 11 ``` |
| 12 ## Set up GOPATH |
| 13 ``` |
| 14 export GOPATH=/path/to/web_page_replay_go:"$HOME/go" |
| 15 ``` |
| 16 |
| 17 ## Sample usage |
| 18 |
| 19 ### Record mode |
| 20 * Terminal 1: |
| 21 |
| 22 Start wpr in record mode. |
| 23 |
| 24 ``` |
| 25 go run src/wpr.go record --http_port=8080 --https_port=8081 /tmp/archive.wprgo |
| 26 ``` |
| 27 ... |
| 28 |
| 29 Ctrl-C |
| 30 |
| 31 * Terminal 2: |
| 32 |
| 33 ``` |
| 34 google-chrome-beta --user-data-dir=$foo \ |
| 35 --host-resolver-rules="MAP *:80 127.0.0.1:8080,MAP *:443 127.0.0.1:8081,EXCLU
DE localhost" |
| 36 ``` |
| 37 ... wait for record servers to start |
| 38 |
| 39 ### Replay mode |
| 40 * Terminal 1: |
| 41 |
| 42 Start wpr in replay mode. |
| 43 ``` |
| 44 go run src/wpr.go replay --http_port=8080 --https_port=8081 /tmp/archive.wprgo |
| 45 ``` |
| 46 |
| 47 * Terminal 2: |
| 48 ``` |
| 49 google-chrome-beta --user-data-dir=$bar \ |
| 50 --host-resolver-rules="MAP *:80 127.0.0.1:8080,MAP *:443 127.0.0.1:8081,EXCLU
DE localhost"` |
| 51 ``` |
| 52 ... wait for replay servers to start |
| 53 |
| 54 load the page |
| 55 |
| 56 ### Installing test root CA |
| 57 |
| 58 WebPageReplay uses self signed certificates for Https requests. To make Chrome |
| 59 trust these certificates, you can install a test certificate authority as a |
| 60 local trust anchor. **Note:** Please do this with care because installing the |
| 61 test root CA compromises your machine. This is currently only supported on |
| 62 Linux. |
| 63 |
| 64 Installing the test CA |
| 65 ``` |
| 66 go run src/wpr.go installroot |
| 67 ``` |
| 68 Uninstall the test CA |
| 69 ``` |
| 70 go run src/wpr.go removeroot |
| 71 ``` |
| 72 |
| 73 ## Other use cases |
| 74 |
| 75 ### Http-to-http2 proxy: |
| 76 |
| 77 * Terminal 1: |
| 78 ``` |
| 79 go run src/wpr.go replay --https_port=8081 --https_to_http_port=8082 \ |
| 80 /tmp/archive.wprgo |
| 81 ``` |
| 82 |
| 83 * Terminal 2: |
| 84 ``` |
| 85 google-chrome-beta --user-data-dir=$foo \ |
| 86 --host-resolver-rules="MAP *:443 127.0.0.1:8081,EXCLUDE localhost" \ |
| 87 --proxy-server=http=https://127.0.0.1:8082 \ |
| 88 --trusted-spdy-proxy=127.0.0.1:8082 |
| 89 ``` |
| 90 |
| 91 ## Inspecting an archive |
| 92 |
| 93 httparchive.go is a convenient script to inspect a wprgo archive. Use `ls`,`cat` |
| 94 and `edit`. Options are available to specify request url host (`--host`) and |
| 95 path (`--full-path`). |
| 96 |
| 97 E.g. |
| 98 |
| 99 ``` |
| 100 go run src/httparchive.go ls /tmp/archive.wprgo --host=example.com --full-path=/
index.html |
| 101 ``` |
| 102 |
| 103 ## Running unit tests |
| 104 Run all tests in a specific file. |
| 105 ``` |
| 106 go test transformer_test.go transformer.go |
| 107 ``` |
| 108 |
| 109 Run all tests in `webpagereplay` module. |
| 110 ``` |
| 111 go test webpagereplay -run '' |
| 112 ``` |
| 113 |
| 114 ## Contribute |
| 115 Please read [contributor's guide][contribute]. We use the Catapult |
| 116 [issue tracker][tracker] for bugs and features. Once your change is reviewed |
| 117 and ready for landing, please run `telemetry/bin/update_wpr_go_binary` to update |
| 118 binaries in Google cloud storage. |
| 119 |
| 120 ## Contact |
| 121 Please email telemetry@chromium.org. |
| 122 |
| 123 [contribute]: https://github.com/catapult-project/catapult/blob/master/CONTRIBUT
ING.md |
| 124 [tracker]: https://github.com/catapult-project/catapult/issues |
OLD | NEW |