Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.
/ showpony Public archive

A lightweight variant testing library for ASP.NET MVC 5+

License

Notifications You must be signed in to change notification settings

carsales/showpony

Repository files navigation

Showpony

A lightweight variant testing library - brought to you by Carsales.com Ltd

Showpony!!!

License

Apache License, Version 2.0

Build Status (courtesy of AppVeyor)

Build status

Installation

PM> Install-Package Showpony

Requirements

ASP.NET MVC 5+

Usage

Running an experiment through an MVC controller action

@Html.RenderExperiment("TheMatrix", new List<ActionVariant> {
	new ActionVariant("TheBluePill", 50, "Blue", "Pills"),
	new ActionVariant("TheRedPill", 50, "Red", "Pills")
});

Running an experiment the hard way

var variant = ShowponyContext.RunExperiment(
	"TheMatrix", new List<Variant>{ 
		new Variant("TheBluePill", 50),
		new Variant("TheRedPill", 50)
	});
	
switch (variant) {
	case "TheBluePill":
		StayInTheBlissfulIgnoranceOfIllusion();
		break;
	case "TheRedPill":
		EmbraceTheSometimesPainfulTruthOfReality();
		break;
}

Ending an experiment

ShowponyContext.EndExperiment("TheMatrix");

Recording experiment results

ShowponyContext.ExperimentStarted += (sender, args) => SaveData("Started", args);
ShowponyContext.ExperimentEnded += (sender, args) => SaveData("Ended", args);

How it works

TL;DR

It uses cookies!

The long version

When Showpony is asked to execute an experiment it looks at the cookies on the incoming request to see if the user has already been assigned a variant. If yes then it returns that variant. If no then it chooses a variant at random, sets it in the response cookies, fires off the "ExperimentStarted" event and returns that variant.

When Showpony is asked to end an experiment it again looks at the cookies on the incoming request to see if the user is participating in the experiment. If yes then it fires off the "ExperimentEnded" event and removes the cookie from the user's browser.

About

A lightweight variant testing library for ASP.NET MVC 5+

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages