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

Adding PropertyAttribute for XUnit #47

Closed
wants to merge 1 commit into from
Closed

Adding PropertyAttribute for XUnit #47

wants to merge 1 commit into from

Conversation

dharmaturtle
Copy link
Member

@dharmaturtle dharmaturtle commented Dec 22, 2020

Inspired by FsCheck's PropertyAttribute, I implemented one for Hedgehog. It currently uses GenX.auto to generate data for methods with the [<Property>] attribute, then checks the method via Property.check.

Currently a draft, but everything works. Next, I'm going to add a way to inject a custom AutoGenConfig. I'll likely copy/paste what FsCheck does.

Related prior discussion: hedgehogqa/fsharp-hedgehog#144

@moodmosaic
Copy link
Member

moodmosaic commented Dec 22, 2020

Great work 👍

@cmeeren
Copy link
Collaborator

cmeeren commented Dec 22, 2020

Personally I'm not interested in this feature; firstly, I find Expecto much more compelling than XUnit; secondly, I like the explicitness of "vanilla" Hedgehog; and thirdly, I have very limited resources for further OSS project support. And as @moodmosaic says, I'm not sure this belongs in the Hedgehog.Experimental repo. Perhaps this could be a separate repo under the hedgehogqa organization?

@moodmosaic
Copy link
Member

Perhaps this could be a separate repo under the hedgehogqa organization?

Eventually it could be. If it's of high quality and popular at the same time (e.g. haskell-hedgehog-classes started under chessai's own github and later on we moved it inside the org).

@cmeeren
Copy link
Collaborator

cmeeren commented Dec 22, 2020

Sure. The point being, perhaps this belongs in a separate repo (not just package) and not in Hedgehog.Experimental.

@dharmaturtle
Copy link
Member Author

dharmaturtle commented Dec 22, 2020

Hedgehog.Xunit sounds good to me. I'll likely only support Xunit 2.* (and 3.0, when it arrives) as that's what I'm using.

My preferred test runner (NCrunch) doesn't support Expecto, so I'm sticking with Xunit for now.

I'll close this as I agree it doesn't belong in Experimental. I'll leave it in my own github, as it's being built primarily for myself anyway, and we can leave the possibility of it joining the hedgehogqa org ambiguous.

@TysonMN
Copy link
Member

TysonMN commented Dec 22, 2020

From Expecto's README

Expecto also provides a simple API for property based testing using FsCheck.

We want people to use Hedgehog instead! ;)

@moodmosaic
Copy link
Member

Yep, basically we'd need both.

@TysonMN
Copy link
Member

TysonMN commented Dec 22, 2020

Can you elaborate on that? Are you saying that there is something about QuickCheck/FsCheck that his technically superior to Hedgehog?

@moodmosaic
Copy link
Member

I apologize if I wasn't clear. I meant it's nice to have both Hedgehog.Xunit and Hedgehog.Expecto.

Both would rely on Hedgehog.Experimental.GenX.auto out of the box, with the option to override custom types.

@dharmaturtle dharmaturtle deleted the xunit_propertyattribute branch December 30, 2020 22:57
@TysonMN
Copy link
Member

TysonMN commented Jan 5, 2021

The code in this PR is available from nuget.org via the package Hedgehog.XUnit.

@moodmosaic
Copy link
Member

🚀

@moodmosaic
Copy link
Member

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

Successfully merging this pull request may close these issues.

4 participants