You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One big Spec.hs file that contains half of every test
Flat collection of modules TestFoo.hs that contain the other half of the tests, but sorted by topic
For example we have in Spec.hs:
describe "Population"do
context "controlling population"do
it "preserves the population when not explicitly altered"do
popSize <-TestPopulation.popSize
popSize `shouldBe`5
To understand whether the test is correct, and also to write a new test, I need to deal with both files and keep them in sync. Also, Spec.hs will grow longer and longer to the point where one has to jump around a lot in the file to search for (halves of) tests.
Proposal
How about refactoring like this:
Move TestFoo.hs -> Test/Foo.hs
Test/Foo.hs tests exactly functions from src/Control/Monad/Bayes/Foo.hs
All tests regarding one module are collected in one describe "Foo" block
There is a root file Test.hs importing and collecting all those individual tests in one hspec block
The text was updated successfully, but these errors were encountered:
Right now the structure of tests is:
Spec.hs
file that contains half of every testTestFoo.hs
that contain the other half of the tests, but sorted by topicFor example we have in
Spec.hs
:And in
TestPopulation.hs
:To understand whether the test is correct, and also to write a new test, I need to deal with both files and keep them in sync. Also,
Spec.hs
will grow longer and longer to the point where one has to jump around a lot in the file to search for (halves of) tests.Proposal
How about refactoring like this:
TestFoo.hs -> Test/Foo.hs
Test/Foo.hs
tests exactly functions fromsrc/Control/Monad/Bayes/Foo.hs
describe "Foo"
blockTest.hs
importing and collecting all those individual tests in onehspec
blockThe text was updated successfully, but these errors were encountered: