Skip to content

Commit 80718ae

Browse files
fix: update help docs
1 parent 6127b47 commit 80718ae

File tree

2 files changed

+39
-35
lines changed

2 files changed

+39
-35
lines changed

README.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,19 @@ $./junit-reducer --help
101101
```
102102
Flags:
103103
-h, --help help for junit-reducer
104-
--exclude string Pattern to exclude from input JUnit XML reports
105-
--include string Pattern to find input JUnit XML reports (default "./**/*.xml")
106-
--op-cases-time string Operation for test cases time. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
107-
--op-suites-assertions string Operation for test suites assertions. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
108-
--op-suites-errors string Operation for test suites errors. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
109-
--op-suites-failed string Operation for test suites failed. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
110-
--op-suites-skipped string Operation for test suites skipped. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
111-
--op-suites-tests string Operation for test suites tests. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
112-
--op-suites-time string Operation for test suites time. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
113-
--output-path string Output path for synthetic JUnit XML reports (default "./output/")
114-
--reduce-cases-by string Reduce test cases by name, classname, or file. Options: "classname", "file" or "name" (default "name")
115-
--reduce-suites-by string Reduce test suites by name or filepath or both. Options: "filepath", "name" or "name+filepath" (default "name+filepath")
116-
--rounding-mode string Rounding mode for counts that should be integers. Options: "ceil", "floor" or "round" (default "round")
104+
--include string Glob pattern to find JUnit XML reports to reduce (default "./**/*.xml")
105+
--output-path string Output path for the reduced JUnit XML reports (default "./output/")
106+
--exclude string Glob pattern to omit from included JUnit XML reports
107+
--op-cases-time string Reducer operation for test case time values. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
108+
--op-suites-time string Reducer operation for test suite time values. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
109+
--op-suites-assertions string Reducer operation for test suite assertion counts. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
110+
--op-suites-errors string Reducer operation for test suite error counts. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
111+
--op-suites-failed string Reducer operation for test suite failure counts. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
112+
--op-suites-skipped string Reducer operation for test suite skipped counts. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
113+
--op-suites-tests string Reducer operation for test suite test counts. Options: "max", "mean", "median", "min", "mode" or "sum" (default "mean")
114+
--reduce-cases-by string Key to group and reduce test cases by. Options: "classname", "file" or "name" (default "name")
115+
--reduce-suites-by string Key to group and reduce test suites by. Options: "filepath", "name" or "name+filepath" (default "name+filepath")
116+
--rounding-mode string Rounding mode for counts that should be integers in the final result. Options: "ceil", "floor" or "round" (default "round")
117117
```
118118
119119
## Examples
@@ -128,6 +128,8 @@ junit-reducer \
128128

129129
### Reduce by name
130130

131+
Group test suites and cases by a specific attribute, to deduplicate the reports in the most appropriate way.
132+
131133
```bash
132134
junit-reducer \
133135
--include="test-reports/**/*" \
@@ -136,26 +138,28 @@ junit-reducer \
136138
--reduce-cases-by="classname" # Grouping test cases by classname
137139
```
138140

139-
### Reduce with non-average operations
141+
### Reduce with other operations
140142

141143
```bash
142144
junit-reducer \
143145
--include="test-reports/**/*" \
144146
--output-path="avg-reports/" \
145-
--op-suites-skipped="min" \ # Keeps min of skips across suites of same type
146-
--op-suites-failed="min" \ # Keeps min of failures across suites of same type
147-
--op-suites-errors="min" \ # Keeps min of errors across suites of same type
148-
--op-suites-tests="max" \ # Keeps max of tests across suites of same type
149-
--op-suites-assertions="max" \ # Keeps max of assertions across suites of same type
150-
--op-suites-time="mean" \ # Calculates mean of time across suites of same type
151-
--op-cases-time="mean" # Calculates mean of time across cases of same type
147+
--op-suites-skipped="min" \ # Keeps min of skips across suites of same group
148+
--op-suites-failed="min" \ # Keeps min of failures across suites of same group
149+
--op-suites-errors="min" \ # Keeps min of errors across suites of same group
150+
--op-suites-tests="max" \ # Keeps max of tests across suites of same group
151+
--op-suites-assertions="max" \ # Keeps max of assertions across suites of same group
152+
--op-suites-time="mean" \ # Keeps mean of time across suites of same group
153+
--op-cases-time="mean" # Keeps mean of time across cases of same group
152154
```
153155

154156
### Rounding average counts
155157

158+
You can also specify how to treat counts after they have been reduced.
159+
156160
```bash
157161
junit-reducer \
158162
--include="test-reports/**/*" \
159163
--output-path="avg-reports/" \
160-
--rounding-mode="floor" # Specifies the rounding method
164+
--rounding-mode="floor" # Specifies the rounding method for counts
161165
```

