2017 © Pedro Peláez
 

library quip-test

An Implementation of the multi-armed bandit test. (See: http://stevehanov.ca/blog/index.php?id=132)

image

alairock/quip-test

An Implementation of the multi-armed bandit test. (See: http://stevehanov.ca/blog/index.php?id=132)

  • Tuesday, March 8, 2016
  • by alairock
  • Repository
  • 1 Watchers
  • 3 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

QuipTest

The multi armed bandit as a PHP Component (See this article for background), (*1)

Better testing than A/B testing!, (*2)

Background

There is a fundemental flaw with standard A/B testing. The biggest thing is that tests are final. Compare A. Compare B. After 1000 tests A might be proven to be more successful with 300/500. B failed with 240/500., (*3)

You go with option A, and that is the end of the story., (*4)

Had you done 10,000 tests, the results might have been different. A fails 3,000/5,000 to B 3,500/5,000. And 6 months down the road, it might flop back to A., (*5)

QuipTest will let you plug in dynamic, evolving tests, to any part of your application., (*6)

Installation

Composer

$ composer require "alairock/quip-test":"dev-master"

Redis Server (Required)

  • Standalone Installation, (*7)

  • Redis Server with Docker:, (*8)

    docker run -d --name redis-server -p 6379:6379 redis, (*9)

Documentation

For a basic example of a working test, see the index., (*10)

Autoload

Be sure to include your composer autoload file, if you are not already, or your framework is not supporting it. Ideally you would put the autoload file in a place that cascades into all areas of your application that will require a component. (Composer), (*11)

Initation the test.

<?php
    $testName = "button"; 
    $tags = ['orange', 'green', 'white']; // test tags
    $buttonTest = new \Quip\Test($testName, $tags);

Get tag

This method has multiple functions. It increments the total number of tests run, as well as the total number of tests run for a specific tag. Use this method to flag your test, and track successes., (*12)

    $tagName = $buttonTest->getTag();

Flag test as successful

If a test is successful, make sure you mark it! QuipTests do not mark failures. Failures are assumed automatically when not marked successful., (*13)

    $buttonTest->markSuccess($tagName);

Get stats

    var_dump($buttonTest->getStats());

Example output:, (*14)

array (size=2)
'cases' => 
    array (size=3)
  'cat' => 
    array (size=2)
      'tests_run_for_case' => string '41' (length=2)
      'success_rate' => float 17.073170731707
  'bird' => 
    array (size=2)
      'tests_run_for_case' => string '28' (length=2)
      'success_rate' => float 10.714285714286
  'dog' => 
    array (size=2)
      'tests_run_for_case' => string '62' (length=2)
      'success_rate' => float 12.903225806452
'tests_performed' => string '131' (length=3)

Reset/Flush test

    $buttonTest->flushAll();

Warning!!!

Chrome has a funny little bug, where if you do not reference your favicon directly, it pulls the page twice, which will lead to a potential double incrementation (failure!) on your test! If you have issues, add the favicon to your header in the html:, (*15)

    <link rel="icon"
    type="image/png"
    href="http://example.com/myicon.png">

The Versions

08/03 2016

dev-master

9999999-dev

An Implementation of the multi-armed bandit test. (See: http://stevehanov.ca/blog/index.php?id=132)

  Sources   Download

MIT

The Requires

 

by Avatar alairock

08/03 2016

1.0.3

1.0.3.0

An Implementation of the multi-armed bandit test. (See: http://stevehanov.ca/blog/index.php?id=132)

  Sources   Download

MIT

The Requires

 

by Avatar alairock

08/03 2016

1.0.2

1.0.2.0

An Implementation of the multi-armed bandit test. (See: http://stevehanov.ca/blog/index.php?id=132)

  Sources   Download

MIT

The Requires

 

by Avatar alairock

07/03 2016

1.0.1

1.0.1.0

An Implementation of the multi-armed bandit test. (See: http://stevehanov.ca/blog/index.php?id=132)

  Sources   Download

MIT

The Requires

 

by Avatar alairock

21/08 2014

1.0.0

1.0.0.0

An Implementation of the multi-armed bandit test. (See: http://stevehanov.ca/blog/index.php?id=132)

  Sources   Download

MIT

by Avatar alairock