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

Make logs available for Success #136

Open
steinybot opened this issue Dec 17, 2019 · 2 comments
Open

Make logs available for Success #136

steinybot opened this issue Dec 17, 2019 · 2 comments

Comments

@steinybot
Copy link
Contributor

I'm not sure exactly how this would work but it would be nice if the logs were available for a Success result and not just for a Failure.

The first case where I wanted them was when trying to integrate with ScalaMock. ScalaMock has a pretty awkward trait that has to be used to verify expectations. The only way to use this is to run the Hedgehog test to get the Report and then ScalaMock verifies the expectations. If an expectation fails we fail the test but there is no way to show what the generated values were as the report does not contain them.

The second time I wanted them was when trying to write a helper method that would negate an arbitrary Result. While that on its own is possible it won't be very good because the values are unknown. Even if they were it would be hard to write a very good log message but it would be possible to do something at least.

@charleso
Copy link
Collaborator

I'm not sure exactly how this would work but it would be nice if the logs were available for a Success result and not just for a Failure.

Yeah I've been on the fence on this for a while, and I'm not surprised someone is asking for it (your example makes sense). Technically it's easy to do, and I'm happy to make the change, unless you get to it first. It's actually what the haskell version does, I don't really know why I did something different.

Just curious, are you also talking about outputting the (successful) logs on a failed test, or just tracking them for integrations/functions?

Result.all(List(
  (1 === 1).log("would we see this?")
, (1 === 2)
))

@steinybot
Copy link
Contributor Author

Just curious, are you also talking about outputting the (successful) logs on a failed test, or just tracking them for integrations/functions?

That's a good question.

I think for backwards compatibility it would have to be just for tracking but I can see it being useful to have the option of outputting the successful logs too. Maybe something like:

Result.all(List(
  (1 === 1).log("we won't see this")
  (1 === 1).debug("but we will see this")
, (1 === 2)
))

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

No branches or pull requests

2 participants