How to Choose a Haskell Single Test

Asked 2 years ago, Updated 2 years ago, 85 views

I wanted to write a single test on Haksell, so I was looking into it
·Hunit
·QuickCheck
·test-framework (including Hunit and QuickCheck?)
·Hspec
I found several and didn't know which one to use.
Are these used differently depending on the situation?
Or just remember this for now.
Is there such a thing?

Also, a site where you can learn to write tests
Or if you have a book, I would appreciate it if you could let me know

haskell

2022-09-30 15:03

2 Answers

私 I don't usually use Haskell myself.Just connecting to more detailed answers...

HUnit is based on JUnit and HSPec is based on RSPec, and similar frameworks exist in many languages, so I think it is helpful to use them differently.Wikipedia also has a list of xUnits and xSpec

The big difference is how to write test cases, and the xSpec-based BDD concept makes it easier for related frameworks to write test codes that represent behavior and specifications under test.

TDD/BDD super introduction (2): Organize the relationship between TDD/BDD ideas and testing frameworks (1/3) - @IT

These frameworks often provide test data for themselves.However, it is troublesome to prepare test data individually when there is a quality that should be met no matter what arguments you give.Therefore, QuickCheck will generate random values based on the type and run the test.

Make the test a little fun (QuickCheck) - yunomu blog

The test-framework does not have the same functionality as xUnit or xSpec alone, as it runs all the HUnit and QuickCheck tests together and generates reports.

So I wonder if this article will help you with what you're going to do with Haskell's single test.It was first released in 2012, but it still seems to be maintained.

Haskell's front-line standalone testing


2022-09-30 15:03

Most recent library codes use Tasty or Hspec.Tasty is the successor to the test-framework that is no longer maintained.

It may be a matter of taste. I like Hspec because it's easy to read.

Both Tasty and Hspec have sample codes, so I think it's better to try them.


2022-09-30 15:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.