Open akurilin opened 9 years ago
My idea is that Arion should have a mode for yesod integration tests where it does not look at the imports in a spec to map it to a source file. What do you think? I say this because in cases other than yesod integration tests Arion can look at imports in a spec to map it to a source file.
I'm not sure how you'd go about implementing that at this point. If you have an idea I'd be happy to see how well it'd work.
It's just the way it creates the associations that needs to be changed. So for instance if I pass in a flag like "-yesod-integration" it will use a different algorithm to create the associations.
Keep in mind that when testing yesod we will practically always have both integration tests and more traditional import-based tests for functional/unit-level testing, so you'll want to be able to watch both types of tests at once.
Do the integration tests have a special keyword in them like FooIntegrationSpec?
Here's one more option:
Passing in the flag -yesod-integration creates associations based on the imports and also associates Foo with FooSpec. Does that work? That way it will watch both kinds of tests. On Mar 30, 2015 2:59 PM, "Alexandr Kurilin" notifications@github.com wrote:
Keep in mind that when testing yesod we will practically always have both integration tests and more traditional import-based tests for functional/unit-level testing, so you'll want to be able to watch both types of tests at once.
— Reply to this email directly or view it on GitHub https://github.com/karun012/arion/issues/13#issuecomment-87846370.
Most integration-level tests in Yesod do not explicitly import the Handler module that's being tested. Tests are executed by generating HTTP requests and submitting them against the router. The router itself figures out what Handler to use. As per reddit thread, arion would have to stop requiring that spec modules require a source module in order to map a source file to a test file. In the past I've seen people use a convention approach where ource files will, for example, be called
Foo.hs
and the test file is calledFooSpec.hs
under the same identical folder structure.See the official Yesod scaffold example for reference: https://github.com/yesodweb/yesod-scaffold/tree/postgres/test