The meeting place for professional Haskell programmers
You are not logged in. In order to participate in Special Interest Groups, you should log in now .

Web testing framework (Feature)

Created by Michael Snoyman on November 11, 2010 06:49:02 PM.
Status: Resolved


By Michael Snoyman @ November 11, 2010 06:50:27 PM

I'm about to start working on adding a major test suite to Yesod, and I would like to start by improving the state of web testing tools in Haskell. Questions are:

  • What tools are currently available?
  • What approaches do people currently use for testing web libraries/applications?
  • What would our ideal testing tools look like?

By Greg Weber @ November 11, 2010 07:35:38 PM
What I would like to focus on is the aspect of a user testing their application. I am beginning to think that for integration testing (testing at the level of interacting with web pages or an API) I would be much better off just using the very capable ruby toolset than re-inventing it all.

In my Ruby on Rails projects I like to do a lot of model level testing- testing the business logic. This I need to do in Haskell. For integration testing I use capybara- it can quickly test html responses with high level assertions, but also has an envjs driver that allows javascript to be executed- this is all headless unless you venture into using the selenium driver.

Maybe using hubris, the Ruby bridge, this will be easier- it might also allow for a gradual phase-out of some of the Ruby components.

So I will plan on trying our Ruby testing tools for integration testing and otherwise focus on Haskell tools for lower level testing
By Michael Snoyman @ November 12, 2010 01:34:45 PM

I've definitely been considering the other languages approach. The advantage is obvious: a mature, well thought out testing framework is immediately available. I see three downsides:

  • It will introduce a whole new set of dependencies for testers to install. On Linux, this may be very easy (apt-get install ruby), but is probably more onerous on Windows. This could easily lead to a situation where Yesod does not get well-tested on Windows.
  • The choice of language will necessarily preclude some people. You mention Ruby, but I've personally never written more than Hello World in it. I'm sure Perl and Python would both have detractors as well.
  • Sharing data between the Haskell web code and the (Ruby/Python/Perl) test code might be tricky. Using hubris would help address that.

I'm not ruling out usage of tests in other languages in Yesod, I just think that it's not a good long-term solution.

By Greg Weber @ November 12, 2010 02:57:43 PM
I certainly agree with you- it is a way to start testing for those who want to now without doing a lot of yak shaving, but in the long-term pure Haskell is preferred.

1 other thing to learn from Ruby. The whole community uses Rack for interfacing their web applications, and there is a Rack::Test utility that all the web application testing sits on. If everybody settled on WAI then a WAI test utility would be the place to start.
By Mark Wotton @ November 15, 2010 02:36:21 AM
parenthetically, this is exactly what I wrote Hubris for. please ping me if you try it and have problems - it's still dicey on Mac, but Linux should be ok.
By Anton Cheshkov @ January 27, 2011 06:49:33 PM

By Anton Cheshkov @ January 27, 2011 06:51:57 PM

By Michael Snoyman @ February 6, 2011 09:14:00 AM
I've released wai-test, though it's still missing a lot of features. I recommend people start using it and emailing the web-devel list about missing features. I'm marking this topic as resolved.

Login with