cmd/root.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,17 @@ func Execute() {
149149

150150
//nolint:errcheck // Ignore errors from MarkFlagRequired
151151
func init() {
152-
rootCmd.Flags().StringVar(&include, "include", "./**/*.xml", "Pattern to find input JUnit XML reports")
153-
rootCmd.Flags().StringVar(&outputPath, "output-path", "./output/", "Output path for synthetic JUnit XML reports")
154-
rootCmd.Flags().StringVar(&exclude, "exclude", "", "Pattern to exclude from input JUnit XML reports")
155-
rootCmd.Flags().StringVar(&reduceTestSuitesByString, "reduce-suites-by", enums.TestSuiteFieldKeys[enums.TestSuiteFieldNameFilepath], fmt.Sprintf("Reduce test suites by name or filepath or both. Options: %s", joinOptionsString(enums.GetTestSuiteFields())))
156-
rootCmd.Flags().StringVar(&reduceTestCasesByString, "reduce-cases-by", enums.TestCaseFieldKeys[enums.TestCaseFieldName], fmt.Sprintf("Reduce test cases by name, classname, or file. Options: %s", joinOptionsString(enums.GetTestCaseFields())))
157-
rootCmd.Flags().StringVar(&operationTestSuitesSkippedString, "op-suites-skipped", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Operation for test suites skipped. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
158-
rootCmd.Flags().StringVar(&operationTestSuitesFailedString, "op-suites-failed", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Operation for test suites failed. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
159-
rootCmd.Flags().StringVar(&operationTestSuitesErrorsString, "op-suites-errors", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Operation for test suites errors. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
160-
rootCmd.Flags().StringVar(&operationTestSuitesTestsString, "op-suites-tests", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Operation for test suites tests. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
161-
rootCmd.Flags().StringVar(&operationTestSuitesAssertionsString, "op-suites-assertions", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Operation for test suites assertions. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
162-
rootCmd.Flags().StringVar(&operationTestSuitesTimeString, "op-suites-time", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Operation for test suites time. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
163-
rootCmd.Flags().StringVar(&operationTestCasesTimeString, "op-cases-time", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Operation for test cases time. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
164-
rootCmd.Flags().StringVar(&roundingModeString, "rounding-mode", enums.RoundingModeKeys[enums.RoundingModeRound], fmt.Sprintf("Rounding mode for counts that should be integers. Options: %s", joinOptionsString(enums.GetRoundingModes())))
152+
rootCmd.Flags().StringVar(&include, "include", "./**/*.xml", "Glob pattern to find JUnit XML reports to reduce")
153+
rootCmd.Flags().StringVar(&outputPath, "output-path", "./output/", "Output path for the reduced JUnit XML reports")
154+
rootCmd.Flags().StringVar(&exclude, "exclude", "", "Glob pattern to omit from included JUnit XML reports")
155+
rootCmd.Flags().StringVar(&reduceTestSuitesByString, "reduce-suites-by", enums.TestSuiteFieldKeys[enums.TestSuiteFieldNameFilepath], fmt.Sprintf("Key to group and reduce test suites by. Options: %s", joinOptionsString(enums.GetTestSuiteFields())))
156+
rootCmd.Flags().StringVar(&reduceTestCasesByString, "reduce-cases-by", enums.TestCaseFieldKeys[enums.TestCaseFieldName], fmt.Sprintf("Key to group and reduce test cases by. Options: %s", joinOptionsString(enums.GetTestCaseFields())))
157+
rootCmd.Flags().StringVar(&operationTestSuitesSkippedString, "op-suites-skipped", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Reducer operation for test suite skipped counts. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
158+
rootCmd.Flags().StringVar(&operationTestSuitesFailedString, "op-suites-failed", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Reducer operation for test suite failure counts. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
159+
rootCmd.Flags().StringVar(&operationTestSuitesErrorsString, "op-suites-errors", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Reducer operation for test suite error counts. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
160+
rootCmd.Flags().StringVar(&operationTestSuitesTestsString, "op-suites-tests", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Reducer operation for test suite test counts. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
161+
rootCmd.Flags().StringVar(&operationTestSuitesAssertionsString, "op-suites-assertions", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Reducer operation for test suite assertion counts. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
162+
rootCmd.Flags().StringVar(&operationTestSuitesTimeString, "op-suites-time", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Reducer operation for test suite time values. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
163+
rootCmd.Flags().StringVar(&operationTestCasesTimeString, "op-cases-time", enums.AggregateOperationKeys[enums.AggregateOperationMean], fmt.Sprintf("Reducer operation for test case time values. Options: %s", joinOptionsString(enums.GetAggregateOperations())))
164+
rootCmd.Flags().StringVar(&roundingModeString, "rounding-mode", enums.RoundingModeKeys[enums.RoundingModeRound], fmt.Sprintf("Rounding mode for counts that should be integers in the final result. Options: %s", joinOptionsString(enums.GetRoundingModes())))
165165
}

0 commit comments

Comments
 (0)