-
Notifications
You must be signed in to change notification settings - Fork 263
[SR-1541] Listing test methods #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
YAYY! awesome. |
I think this is useful functionality (and would like to see a JSON form), but I don't think we should do this without first getting buy in and an implementation to get a compatible experience on OS X. Otherwise we cannot effectively use it as scaffolding for SwiftPM features, for example. |
The latest commit on the branch now print JSON output following the format of the OS X code sample on SR-1541:
The previous commit on the branch has the original format, but fixed to include the module name as is expected when filtering to run a single test case or class. Any thoughts on whether it would make sense to support both output formats? |
@swift-ci please test |
I wonder if we should break down the schema to be more explicit, in that the module name, test suite name, and test name are not mangled together, at least in the schema. /cc @aciidb0mb3r @modocache @mike-ferris-apple |
I also suspect we should use a separate verb for list as JSON, it isn't unreasonable for it to have a human readable output mode as a standalone tool (this particularly makes sense in the context of OS X's |
I think it makes sense to have better schema when outputting JSON. Maybe something like this? {
"module1": {
"testcase1": [
"test1",
"test2"
],
"testcase2": [
"test1",
"test2"
]
},
"module2": {
"testcase1": [
"test1",
"test2"
],
"testcase2": [
"test1",
"test2"
]
}
} |
Thanks for pursuing this, @briancroom!
I would love it if Apple XCTest supported listing tests. Depending on how it was implemented, it might even address my concerns from rdar://26152293. |
return .list | ||
} else { | ||
return .run(selectedTestName: arguments[1]) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be really cool if, in a future pull request, we can expand the argument parsing here to include -h
and --help
. SwiftPM also implements its own argument parsing--perhaps we can extract this out into a library of code shared between SwiftPM and corelibs-xctest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do hope to factor out the argument parser more, although for practical reasons it may end up being intertwined with our own internal infrastructure. The ideal would be for the stdlib to help... :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! Once this goes in I was intending to open a Starter Issue for getting help/usage added.
I'm definitely in favor of making the JSON output more structured. I'll revisit the output formatting again when I get the chance, but that probably won't be until the middle of next week since I'll be away from my dev machine for the long weekend up here. Any more input on how to make the output useful for consumers would be great in the meantime! Thanks for the interest and feedback, everyone 😄 |
I believe we have converged on a schema to use for this in: Are we all agreed? |
This is triggered by `--list-tests` or `-l`.
Hot on the heels of swiftlang/swift-package-manager#363 (comment), I have finished updating this branch to include the updated JSON format. The following usages have been added:
I'm very much open to a different flag name for the JSON case in particular, if anyone has preferences. Regardless, as @modocache pointed out, we will need to introduce usage instructions on top of this now that more modes are being added. |
@swift-ci please test |
@ddunbar @ankit @modocache Any feedback here? Should we merge this in? |
looks awesome to me 🤓 |
Looks good! I'm interpreting @ddunbar's enthusiasm for this direction to indicate the tacit approval of the Apple XCTest team 😁 |
YAYY! |
Add a command line flag for printing a list of the tests in the suite. This is triggered by passing
--list-tests
or-l
to an executable that callsXCTMain
.I'm looking for particular feedback on:
corelibs-dev
orevolution
lists.cc @mike-ferris-apple @ddunbar @aciidb0mb3r