Acceptance Testing Data Collection: Asserting On Outbound Resource Requests Using CasperJS and PhantomJS
At Intent Media, we run ad networks, which means that on the data science team, we don't just science data, we also collect it.
One way in which we accomplish this collection is through the use of beacons on our partners' sites. And because we are nearly as excited about software testing as we are about statistical modeling and Hadoop-ing, we also want to do proper acceptance testing of our beacons.
Acceptance testing for us means that we need a way to assert that a browser, upon executing our javascript, will make a request to our beacon url. It turns out that our pal PhantomJS has a handy method for handling this kind of thing, and our favorite PhantomJS wrapper CasperJS emits [an event