Skip to content
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

Provide an extension point and types hierarchy for rich assertion failure information #73

Open
nskvortsov opened this issue Apr 26, 2023 · 5 comments

Comments

@nskvortsov
Copy link

Some test frameworks or test environments can provide more structured information about the failure than a pair of strings (expected/actual). For example, if expected and actual values are stored in text files on disk, then the paths to those files can be included.

Suggested entry point: getAdditionalInfo() method in AssertionFailedError

Types hierarchy can be similar to JUnit's TestSource.
A serializable marker interface AssertionFailedInfo extends Serializable
A set of implementations that can be type-checked in runtime. E.g.

FileComparisonInfo implements AssertionFailedInfo, FileComparisonData

This can also cover some other requests, e.g. #72

@marcphilipp
Copy link
Member

@nskvortsov Thanks for raising the issue! Would FileComparisonInfo and/or FileComparisonData be part of OpenTest4J as well?

@nskvortsov
Copy link
Author

I think yes, they should be. At least, it will allow other test frameworks to implement it.
I remember there was a discussion about interfaces vs. implementations in the OTA4J here. It states that one can not catch an interface, thus the AssertionFailedError is a concrete class.
For additional information, that one does not need to catch an interface should be sufficient.

@marcphilipp
Copy link
Member

@nskvortsov Is this related to #72? /cc @vlsi

@nskvortsov
Copy link
Author

Yes, it is related. This rich assertion failure infomation can cover the use-case described in #72
I prefer the API-based approach over the json-based text protocol.

@vlsi
Copy link

vlsi commented May 12, 2023

Java API-based approach can't work with, say, Python or BASH tests though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants