-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-libtestArea: `#[test]` / the `test` libraryArea: `#[test]` / the `test` libraryB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.T-testing-devexRelevant to the testing devex team (testing DX), which will review and decide on the PR/issue.Relevant to the testing devex team (testing DX), which will review and decide on the PR/issue.
Description
Added in #46450
Available in nightly behind a -Z
flag.
jszwedko, gilescope, stefnotch, mmccoyd, matrach and 5 moregilescope, jszwedko and schneiderfelipegilescope, jszwedko, mmccoyd and schneiderfelipemcmasn-amzn
Metadata
Metadata
Assignees
Labels
A-libtestArea: `#[test]` / the `test` libraryArea: `#[test]` / the `test` libraryB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.T-testing-devexRelevant to the testing devex team (testing DX), which will review and decide on the PR/issue.Relevant to the testing devex team (testing DX), which will review and decide on the PR/issue.
Type
Projects
Status
No status
Milestone
Relationships
Development
Select code repository
Activity
johnterickson commentedon Feb 21, 2019
@nrc You mentioned "The long-term solution is going to be deeply intertwined with pluggable test runners" in #46450. Does that mean that JSON won't be stabilized until there are pluggable test runners?
I'm trying to figure out if it makes sense for me to continue looking at #51924 right now, or if I should hold off for the time being. For example, I'm looking at adding test durations to the JSON (master...johnterickson:testjson) and converting the output to JUnit (https://github.com/johnterickson/cargo2junit/).
djrenren commentedon Feb 26, 2019
Yeah I think we should stabilize something like this independently of custom test frameworks. It makes sense that the included test framework would have a programmatically readable output. Libtest's conceptual model is pretty simple and most likely won't undergo any drastic changes so I'm all for stabilizing something. I'd prefer to have a JSON Schema that describes the structure before stabilization. We'd also need to audit to ensure it's resilient to any minor changes or additions over time.
@alexcrichton thoughts?
alexcrichton commentedon Feb 26, 2019
Seems like a plausible addition to me! So long as it's designed careful I think it'd be good to go
epage commentedon Feb 27, 2019
From the experience of creating naiive serde structs / enums for libtest's output, here are my thoughts from translating it exactly how it is written in libtest (rather than inventing my own schema that happens to be compatible):
type
field conflates suite/test being finished and why it finished. This is annoying for if you want to get information regardless of the completion status/.bench
event is too narrowly focused on the output of the current implementation and not on what might be wantedMy PR where you can see the data structure's I created: https://github.com/crate-ci/escargot/pull/24/files
Ideas to consider
event
andtype
fields. Unsure of the value of thistype
field intotype
andstatus
and define more fields as being available for all types. For example, it could be useful to programmatically reportstdout
for a successful test and leave it to the rendering engine to decide whether to ignore it or not. This doesn't mean all test implementations need to report all of the fields, but define it as possible.bench
implementations, like criterion, to review thebench
schema.andoriyu commentedon Mar 3, 2019
I think it's worth adding things like package and type of test. Type of test: unit test, doc test, integration test.
The package is something like: module for unit test, resource path for doc test (crate::foo::Bar), and filename for integration test.
epage commentedon Mar 4, 2019
Since libtest tracks test times (at minimum, reporting if its taking too long), it would be nice if that got included in the programmatic output so we can report it to the user, e.g. in JUnit. Alternatively, we'd have to timestamp the events as we read them.
johnterickson commentedon Mar 6, 2019
@epage / @andoriyu Are one of you planning on proposing a better schema? I like what you're proposing.
rbtcollins commentedon Apr 24, 2019
If I may add a semi-random thing; https://github.com/testing-cabal/subunit is a testing protocol thats been around for a while (one of a number) - the V2 even model is very similar in nature to your proposed JSON output schema. There is a rust implementation of the binary serialisation https://github.com/mtreinish/subunit-rust and I'm interested / planning on doing a JSON variant of V2 at some point for use with web stacks.
All of which to say two things I guess - consider thinking about chunking stdout/err, allowing additional streams, tags, and possibly, if its interesting, consider adopting the same model - I think it would be a super set of libtests current needs.
Of course, doing a new schema and having folk write adapters is complete fine too; I just saw this ticket and thought I'd offer this kibbitz :)
109 remaining items