Hacker News new | ask | show | jobs
by SEJeff 4509 days ago
There are two types of tests.

unit tests - most common and are tightly tied to the code. integration tests - simulate example user behavior and test the pieces work together as expected. For this type of app, selenium is the best tool for the job and splinter is an amazing python abstraction ontop of selenium. For instance, I have Jenkins setup splinter to run chrome and Firefox tests headlessly using a frame buffer (xvfb) to test the apps I'm responsible for as part of $dayjob.

Both types of tests are necessary and equally important.

http://splinter.cobrateam.info

1 comments

I applaud your view. Here in the PHP universe we're only starting to exit the "Everything must be unit tested" phase of programmer evolution, and integration/functional testing is still a novelty.

I've not come across Splinter before, that looks interesting. I've been using PhantomJS via CasperJS but my tests so far have been brittle...

Well we used to be in the same boat and then... A new developer wrote a few new bit pieces of code that were supposed to work together. He overly unit tested each piece discretely, but they didn't work together. So when we pushed it out to staging and I manually tried to look at things, the entire design was wrong and would never work.

From then on, the next task said individual worked on was setting up selenium and write integration tests. Now we are in a pretty sweet place.

We have unit tests, which verify each discrete thing works as it is expected to and make refactoring large swaths of code a breeze. Then we have integration tests, which run on IE (in a windows vm that is on our build server), firefox, and chrome via xvfb. It even helps us catch those obnoxious conditions where javascript runs fine in "real browsers" and fails on IE's lameness. Give it a try :)