You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is intended that it `runtests.jl` will not need to be changed to generate
24
24
a report (unless [properties are being added](#Adding-Properties)).
25
25
26
-
This does assume, however, that `DefaultTestSet`s are being used. In the case of
26
+
This does assume, however, that no custom `TestSet`s are being used. In the case of
27
27
custom `TestSet`s, please see the [discussion](#Custom-TestSet-Types) below.
28
28
29
29
The typical use in a CI process would be:
@@ -210,9 +210,20 @@ However at a minimum, for a custom `TestSet` type to work with `TestReports` it
210
210
- Push itself onto its parent when finishing, if it is not at the top level
211
211
- Have `description` and `results` fields as per a `DefaultTestSet`
212
212
213
-
Testsuite properties cannot be added to a `TestSet` that is not a `ReportingTestSet`,
214
-
(i.e. any `TestSet` that has the type specified to be something other than a
215
-
`ReportingTestSet`, or that inherits a specified type from a parent). If no types
216
-
are specified, `TestReports.test` will ensure that all child `TestSet`s inherit
217
-
the `ReportingTestSet` type.
213
+
The following information in a JUnit XML relies on the functionality of `ReportingTestSet`s
214
+
but can be added to your own custom `TestSet` as described in the table.
215
+
216
+
|Information|Description|
217
+
|---|---|
218
+
| testcase time | This is extracted from a `ReportingResult` by the `TestReports.time_taken` function. For standard `Result`s, rather than `ReportingResult`s, this function returns `Dates.Millisecond(0)`. This function can be extended for other custom `Result` types.|
219
+
| testsuite time| This is extracted from a `TestSet` by the `TestReports.time_taken` function, which can be extended for custom `TestSet`s. If not extended, the `AbstractTestSet` method will be used and the value defaults to `Dates.Millisecond(0)`. |
220
+
| testsuite timestamp| This is extracted from a `TestSet` by the `TestReports.start_time` function, which can be extended for custom `TestSet`s. If not extended, the `AbstractTestSet` method will be used and the value defaults to `Dates.now()`. |
221
+
| testsuite hostname| This is extracted from a `TestSet` by the `TestReports.hostname` function, which can be extended for custom `TestSet`s. If not extended, the `AbstractTestSet` method will be used and the value defaults to `gethostname()`. |
222
+
| testsuite properties| This is extracted from a `TestSet` by the `TestReports.properties` function, which can be extended for custom `TestSet`s. If not extended, the `AbstractTestSet` method will be used and the value defaults to `nothing`. |
223
+
224
+
For further details on extending these fuctions, see the docstrings in [TestSets](@ref).
225
+
226
+
The [source code of `TestReports`](https://github.com/JuliaTesting/TestReports.jl/blob/master/src/testsets.jl) can be used as a starting point for including this behaviour in your custom `TestSet`s.
227
+
228
+
If no `TestSet` types are specified (as per the standard `Test` approach), `TestSet` functionality will ensure that all child `TestSet`s inherit the `ReportingTestSet` type.
@warn"Properties of testset $(ts.description) can not be added to child testset $(childts.description) as it does not have a TestReports.properties method defined."
279
+
# No need to check if childts is has properties defined and ts doesn't as if this is the case
280
+
# ts has no properties to add to that of childts.
281
+
elseif!isnothing(properties(ts))
282
+
parent_keys =keys(properties(ts))
283
+
child_keys =keys(properties(childts))
284
+
# Loop through keys so that warnings can be issued for any duplicates
285
+
for key in parent_keys
286
+
if key in child_keys
287
+
@warn"Property $key in testest $(ts.description) overwritten by child testset $(childts.description)"
288
+
else
289
+
properties(childts)[key] =properties(ts)[key]
290
+
end
211
291
end
212
292
end
213
293
return childts
@@ -231,8 +311,8 @@ function handle_top_level_results!(ts::AbstractTestSet)
0 commit comments