From 6055d00bbc6ad5977de119ab9c3376e5e8f595c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Thu, 24 Aug 2023 17:56:10 +0200 Subject: [PATCH 1/4] Add flag to group tests by package --- README.md | 7 +++++++ main.go | 57 +++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index aff28de..fadca8f 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ Available Commands: version Prints the version number of go-test-report Flags: + -p, --groupPackage group tests by package instead of by number -g, --groupSize int the number of tests per test group indicator (default 20) -h, --help help for go-test-report -o, --output string the HTML output file (default "test_report.html") @@ -121,6 +122,12 @@ The default number of tests in a _test group_ can be changed using the `-g` or ` $ go test -json | go-test-report -g 8 ``` +To group the tests by their package instead of by count, use the `-p` or `--groupPackage` flag. + +```bash +$ go test -json | go-test-report -p +``` + Use the `-s` or `--size` flag to change the default size of the _group size indicator_. For example, the following command will set both the width and height of the size of the indicator to 48 pixels. diff --git a/main.go b/main.go index 7b580f7..ff0dee6 100644 --- a/main.go +++ b/main.go @@ -57,6 +57,7 @@ type ( ReportTitle string JsCode template.JS numOfTestsPerGroup int + groupTestsByPackage bool OutputFilename string TestExecutionDate string } @@ -68,12 +69,13 @@ type ( } cmdFlags struct { - titleFlag string - sizeFlag string - groupSize int - listFlag string - outputFlag string - verbose bool + titleFlag string + sizeFlag string + groupSize int + groupPackage bool + listFlag string + outputFlag string + verbose bool } goListJSONModule struct { @@ -124,6 +126,7 @@ func initRootCommand() (*cobra.Command, *templateData, *cmdFlags) { return err } tmplData.numOfTestsPerGroup = flags.groupSize + tmplData.groupTestsByPackage = flags.groupPackage tmplData.ReportTitle = flags.titleFlag tmplData.OutputFilename = flags.outputFlag if err := checkIfStdinIsPiped(); err != nil { @@ -194,6 +197,11 @@ func initRootCommand() (*cobra.Command, *templateData, *cmdFlags) { "g", 20, "the number of tests per test group indicator") + rootCmd.PersistentFlags().BoolVarP(&flags.groupPackage, + "groupPackage", + "p", + false, + "group tests by package instead of by count") rootCmd.PersistentFlags().StringVarP(&flags.listFlag, "list", "l", @@ -375,10 +383,22 @@ func getFileDetails(goListJSON *goListJSON) (testFileDetailsByTest, error) { type testRef struct { key string + pkg string name string } +type byPackage []testRef type byName []testRef +func (t byPackage) Len() int { + return len(t) +} +func (t byPackage) Swap(i, j int) { + t[i], t[j] = t[j], t[i] +} +func (t byPackage) Less(i, j int) bool { + return t[i].pkg < t[j].pkg +} + func (t byName) Len() int { return len(t) } @@ -410,17 +430,28 @@ func generateReport(tmplData *templateData, allTests map[string]*testStatus, tes tmplData.NumOfTestFailed = 0 tmplData.NumOfTestSkipped = 0 tmplData.JsCode = template.JS(testReportJsCodeStr) + tgPackage := "" tgCounter := 0 tgID := 0 // sort the allTests map by test name (this will produce a consistent order when iterating through the map) var tests []testRef for test, status := range allTests { - tests = append(tests, testRef{test, status.TestName}) + tests = append(tests, testRef{test, status.Package, status.TestName}) + } + if tmplData.groupTestsByPackage { + sort.Sort(byPackage(tests)) + } else { + sort.Sort(byName(tests)) } - sort.Sort(byName(tests)) for _, test := range tests { status := allTests[test.key] + if tmplData.groupTestsByPackage { + if tgPackage != "" && status.Package != tgPackage { + tgID++ + } + tgPackage = status.Package + } if len(tmplData.TestResults) == tgID { tmplData.TestResults = append(tmplData.TestResults, &testGroupData{}) } @@ -442,10 +473,12 @@ func generateReport(tmplData *templateData, allTests map[string]*testStatus, tes } else { tmplData.NumOfTestPassed++ } - tgCounter++ - if tgCounter == tmplData.numOfTestsPerGroup { - tgCounter = 0 - tgID++ + if !tmplData.groupTestsByPackage { + tgCounter++ + if tgCounter == tmplData.numOfTestsPerGroup { + tgCounter = 0 + tgID++ + } } } tmplData.NumOfTests = tmplData.NumOfTestPassed + tmplData.NumOfTestFailed + tmplData.NumOfTestSkipped From 20a75a14e2d39c476fd9ef98500494ac19c17456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Thu, 24 Aug 2023 18:36:04 +0200 Subject: [PATCH 2/4] Add the package name as title text --- embedded_assets.go | 2 +- main.go | 4 ++++ test_report.html.template | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/embedded_assets.go b/embedded_assets.go index 9f4af31..14450aa 100644 --- a/embedded_assets.go +++ b/embedded_assets.go @@ -1,5 +1,5 @@ package main -var testReportHTMLTemplate = `3c21444f43545950452068746d6c3e0a3c68746d6c206c616e673d22656e223e0a3c686561643e0a202020203c6d65746120636861727365743d225554462d38223e0a202020203c7469746c653e7b7b2e5265706f72745469746c657d7d3c2f7469746c653e0a202020203c7374796c6520747970653d22746578742f637373223e0a2020202020202020626f6479207b0a202020202020202020202020666f6e742d66616d696c793a2073616e732d73657269663b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20236633663366333b0a202020202020202020202020626f726465722d746f703a20327078202364656536653820736f6c69643b0a2020202020202020202020206d617267696e3a20303b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572207370616e2e70726f6a6563745469746c65207b0a202020202020202020202020666f6e742d66616d696c793a2073657269663b0a202020202020202020202020666f6e742d73697a653a2032656d3b0a20202020202020202020202070616464696e672d6c6566743a20353670783b0a20202020202020202020202070616464696e672d746f703a20383070783b0a202020202020202020202020646973706c61793a20626c6f636b3b0a202020202020202020202020636f6c6f723a20236135613561353b0a202020202020202020202020746578742d736861646f773a2030202d317078203170782077686974653b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207b0a202020202020202020202020706f736974696f6e3a206162736f6c7574653b0a202020202020202020202020746f703a203770783b0a20202020202020202020202072696768743a20353270783b0a202020202020202020202020666f6e742d73697a653a20302e38656d3b0a202020202020202020202020636f6c6f723a20236132613261323b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e696e64696361746f72207b0a202020202020202020202020666f6e742d73697a653a2032656d3b0a202020202020202020202020706f736974696f6e3a2072656c61746976653b0a202020202020202020202020746f703a203570783b0a202020202020202020202020746578742d736861646f773a20302031707820302077686974653b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e207374726f6e67207b0a2020202020202020202020206d617267696e2d72696768743a20313670783b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e746f74616c207b0a202020202020202020202020626f726465722d72696768743a20317078202361666166616620646f747465643b0a2020202020202020202020206261636b67726f756e643a20233832393861663b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e706173736564207b0a202020202020202020202020626f726465722d72696768743a20317078202361666166616620646f747465643b0a2020202020202020202020206261636b67726f756e643a20233666636138333b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e736b6970706564207b0a2020202020202020202020206261636b67726f756e643a20236261626162613b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e6661696c6564207b0a2020202020202020202020206261636b67726f756e643a20236666373637363b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e207b0a2020202020202020202020206d617267696e2d72696768743a203170783b0a2020202020202020202020206865696768743a20353570783b0a20202020202020202020202070616464696e673a20323070782038707820313870783b0a202020202020202020202020636f6c6f723a2077686974653b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572202e7465737447726f7570735469746c65207b0a2020202020202020202020206d617267696e3a203136707820333270782038707820343070783b0a202020202020202020202020666f6e742d73697a653a20302e39656d3b0a202020202020202020202020636f6c6f723a206461726b677265793b0a202020202020202020202020646973706c61793a20696e6c696e652d626c6f636b3b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572202e74657374457865637574696f6e44617465207b0a202020202020202020202020646973706c61793a20696e6c696e652d626c6f636b3b0a202020202020202020202020706f736974696f6e3a206162736f6c7574653b0a20202020202020202020202072696768743a20313070783b0a2020202020202020202020206d617267696e3a203134707820333270782038707820343070783b0a202020202020202020202020636f6c6f723a20233965396539653b0a202020202020202020202020666f6e742d73697a653a20302e39656d3b0a20202020202020207d0a0a20202020202020202e746573745265706f7274436f6e7461696e6572207b0a20202020202020202020202070616464696e673a20302033327078203332707820333270783b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572207b0a20202020202020202020202070616464696e673a2031367078203136707820313670783b0a202020202020202020202020626f782d736861646f773a2030203470782034707820236434643464343b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a2077686974653b0a20202020202020207d0a0a20202020202020202374657374526573756c7473207b0a202020202020202020202020646973706c61793a20666c65783b0a202020202020202020202020666c65782d777261703a20777261703b0a20202020202020207d0a0a20202020202020202e74657374526573756c7447726f7570207b0a20202020202020202020202077696474683a207b7b2e54657374526573756c7447726f7570496e64696361746f7257696474687d7d3b0a2020202020202020202020206865696768743a207b7b2e54657374526573756c7447726f7570496e64696361746f724865696768747d7d3b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20233433633134333b0a2020202020202020202020206d617267696e2d6c6566743a203170783b0a2020202020202020202020206d617267696e2d626f74746f6d3a203170783b0a202020202020202020202020626f782d73697a696e673a20626f726465722d626f783b0a20202020202020207d0a0a20202020202020202e74657374526573756c7447726f75702e73656c6563746564207b0a202020202020202020202020626f726465723a2031707820776869746520736f6c69643b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20626c61636b2021696d706f7274616e743b0a20202020202020207d0a0a20202020202020202e74657374526573756c7447726f75702e736b6970706564207b0a202020202020202020202020626f726465723a20327078206772617920736f6c69643b0a20202020202020207d0a0a20202020202020202e74657374526573756c7447726f75702e6661696c6564207b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a207265643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c6973742c0a20202020202020202e63617264436f6e7461696e65722e7465737444657461696c207b0a2020202020202020202020206d617267696e2d746f703a20313670783b0a20202020202020202020202070616464696e673a20313670783b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374207b0a202020202020202020202020636f6c6f723a20233963396339633b0a20202020202020202020202070616464696e673a20303b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207b0a202020202020202020202020637572736f723a2064656661756c743b0a202020202020202020202020626f726465722d626f74746f6d3a20317078202364616461646120646f747465643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e74657374537461747573207b0a202020202020202020202020666f6e742d73697a653a20312e32656d3b0a202020202020202020202020666f6e742d7765696768743a20626f6c643b0a202020202020202020202020636f6c6f723a20233133396531333b0a202020202020202020202020706f696e7465722d6576656e74733a206e6f6e653b0a202020202020202020202020646973706c61793a20696e6c696e652d626c6f636b3b0a2020202020202020202020206f766572666c6f773a2068696464656e3b0a202020202020202020202020666c6f61743a206c6566743b0a20202020202020202020202070616464696e672d746f703a20313070783b0a20202020202020202020202070616464696e672d6c6566743a20323070783b0a20202020202020202020202070616464696e672d72696768743a20313270783b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e746573745374617475732e736b6970706564207b0a202020202020202020202020636f6c6f723a20677261793b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e746573745374617475732e6661696c6564207b0a202020202020202020202020636f6c6f723a207265643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e746573745469746c65207b0a202020202020202020202020666f6e742d73697a653a20302e39656d3b0a20202020202020202020202070616464696e673a2031327078203020313070783b0a202020202020202020202020646973706c61793a20696e6c696e652d626c6f636b3b0a202020202020202020202020706f696e7465722d6576656e74733a206e6f6e653b0a202020202020202020202020636f6c6f723a20233532353235323b0a202020202020202020202020746578742d6f766572666c6f773a20656c6c69707369733b0a2020202020202020202020206f766572666c6f773a2068696464656e3b0a20202020202020202020202077696474683a2063616c632831303025202d203131307078293b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e746573744475726174696f6e207b0a202020202020202020202020706f696e7465722d6576656e74733a206e6f6e653b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207b0a202020202020202020202020706f736974696f6e3a2072656c61746976653b0a202020202020202020202020626f726465722d6c6566743a20347078202334336331343320736f6c69643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f772e736b6970706564207b0a202020202020202020202020636f6c6f723a20677261793b0a202020202020202020202020626f726465722d6c6566743a20347078206772617920736f6c69643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f772e6661696c6564207b0a202020202020202020202020636f6c6f723a207265643b0a202020202020202020202020626f726465722d6c6566743a203470782072656420736f6c69643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f773a686f766572207b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20236666666165613b0a2020202020202020202020207472616e736974696f6e3a20302e323530733b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e746573744f7574707574207b0a20202020202020202020202070616464696e673a203870782031367078203234707820313670783b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e636f6e736f6c65207b0a202020202020202020202020646973706c61793a20626c6f636b3b0a202020202020202020202020666f6e742d66616d696c793a206d6f6e6f73706163653b0a20202020202020202020202070616464696e673a20313070783b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20233432343234323b0a202020202020202020202020636f6c6f723a20233161666630303b0a202020202020202020202020626f726465722d626f74746f6d3a20317078202331616666303020646f747465643b0a2020202020202020202020206f766572666c6f773a206175746f3b0a202020202020202020202020666f6e742d73697a653a20312e31656d3b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e746573744f7574707574202e7465737444657461696c207b0a202020202020202020202020626f726465722d626f74746f6d3a20317078202364306430643020736f6c69643b0a20202020202020202020202070616464696e673a20313670783b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20236536653665363b0a202020202020202020202020626f726465722d7261646975733a2030203020347078203470783b0a202020202020202020202020636f6c6f723a2064696d677265793b0a202020202020202020202020666f6e742d73697a653a20302e38656d3b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e636f6e736f6c652e736b69707065647b0a202020202020202020202020636f6c6f723a20236439643964393b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e636f6e736f6c652e6661696c6564207b0a202020202020202020202020636f6c6f723a20236666623262323b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e746573744475726174696f6e207b0a202020202020202020202020706f736974696f6e3a206162736f6c7574653b0a202020202020202020202020746f703a203570783b0a20202020202020202020202072696768743a203870783b0a202020202020202020202020746578742d616c69676e3a2072696768743b0a20202020202020202020202070616464696e672d72696768743a203870783b0a202020202020202020202020626f782d73697a696e673a20626f726465722d626f783b0a20202020202020207d0a202020203c2f7374796c653e0a3c2f686561643e0a3c626f64793e0a3c64697620636c6173733d2270616765486561646572223e0a202020203c7370616e20636c6173733d2270726f6a6563745469746c65223e7b7b2e5265706f72745469746c657d7d3c2f7370616e3e0a202020203c64697620636c6173733d22746573745374617473223e0a20202020202020203c7370616e20636c6173733d22746f74616c223e3c7370616e20636c6173733d22696e64696361746f72223e26626f78626f783b3c2f7370616e3e20546f74616c3a203c7374726f6e673e7b7b2e4e756d4f6654657374737d7d3c2f7374726f6e673e4475726174696f6e3a203c7374726f6e673e7b7b2e546573744475726174696f6e7d7d3c2f7374726f6e673e0a20202020202020203c2f7370616e3e3c7370616e20636c6173733d22706173736564223e3c7370616e20636c6173733d22696e64696361746f72223e26636865636b3b3c2f7370616e3e205061737365643a203c7374726f6e673e7b7b2e4e756d4f66546573745061737365647d7d3c2f7374726f6e673e0a20202020202020203c2f7370616e3e3c7370616e20636c6173733d22736b6970706564223e3c7370616e20636c6173733d22696e64696361746f72223e26646173683b3c2f7370616e3e20536b69707065643a203c7374726f6e673e7b7b2e4e756d4f6654657374536b69707065647d7d3c2f7374726f6e673e0a20202020202020203c2f7370616e3e3c7370616e20636c6173733d226661696c6564223e3c7370616e20636c6173733d22696e64696361746f72223e2663726f73733b3c2f7370616e3e204661696c65643a203c7374726f6e673e7b7b2e4e756d4f66546573744661696c65647d7d3c2f7374726f6e673e0a20202020202020203c2f7370616e3e0a202020203c2f6469763e0a202020203c7370616e20636c6173733d227465737447726f7570735469746c65223e546573742047726f7570733a3c2f7370616e3e0a202020203c7370616e20636c6173733d2274657374457865637574696f6e44617465223e7b7b2e54657374457865637574696f6e446174657d7d3c2f7370616e3e0a3c2f6469763e0a3c64697620636c6173733d22746573745265706f7274436f6e7461696e6572223e0a202020203c64697620636c6173733d2263617264436f6e7461696e6572223e0a20202020202020203c6469762069643d2274657374526573756c7473223e0a2020202020202020202020207b7b72616e676520246b2c202476203a3d202e54657374526573756c74737d7d0a202020202020202020202020202020203c64697620636c6173733d2274657374526573756c7447726f7570207b7b2e4661696c757265496e64696361746f727d7d207b7b2e536b6970706564496e64696361746f727d7d222069643d227b7b246b7d7d223e3c2f6469763e0a2020202020202020202020207b7b656e647d7d0a20202020202020203c2f6469763e0a202020203c2f6469763e0a202020203c64697620636c6173733d2263617264436f6e7461696e6572207465737447726f75704c697374222069643d227465737447726f75704c697374223e3c2f6469763e0a3c2f6469763e0a3c73637269707420747970653d226170706c69636174696f6e2f6a617661736372697074223e0a202020207b7b2e4a73436f64657d7d0a0a202020202f2a2a0a20202020202a204074797065207b54657374526573756c74737d0a20202020202a2f0a20202020636f6e73742064617461203d207b7b2e54657374526573756c74737d7d0a0a20202020636f6e7374207265706f7274203d2077696e646f772e476f546573745265706f7274287b0a2020202020202020202020202020202020202020202020202020202020202020202020202020202020646174613a20646174612c0a202020202020202020202020202020202020202020202020202020202020202020202020202020202074657374526573756c7473456c656d3a20646f63756d656e742e676574456c656d656e7442794964282774657374526573756c747327292c0a20202020202020202020202020202020202020202020202020202020202020202020202020202020207465737447726f75704c697374456c656d3a20646f63756d656e742e676574456c656d656e744279496428277465737447726f75704c69737427290a2020202020202020202020202020202020202020202020202020202020202020202020202020207d293b0a0a0a3c2f7363726970743e0a3c2f626f64793e0a3c2f68746d6c3e0a` +var testReportHTMLTemplate = `3c21444f43545950452068746d6c3e0a3c68746d6c206c616e673d22656e223e0a3c686561643e0a202020203c6d65746120636861727365743d225554462d38223e0a202020203c7469746c653e7b7b2e5265706f72745469746c657d7d3c2f7469746c653e0a202020203c7374796c6520747970653d22746578742f637373223e0a2020202020202020626f6479207b0a202020202020202020202020666f6e742d66616d696c793a2073616e732d73657269663b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20236633663366333b0a202020202020202020202020626f726465722d746f703a20327078202364656536653820736f6c69643b0a2020202020202020202020206d617267696e3a20303b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572207370616e2e70726f6a6563745469746c65207b0a202020202020202020202020666f6e742d66616d696c793a2073657269663b0a202020202020202020202020666f6e742d73697a653a2032656d3b0a20202020202020202020202070616464696e672d6c6566743a20353670783b0a20202020202020202020202070616464696e672d746f703a20383070783b0a202020202020202020202020646973706c61793a20626c6f636b3b0a202020202020202020202020636f6c6f723a20236135613561353b0a202020202020202020202020746578742d736861646f773a2030202d317078203170782077686974653b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207b0a202020202020202020202020706f736974696f6e3a206162736f6c7574653b0a202020202020202020202020746f703a203770783b0a20202020202020202020202072696768743a20353270783b0a202020202020202020202020666f6e742d73697a653a20302e38656d3b0a202020202020202020202020636f6c6f723a20236132613261323b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e696e64696361746f72207b0a202020202020202020202020666f6e742d73697a653a2032656d3b0a202020202020202020202020706f736974696f6e3a2072656c61746976653b0a202020202020202020202020746f703a203570783b0a202020202020202020202020746578742d736861646f773a20302031707820302077686974653b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e207374726f6e67207b0a2020202020202020202020206d617267696e2d72696768743a20313670783b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e746f74616c207b0a202020202020202020202020626f726465722d72696768743a20317078202361666166616620646f747465643b0a2020202020202020202020206261636b67726f756e643a20233832393861663b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e706173736564207b0a202020202020202020202020626f726465722d72696768743a20317078202361666166616620646f747465643b0a2020202020202020202020206261636b67726f756e643a20233666636138333b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e736b6970706564207b0a2020202020202020202020206261636b67726f756e643a20236261626162613b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e2e6661696c6564207b0a2020202020202020202020206261636b67726f756e643a20236666373637363b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572206469762e746573745374617473207370616e207b0a2020202020202020202020206d617267696e2d72696768743a203170783b0a2020202020202020202020206865696768743a20353570783b0a20202020202020202020202070616464696e673a20323070782038707820313870783b0a202020202020202020202020636f6c6f723a2077686974653b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572202e7465737447726f7570735469746c65207b0a2020202020202020202020206d617267696e3a203136707820333270782038707820343070783b0a202020202020202020202020666f6e742d73697a653a20302e39656d3b0a202020202020202020202020636f6c6f723a206461726b677265793b0a202020202020202020202020646973706c61793a20696e6c696e652d626c6f636b3b0a20202020202020207d0a0a20202020202020206469762e70616765486561646572202e74657374457865637574696f6e44617465207b0a202020202020202020202020646973706c61793a20696e6c696e652d626c6f636b3b0a202020202020202020202020706f736974696f6e3a206162736f6c7574653b0a20202020202020202020202072696768743a20313070783b0a2020202020202020202020206d617267696e3a203134707820333270782038707820343070783b0a202020202020202020202020636f6c6f723a20233965396539653b0a202020202020202020202020666f6e742d73697a653a20302e39656d3b0a20202020202020207d0a0a20202020202020202e746573745265706f7274436f6e7461696e6572207b0a20202020202020202020202070616464696e673a20302033327078203332707820333270783b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572207b0a20202020202020202020202070616464696e673a2031367078203136707820313670783b0a202020202020202020202020626f782d736861646f773a2030203470782034707820236434643464343b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a2077686974653b0a20202020202020207d0a0a20202020202020202374657374526573756c7473207b0a202020202020202020202020646973706c61793a20666c65783b0a202020202020202020202020666c65782d777261703a20777261703b0a20202020202020207d0a0a20202020202020202e74657374526573756c7447726f7570207b0a20202020202020202020202077696474683a207b7b2e54657374526573756c7447726f7570496e64696361746f7257696474687d7d3b0a2020202020202020202020206865696768743a207b7b2e54657374526573756c7447726f7570496e64696361746f724865696768747d7d3b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20233433633134333b0a2020202020202020202020206d617267696e2d6c6566743a203170783b0a2020202020202020202020206d617267696e2d626f74746f6d3a203170783b0a202020202020202020202020626f782d73697a696e673a20626f726465722d626f783b0a20202020202020207d0a0a20202020202020202e74657374526573756c7447726f75702e73656c6563746564207b0a202020202020202020202020626f726465723a2031707820776869746520736f6c69643b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20626c61636b2021696d706f7274616e743b0a20202020202020207d0a0a20202020202020202e74657374526573756c7447726f75702e736b6970706564207b0a202020202020202020202020626f726465723a20327078206772617920736f6c69643b0a20202020202020207d0a0a20202020202020202e74657374526573756c7447726f75702e6661696c6564207b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a207265643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c6973742c0a20202020202020202e63617264436f6e7461696e65722e7465737444657461696c207b0a2020202020202020202020206d617267696e2d746f703a20313670783b0a20202020202020202020202070616464696e673a20313670783b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374207b0a202020202020202020202020636f6c6f723a20233963396339633b0a20202020202020202020202070616464696e673a20303b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207b0a202020202020202020202020637572736f723a2064656661756c743b0a202020202020202020202020626f726465722d626f74746f6d3a20317078202364616461646120646f747465643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e74657374537461747573207b0a202020202020202020202020666f6e742d73697a653a20312e32656d3b0a202020202020202020202020666f6e742d7765696768743a20626f6c643b0a202020202020202020202020636f6c6f723a20233133396531333b0a202020202020202020202020706f696e7465722d6576656e74733a206e6f6e653b0a202020202020202020202020646973706c61793a20696e6c696e652d626c6f636b3b0a2020202020202020202020206f766572666c6f773a2068696464656e3b0a202020202020202020202020666c6f61743a206c6566743b0a20202020202020202020202070616464696e672d746f703a20313070783b0a20202020202020202020202070616464696e672d6c6566743a20323070783b0a20202020202020202020202070616464696e672d72696768743a20313270783b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e746573745374617475732e736b6970706564207b0a202020202020202020202020636f6c6f723a20677261793b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e746573745374617475732e6661696c6564207b0a202020202020202020202020636f6c6f723a207265643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e746573745469746c65207b0a202020202020202020202020666f6e742d73697a653a20302e39656d3b0a20202020202020202020202070616464696e673a2031327078203020313070783b0a202020202020202020202020646973706c61793a20696e6c696e652d626c6f636b3b0a202020202020202020202020706f696e7465722d6576656e74733a206e6f6e653b0a202020202020202020202020636f6c6f723a20233532353235323b0a202020202020202020202020746578742d6f766572666c6f773a20656c6c69707369733b0a2020202020202020202020206f766572666c6f773a2068696464656e3b0a20202020202020202020202077696474683a2063616c632831303025202d203131307078293b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207370616e2e746573744475726174696f6e207b0a202020202020202020202020706f696e7465722d6576656e74733a206e6f6e653b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f77207b0a202020202020202020202020706f736974696f6e3a2072656c61746976653b0a202020202020202020202020626f726465722d6c6566743a20347078202334336331343320736f6c69643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f772e736b6970706564207b0a202020202020202020202020636f6c6f723a20677261793b0a202020202020202020202020626f726465722d6c6566743a20347078206772617920736f6c69643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f772e6661696c6564207b0a202020202020202020202020636f6c6f723a207265643b0a202020202020202020202020626f726465722d6c6566743a203470782072656420736f6c69643b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e65722e7465737447726f75704c697374202e7465737447726f7570526f773a686f766572207b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20236666666165613b0a2020202020202020202020207472616e736974696f6e3a20302e323530733b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e746573744f7574707574207b0a20202020202020202020202070616464696e673a203870782031367078203234707820313670783b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e636f6e736f6c65207b0a202020202020202020202020646973706c61793a20626c6f636b3b0a202020202020202020202020666f6e742d66616d696c793a206d6f6e6f73706163653b0a20202020202020202020202070616464696e673a20313070783b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20233432343234323b0a202020202020202020202020636f6c6f723a20233161666630303b0a202020202020202020202020626f726465722d626f74746f6d3a20317078202331616666303020646f747465643b0a2020202020202020202020206f766572666c6f773a206175746f3b0a202020202020202020202020666f6e742d73697a653a20312e31656d3b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e746573744f7574707574202e7465737444657461696c207b0a202020202020202020202020626f726465722d626f74746f6d3a20317078202364306430643020736f6c69643b0a20202020202020202020202070616464696e673a20313670783b0a2020202020202020202020206261636b67726f756e642d636f6c6f723a20236536653665363b0a202020202020202020202020626f726465722d7261646975733a2030203020347078203470783b0a202020202020202020202020636f6c6f723a2064696d677265793b0a202020202020202020202020666f6e742d73697a653a20302e38656d3b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e636f6e736f6c652e736b69707065647b0a202020202020202020202020636f6c6f723a20236439643964393b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e636f6e736f6c652e6661696c6564207b0a202020202020202020202020636f6c6f723a20236666623262323b0a20202020202020207d0a0a20202020202020202e63617264436f6e7461696e6572202e746573744475726174696f6e207b0a202020202020202020202020706f736974696f6e3a206162736f6c7574653b0a202020202020202020202020746f703a203570783b0a20202020202020202020202072696768743a203870783b0a202020202020202020202020746578742d616c69676e3a2072696768743b0a20202020202020202020202070616464696e672d72696768743a203870783b0a202020202020202020202020626f782d73697a696e673a20626f726465722d626f783b0a20202020202020207d0a202020203c2f7374796c653e0a3c2f686561643e0a3c626f64793e0a3c64697620636c6173733d2270616765486561646572223e0a202020203c7370616e20636c6173733d2270726f6a6563745469746c65223e7b7b2e5265706f72745469746c657d7d3c2f7370616e3e0a202020203c64697620636c6173733d22746573745374617473223e0a20202020202020203c7370616e20636c6173733d22746f74616c223e3c7370616e20636c6173733d22696e64696361746f72223e26626f78626f783b3c2f7370616e3e20546f74616c3a203c7374726f6e673e7b7b2e4e756d4f6654657374737d7d3c2f7374726f6e673e4475726174696f6e3a203c7374726f6e673e7b7b2e546573744475726174696f6e7d7d3c2f7374726f6e673e0a20202020202020203c2f7370616e3e3c7370616e20636c6173733d22706173736564223e3c7370616e20636c6173733d22696e64696361746f72223e26636865636b3b3c2f7370616e3e205061737365643a203c7374726f6e673e7b7b2e4e756d4f66546573745061737365647d7d3c2f7374726f6e673e0a20202020202020203c2f7370616e3e3c7370616e20636c6173733d22736b6970706564223e3c7370616e20636c6173733d22696e64696361746f72223e26646173683b3c2f7370616e3e20536b69707065643a203c7374726f6e673e7b7b2e4e756d4f6654657374536b69707065647d7d3c2f7374726f6e673e0a20202020202020203c2f7370616e3e3c7370616e20636c6173733d226661696c6564223e3c7370616e20636c6173733d22696e64696361746f72223e2663726f73733b3c2f7370616e3e204661696c65643a203c7374726f6e673e7b7b2e4e756d4f66546573744661696c65647d7d3c2f7374726f6e673e0a20202020202020203c2f7370616e3e0a202020203c2f6469763e0a202020203c7370616e20636c6173733d227465737447726f7570735469746c65223e546573742047726f7570733a3c2f7370616e3e0a202020203c7370616e20636c6173733d2274657374457865637574696f6e44617465223e7b7b2e54657374457865637574696f6e446174657d7d3c2f7370616e3e0a3c2f6469763e0a3c64697620636c6173733d22746573745265706f7274436f6e7461696e6572223e0a202020203c64697620636c6173733d2263617264436f6e7461696e6572223e0a20202020202020203c6469762069643d2274657374526573756c7473223e0a2020202020202020202020207b7b72616e676520246b2c202476203a3d202e54657374526573756c74737d7d0a202020202020202020202020202020203c64697620636c6173733d2274657374526573756c7447726f7570207b7b2e4661696c757265496e64696361746f727d7d207b7b2e536b6970706564496e64696361746f727d7d222069643d227b7b246b7d7d227b7b69662024762e5469746c657d7d207469746c653d227b7b24762e5469746c657d7d227b7b656e647d7d3e3c2f6469763e0a2020202020202020202020207b7b656e647d7d0a20202020202020203c2f6469763e0a202020203c2f6469763e0a202020203c64697620636c6173733d2263617264436f6e7461696e6572207465737447726f75704c697374222069643d227465737447726f75704c697374223e3c2f6469763e0a3c2f6469763e0a3c73637269707420747970653d226170706c69636174696f6e2f6a617661736372697074223e0a202020207b7b2e4a73436f64657d7d0a0a202020202f2a2a0a20202020202a204074797065207b54657374526573756c74737d0a20202020202a2f0a20202020636f6e73742064617461203d207b7b2e54657374526573756c74737d7d0a0a20202020636f6e7374207265706f7274203d2077696e646f772e476f546573745265706f7274287b0a2020202020202020202020202020202020202020202020202020202020202020202020202020202020646174613a20646174612c0a202020202020202020202020202020202020202020202020202020202020202020202020202020202074657374526573756c7473456c656d3a20646f63756d656e742e676574456c656d656e7442794964282774657374526573756c747327292c0a20202020202020202020202020202020202020202020202020202020202020202020202020202020207465737447726f75704c697374456c656d3a20646f63756d656e742e676574456c656d656e744279496428277465737447726f75704c69737427290a2020202020202020202020202020202020202020202020202020202020202020202020202020207d293b0a0a0a3c2f7363726970743e0a3c2f626f64793e0a3c2f68746d6c3e0a` var testReportJsCode = `2f2a2a0a202a20407479706564656620546573745374617475730a202a204070726f7065727479207b737472696e677d20546573744e616d650a202a204070726f7065727479207b737472696e677d205061636b6167650a202a204070726f7065727479207b6e756d6265727d20456c617073656454696d650a202a204070726f7065727479207b41727261792e3c737472696e673e7d204f75747075740a202a204070726f7065727479207b626f6f6c65616e7d205061737365640a202a204070726f7065727479207b626f6f6c65616e7d20536b69707065640a202a2f0a636c6173732054657374537461747573207b7d0a0a2f2a2a0a202a204074797065646566205465737447726f7570446174610a202a204074797065207b6f626a6563747d0a202a204070726f7065727479207b737472696e677d204661696c757265496e64696361746f720a202a204070726f7065727479207b737472696e677d20536b6970706564496e64696361746f720a202a204070726f7065727479207b41727261792e3c546573745374617475733e7d0a202a2f0a636c617373205465737447726f757044617461207b7d0a0a2f2a2a0a202a2040747970656465662054657374526573756c74730a202a204074797065207b41727261792e3c5465737447726f7570446174613e7d0a202a2f0a636c6173732054657374526573756c747320657874656e6473204172726179207b7d0a0a2f2a2a0a202a2040747970656465662053656c65637465644974656d730a202a204070726f7065727479207b48544d4c456c656d656e747c4576656e745461726765747d2074657374526573756c74730a202a204070726f7065727479207b537472696e677d2073656c65637465645465737447726f7570436f6c6f720a202a2f0a636c6173732053656c65637465644974656d73207b7d0a0a2f2a2a0a202a20407479706564656620476f546573745265706f7274456c656d656e74730a202a204070726f7065727479207b54657374526573756c74737d20646174610a202a204070726f7065727479207b48544d4c456c656d656e747d2074657374526573756c7473456c656d0a202a204070726f7065727479207b48544d4c456c656d656e747d207465737447726f75704c697374456c656d0a202a2f0a636c61737320476f546573745265706f7274456c656d656e7473207b7d0a0a0a2f2a2a0a202a204d61696e20656e74727920706f696e7420666f7220476f546573745265706f72742e0a202a2040706172616d207b476f546573745265706f7274456c656d656e74737d20656c656d656e74730a202a204072657475726e73207b7b74657374526573756c7473436c69636b48616e646c65723a2074657374526573756c7473436c69636b48616e646c65727d7d0a202a2040636f6e7374727563746f720a202a2f0a77696e646f772e476f546573745265706f7274203d2066756e6374696f6e2028656c656d656e747329207b0a2020636f6e7374202f2a2a4074797065207b53656c65637465644974656d737d2a2f2073656c65637465644974656d73203d207b0a2020202074657374526573756c74733a206e756c6c2c0a2020202073656c65637465645465737447726f7570436f6c6f723a206e756c6c0a20207d0a0a202066756e6374696f6e206164644576656e7444617461286576656e7429207b0a20202020696620286576656e742e64617461203d3d206e756c6c29207b0a2020202020206576656e742e64617461203d207b7461726765743a206576656e742e7461726765747d0a202020207d0a2020202072657475726e206576656e740a20207d0a0a0a2020636f6e737420676f546573745265706f7274203d207b0a202020202f2a2a0a20202020202a20496e766f6b6564207768656e2061207573657220636c69636b73206f6e206f6e65206f662074686520746573742067726f75702064697620656c656d656e74732e0a20202020202a2040706172616d207b48544d4c456c656d656e747d207461726765742054686520656c656d656e74206173736f63696174656420776974682074686520746573742067726f75702e0a20202020202a2040706172616d207b626f6f6c65616e7d2073686966744b657920496620707265737365642c20616c6c206f6620746573742064657461696c206173736f63696174656420746f2074686520746573742067726f75702069732073686f776e2e0a20202020202a2040706172616d207b54657374526573756c74737d20646174610a20202020202a2040706172616d207b53656c65637465644974656d737d2073656c65637465644974656d730a20202020202a2040706172616d207b66756e6374696f6e287461726765743a20456c656d656e742c20646174613a2054657374526573756c7473297d207465737447726f75704c69737448616e646c65720a20202020202a2f0a2020202074657374526573756c7473436c69636b48616e646c65723a2066756e6374696f6e20287461726765742c0a20202020202020202020202020202020202020202020202020202020202020202020202020202073686966744b65792c0a202020202020202020202020202020202020202020202020202020202020202020202020202020646174612c0a20202020202020202020202020202020202020202020202020202020202020202020202020202073656c65637465644974656d732c0a2020202020202020202020202020202020202020202020202020202020202020202020202020207465737447726f75704c69737448616e646c657229207b0a0a202020202020696620287461726765742e636c6173734c6973742e636f6e7461696e73282774657374526573756c7447726f75702729203d3d3d2066616c736529207b0a202020202020202072657475726e0a2020202020207d0a2020202020206966202873656c65637465644974656d732e74657374526573756c747320213d206e756c6c29207b0a20202020202020206c65742074657374526573756c7473456c656d656e74203d202f2a2a4074797065207b48544d4c456c656d656e747d2a2f2073656c65637465644974656d732e74657374526573756c74730a202020202020202074657374526573756c7473456c656d656e742e636c6173734c6973742e72656d6f7665282273656c656374656422290a202020202020202074657374526573756c7473456c656d656e742e7374796c652e6261636b67726f756e64436f6c6f72203d2073656c65637465644974656d732e73656c65637465645465737447726f7570436f6c6f720a2020202020207d0a202020202020636f6e7374207465737447726f75704964203d202f2a2a4074797065207b6e756d6265727d2a2f207461726765742e69640a20202020202069662028287461726765742e6964203d3d3d20756e646566696e6564290a20202020202020207c7c2028646174615b7465737447726f757049645d203d3d3d20756e646566696e6564290a20202020202020207c7c2028646174615b7465737447726f757049645d5b2754657374526573756c7473275d203d3d3d20756e646566696e65642929207b0a202020202020202072657475726e0a2020202020207d0a202020202020636f6e73742074657374526573756c7473203d202f2a2a4074797065207b54657374526573756c74737d2a2f20646174615b7465737447726f757049645d5b2754657374526573756c7473275d0a2020202020206c6574207465737447726f75704c697374203d202f2a2a4074797065207b737472696e677d2a2f2027270a20202020202073656c65637465644974656d732e73656c65637465645465737447726f7570436f6c6f72203d20676574436f6d70757465645374796c6528746172676574292e67657450726f706572747956616c756528276261636b67726f756e642d636f6c6f7227290a20202020202073656c65637465644974656d732e74657374526573756c7473203d207461726765740a2020202020207461726765742e636c6173734c6973742e616464282273656c656374656422290a202020202020666f7220286c65742069203d20303b2069203c2074657374526573756c74732e6c656e6774683b20692b2b29207b0a2020202020202020636f6e73742074657374526573756c74203d202f2a2a4074797065207b5465737447726f7570446174617d2a2f2074657374526573756c74735b695d0a2020202020202020636f6e73742074657374506173736564203d202f2a2a4074797065207b626f6f6c65616e7d2a2f2074657374526573756c742e5061737365640a2020202020202020636f6e73742074657374536b6970706564203d202f2a2a4074797065207b626f6f6c65616e7d2a2f2074657374526573756c742e536b69707065640a2020202020202020636f6e73742074657374506173736564537461747573203d202f2a2a4074797065207b737472696e677d2a2f20287465737450617373656429203f202727203a202874657374536b6970706564203f2027736b697070656427203a20276661696c656427290a2020202020202020636f6e737420746573744964203d202f2a2a4074797065207b737472696e677d2a2f207461726765742e617474726962757465735b276964275d2e76616c75650a20202020202020207465737447726f75704c697374202b3d20603c64697620636c6173733d227465737447726f7570526f7720247b746573745061737365645374617475737d2220646174612d67726f757069643d22247b7465737449647d2220646174612d696e6465783d22247b697d223e0a20202020202020203c7370616e20636c6173733d227465737453746174757320247b746573745061737365645374617475737d223e247b287465737450617373656429203f202726636865636b27203a202874657374536b6970706564203f2027266461736827203a20272663726f737327297d3b3c2f7370616e3e0a20202020202020203c7370616e20636c6173733d22746573745469746c65223e247b74657374526573756c742e546573744e616d657d3c2f7370616e3e0a20202020202020203c7370616e20636c6173733d22746573744475726174696f6e223e3c7370616e3e247b74657374526573756c742e456c617073656454696d657d73203c2f7370616e3ee28fb13c2f7370616e3e0a2020202020203c2f6469763e600a2020202020207d0a202020202020636f6e7374207465737447726f75704c697374456c656d203d20656c656d656e74732e7465737447726f75704c697374456c656d0a2020202020207465737447726f75704c697374456c656d2e696e6e657248544d4c203d2027270a2020202020207465737447726f75704c697374456c656d2e696e6e657248544d4c203d207465737447726f75704c6973740a0a2020202020206966202873686966744b657929207b0a20202020202020207465737447726f75704c697374456c656d2e717565727953656c6563746f72416c6c28272e7465737447726f7570526f7727290a202020202020202020202020202020202020202020202020202e666f72456163682828656c656d29203d3e207465737447726f75704c69737448616e646c657228656c656d2c206461746129290a2020202020207d20656c7365206966202874657374526573756c74732e6c656e677468203d3d3d203129207b0a20202020202020207465737447726f75704c69737448616e646c6572287465737447726f75704c697374456c656d2e717565727953656c6563746f7228272e7465737447726f7570526f7727292c2064617461290a2020202020207d0a202020207d2c0a0a202020202f2a2a0a20202020202a0a20202020202a2040706172616d207b456c656d656e747d207461726765740a20202020202a2040706172616d207b54657374526573756c74737d20646174610a20202020202a2f0a202020207465737447726f75704c69737448616e646c65723a2066756e6374696f6e20287461726765742c206461746129207b0a202020202020636f6e73742061747472696273203d207461726765745b2761747472696275746573275d0a20202020202069662028617474726962732e6861734f776e50726f70657274792827646174612d67726f75706964272929207b0a2020202020202020636f6e73742067726f75704964203d202f2a2a4074797065207b6e756d6265727d2a2f20617474726962735b27646174612d67726f75706964275d2e76616c75650a2020202020202020636f6e73742074657374496e646578203d202f2a2a4074797065207b6e756d6265727d2a2f20617474726962735b27646174612d696e646578275d2e76616c75650a2020202020202020636f6e73742074657374537461747573203d202f2a2a4074797065207b546573745374617475737d2a2f20646174615b67726f757049645d5b2754657374526573756c7473275d5b74657374496e6465785d0a2020202020202020636f6e737420746573744f7574707574446976203d202f2a2a4074797065207b48544d4c446976456c656d656e747d2a2f207461726765742e717565727953656c6563746f7228276469762e746573744f757470757427290a0a202020202020202069662028746573744f7574707574446976203d3d206e756c6c29207b0a20202020202020202020636f6e737420746573744f7574707574446976203d20646f63756d656e742e637265617465456c656d656e74282764697627290a20202020202020202020746573744f75747075744469762e636c6173734c6973742e6164642827746573744f757470757427290a20202020202020202020636f6e737420636f6e736f6c65507265203d20646f63756d656e742e637265617465456c656d656e74282770726527290a20202020202020202020636f6e736f6c655072652e636c6173734c6973742e6164642827636f6e736f6c6527290a20202020202020202020636f6e7374207465737444657461696c446976203d20646f63756d656e742e637265617465456c656d656e74282764697627290a202020202020202020207465737444657461696c4469762e636c6173734c6973742e61646428277465737444657461696c27290a20202020202020202020636f6e7374207061636b6167654e616d65446976203d20646f63756d656e742e637265617465456c656d656e74282764697627290a202020202020202020207061636b6167654e616d654469762e636c6173734c6973742e61646428277061636b61676527290a202020202020202020207061636b6167654e616d654469762e696e6e657248544d4c203d20603c7374726f6e673e5061636b6167653a3c2f7374726f6e673e20247b746573745374617475732e5061636b6167657d600a20202020202020202020636f6e7374207465737446696c654e616d65446976203d20646f63756d656e742e637265617465456c656d656e74282764697627290a202020202020202020207465737446696c654e616d654469762e636c6173734c6973742e616464282766696c656e616d6527290a2020202020202020202069662028746573745374617475732e5465737446696c654e616d652e7472696d2829203d3d3d20222229207b0a2020202020202020202020207465737446696c654e616d654469762e696e6e657248544d4c203d20603c7374726f6e673e46696c656e616d653a3c2f7374726f6e673e206e2f6120266e6273703b266e6273703b600a202020202020202020207d20656c7365207b0a2020202020202020202020207465737446696c654e616d654469762e696e6e657248544d4c203d20603c7374726f6e673e46696c656e616d653a3c2f7374726f6e673e20247b746573745374617475732e5465737446696c654e616d657d20266e6273703b266e6273703b600a2020202020202020202020207465737446696c654e616d654469762e696e6e657248544d4c202b3d20603c7374726f6e673e4c696e653a3c2f7374726f6e673e20247b746573745374617475732e5465737446756e6374696f6e44657461696c2e4c696e657d20600a2020202020202020202020207465737446696c654e616d654469762e696e6e657248544d4c202b3d20603c7374726f6e673e436f6c3a3c2f7374726f6e673e20247b746573745374617475732e5465737446756e6374696f6e44657461696c2e436f6c7d600a202020202020202020207d0a202020202020202020207465737444657461696c4469762e696e7365727441646a6163656e74456c656d656e7428276265666f7265656e64272c207061636b6167654e616d65446976290a202020202020202020207465737444657461696c4469762e696e7365727441646a6163656e74456c656d656e7428276265666f7265656e64272c207465737446696c654e616d65446976290a20202020202020202020746573744f75747075744469762e696e7365727441646a6163656e74456c656d656e7428276166746572626567696e272c20636f6e736f6c65507265290a20202020202020202020746573744f75747075744469762e696e7365727441646a6163656e74456c656d656e7428276265666f7265656e64272c207465737444657461696c446976290a202020202020202020207461726765742e696e7365727441646a6163656e74456c656d656e7428276265666f7265656e64272c20746573744f7574707574446976290a0a2020202020202020202069662028746573745374617475732e50617373656429207b0a202020202020202020202020636f6e736f6c655072652e636c6173734c6973742e72656d6f76652827736b697070656427290a202020202020202020202020636f6e736f6c655072652e636c6173734c6973742e72656d6f766528276661696c656427290a202020202020202020207d20656c73652069662028746573745374617475732e536b697070656429207b0a202020202020202020202020636f6e736f6c655072652e636c6173734c6973742e6164642827736b697070656427290a202020202020202020202020636f6e736f6c655072652e636c6173734c6973742e72656d6f766528276661696c656427290a202020202020202020207d20656c7365207b0a202020202020202020202020636f6e736f6c655072652e636c6173734c6973742e72656d6f76652827736b697070656427290a202020202020202020202020636f6e736f6c655072652e636c6173734c6973742e61646428276661696c656427290a202020202020202020207d0a20202020202020202020636f6e736f6c655072652e74657874436f6e74656e74203d20746573745374617475732e4f75747075742e6a6f696e282727290a20202020202020207d20656c7365207b0a20202020202020202020746573744f75747075744469762e72656d6f766528290a20202020202020207d0a2020202020207d0a202020207d0a20207d0a0a20202f2f2b2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2b0a20202f2f7c20202020736574757020444f4d206576656e7473202020207c0a20202f2f2b2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2b0a2020656c656d656e74732e74657374526573756c7473456c656d0a202020202020202020202e6164644576656e744c697374656e65722827636c69636b272c206576656e74203d3e0a202020202020202020202020676f546573745265706f72742e74657374526573756c7473436c69636b48616e646c6572282f2a2a4074797065207b48544d4c456c656d656e747d2a2f206164644576656e7444617461286576656e74292e646174612e7461726765742c0a202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020206576656e742e73686966744b65792c0a20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020656c656d656e74732e646174612c0a2020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202073656c65637465644974656d732c0a20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020676f546573745265706f72742e7465737447726f75704c69737448616e646c657229290a0a2020656c656d656e74732e7465737447726f75704c697374456c656d0a202020202020202020202e6164644576656e744c697374656e65722827636c69636b272c206576656e74203d3e0a202020202020202020202020676f546573745265706f72742e7465737447726f75704c69737448616e646c6572282f2a2a4074797065207b456c656d656e747d2a2f206576656e742e7461726765742c0a20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020656c656d656e74732e6461746129290a0a202072657475726e20676f546573745265706f72740a7d0a` diff --git a/main.go b/main.go index ff0dee6..0735224 100644 --- a/main.go +++ b/main.go @@ -65,6 +65,7 @@ type ( testGroupData struct { FailureIndicator string SkippedIndicator string + Title string TestResults []*testStatus } @@ -461,6 +462,9 @@ func generateReport(tmplData *templateData, allTests map[string]*testStatus, tes status.TestFileName = testFileInfo.FileName status.TestFunctionDetail = testFileInfo.TestFunctionFilePos } + if tmplData.groupTestsByPackage { + tmplData.TestResults[tgID].Title = tgPackage + } tmplData.TestResults[tgID].TestResults = append(tmplData.TestResults[tgID].TestResults, status) if !status.Passed { if !status.Skipped { diff --git a/test_report.html.template b/test_report.html.template index bd9c229..8e9e21c 100644 --- a/test_report.html.template +++ b/test_report.html.template @@ -249,7 +249,7 @@
{{range $k, $v := .TestResults}} -
+
{{end}}
From 8d618ec1a7607c827bdae12baf8022c176c333ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Fri, 8 Sep 2023 12:20:34 +0200 Subject: [PATCH 3/4] Sort the packages by name under the group --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index 0735224..3e8c382 100644 --- a/main.go +++ b/main.go @@ -442,6 +442,7 @@ func generateReport(tmplData *templateData, allTests map[string]*testStatus, tes } if tmplData.groupTestsByPackage { sort.Sort(byPackage(tests)) + sort.Stable(byName(tests)) } else { sort.Sort(byName(tests)) } From c2c9301f3e5932af20a83620986602ff5b353df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Fri, 8 Sep 2023 12:22:53 +0200 Subject: [PATCH 4/4] Add flag to avoid sorting the tests by name --- main.go | 28 +++++++++++++++++++++++----- main_test.go | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 3e8c382..2f857c6 100644 --- a/main.go +++ b/main.go @@ -38,6 +38,7 @@ type ( TestName string Package string ElapsedTime float64 + Order int Output []string Passed bool Skipped bool @@ -58,6 +59,7 @@ type ( JsCode template.JS numOfTestsPerGroup int groupTestsByPackage bool + sortTestsByName bool OutputFilename string TestExecutionDate string } @@ -74,6 +76,7 @@ type ( sizeFlag string groupSize int groupPackage bool + nosortFlag bool listFlag string outputFlag string verbose bool @@ -128,6 +131,7 @@ func initRootCommand() (*cobra.Command, *templateData, *cmdFlags) { } tmplData.numOfTestsPerGroup = flags.groupSize tmplData.groupTestsByPackage = flags.groupPackage + tmplData.sortTestsByName = !flags.nosortFlag tmplData.ReportTitle = flags.titleFlag tmplData.OutputFilename = flags.outputFlag if err := checkIfStdinIsPiped(); err != nil { @@ -183,6 +187,11 @@ func initRootCommand() (*cobra.Command, *templateData, *cmdFlags) { }, } rootCmd.AddCommand(versionCmd) + rootCmd.PersistentFlags().BoolVarP(&flags.nosortFlag, + "no-sort", + "", + false, + "don't sort the packages by name in the list") rootCmd.PersistentFlags().StringVarP(&flags.titleFlag, "title", "t", @@ -227,6 +236,7 @@ func readTestDataFromStdIn(stdinScanner *bufio.Scanner, flags *cmdFlags, cmd *co allPackageNames = map[string]*types.Nil{} // read from stdin and parse "go test" results + order := 0 for stdinScanner.Scan() { lineInput := stdinScanner.Bytes() if flags.verbose { @@ -246,9 +256,11 @@ func readTestDataFromStdIn(stdinScanner *bufio.Scanner, flags *cmdFlags, cmd *co status = &testStatus{ TestName: goTestOutputRow.TestName, Package: goTestOutputRow.Package, + Order: order, Output: []string{}, } allTests[key] = status + order += 1 } else { status = allTests[key] } @@ -386,6 +398,7 @@ type testRef struct { key string pkg string name string + ord int } type byPackage []testRef type byName []testRef @@ -435,15 +448,20 @@ func generateReport(tmplData *templateData, allTests map[string]*testStatus, tes tgCounter := 0 tgID := 0 - // sort the allTests map by test name (this will produce a consistent order when iterating through the map) var tests []testRef for test, status := range allTests { - tests = append(tests, testRef{test, status.Package, status.TestName}) + tests = append(tests, testRef{test, status.Package, status.TestName, status.Order}) } + // sort the allTests map by input order + sort.Slice(tests, func(i, j int) bool { + return tests[i].ord < tests[j].ord + }) if tmplData.groupTestsByPackage { - sort.Sort(byPackage(tests)) - sort.Stable(byName(tests)) - } else { + sort.Stable(byPackage(tests)) + if tmplData.sortTestsByName { + sort.Stable(byName(tests)) + } + } else if tmplData.sortTestsByName { sort.Sort(byName(tests)) } for _, test := range tests { diff --git a/main_test.go b/main_test.go index a8d32bb..d6c47dd 100644 --- a/main_test.go +++ b/main_test.go @@ -248,6 +248,7 @@ func TestGenerateReport(t *testing.T) { TestResultGroupIndicatorWidth: "20px", TestResultGroupIndicatorHeight: "16px", ReportTitle: "test-title", + sortTestsByName: true, numOfTestsPerGroup: 2, OutputFilename: "test-output-report.html", }