Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

casperjs and a/b testing

i have a signup.js test that automates signing up for my web app (obviously). we're currently a/b testing a new flow that takes you to a different page ('.com/signupa' vs '.com/signupb') and i'm wondering what the best way to reflect this in my test.

options:

  • use evaluateOrDie and make it die at .com/signupb (this seems dumb)
  • flesh out test for .com/signupb and make it go that route if it hits that test (is this possible?) something like..

    casper.waitForResource("classic.png",
       function success() {
          this.echo('on the old signup flow ');
          <continue with regular signup test>
      },  
      function fail() {
          this.test.assertExists("classic.png");
          <do something else>
      });
    

any other ideas greatly appreciated!

like image 348
tronjavolta Avatar asked Nov 20 '25 14:11

tronjavolta


1 Answers

My preference would be to hide some information in each of your pages, so you can cleanly switch on them. E.g.

<span id="version1"></span>

vs.

<span id="version2"></span>

Then, after submitting the form:

casper.then(function(){
  if (this.exists('#version2')) {
    testNewSite(this);
    } else {
    testOldSite(this);
    }
  });

But detecting on something you already know is only in one of the pages, like the "classic.png" you show in your question, is also fine. (It just feels a little more brittle: the web development team can break your tests by renaming that image, or putting an image with that name in the new version, etc., etc.)

like image 74
Darren Cook Avatar answered Nov 22 '25 14:11

Darren Cook