Skip to content

maruf1020/ABTestLab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

192 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§ͺ ABTestLab

A powerful CLI-based tool for local development of A/B tests with live browser previews. Write test code in your preferred editor, preview changes instantly via a browser extension, and manage tests compatible with platforms like AB Tasty, Dynamic Yield, VWO, Kameleoon, Optimizely, Convert, and more with a beautiful UI which will indicate the test status.

UI UI Image

Terminal Terminal Image

πŸ“¦ Installation

Make sure you have Node.js installed:

Recommended Versions:

  • Node.js: v18 - v22 (minimum: v14)
  • npm: v9 - v10 (minimum: v6)

Install & Initialize:

# Install dependencies
npm i

# Initialize project 
npm run cli init

CLI Commands:

npm run cli          # Main CLI interface with all features but you can choose shortcut in below:
npm run cli create   # Create website, test, or variation
npm run cli start    # Start a test
npm run cli settings # Configure settings

Browser Integration (For connecting to the browser)

# Inject the preview snippet into your browser using a browser extension that supports custom java script.

πŸ”— Recommended Chrome Extension: User JavaScript and CSS

Extension setup:

# 1. Open the extension and create a **New Rule**.

# 2. Set a rule name (set any name. e.g., `CLI snippet`).

*://*/*  #3. Use this on the URL pattern

# 4. Paste the following code (iin the bottom) into the `JS section`:
(function () {
	'use strict';
	const portNumber = 3007;
	function observeElement(selector, callback, { minElements = 1, isVariable = false, timeout = 10000, interval = 5 } = {}, start = performance.now()) { (function check() { const elements = isVariable ? window[selector] : document.querySelectorAll(selector); if ((isVariable && elements !== undefined) || (!isVariable && elements.length >= minElements)) return callback(elements); if (performance.now() - start < timeout) setTimeout(check, interval); })(); }

	const MAIN_URL = `http://localhost:${portNumber}/ab-pilot-script.js`;
	observeElement('html', ([html]) => {
		const mainScript = document.createElement('script');
		mainScript.setAttribute('src', MAIN_URL);
		html.appendChild(mainScript);
		setTimeout(()=>{
			const LIVE_UPDATE_URL = `http://localhost:${portNumber}/ab-test-script.js`;
			const updateScript = document.createElement('script');
			updateScript.setAttribute('src', LIVE_UPDATE_URL);
			observeElement('html', ([html]) => html.appendChild(updateScript));
		}, 500);
	});
})();
# 5. In the bottom right corner of the JS editor section, enable **Run at the start** to inject the code faster. This ensures the script loads immediately before the page finishes loading, similar to how professional tools behave.

πŸš€ Features

  • ✍️ Edit & Test Locally – Write A/B test code and instantly preview results.
  • πŸ§ͺ Multiple Test Types – A/B, AA, Multi-touch, Patch, and more.
  • 🧲 Cross-Platform Compatible – Works with AB Tasty, VWO, Dynamic Yield, Chameleon, VLo, etc.
  • 🌐 Full Project Management – Manage websites, tests, and variations from CLI.
  • 🧠 Beautiful Terminal UI – Interactive and emoji-enhanced.
  • πŸ“¦ Build Tests Locally – Prepare files before uploading to testing tools.
  • 🎯 Flexible Execution – Run single or multiple tests simultaneously.
  • πŸ”„ Variation Swapping – Switch between variations effortlessly.

🧠 Workflow Overview

  1. Initialize the Project (One-time).
  2. Create Websites, Tests & Variations via the CLI.
  3. Write Code in your code editor (HTML/CSS/JS).
  4. Inject Snippet in your browser using an extension.
  5. Preview Tests live with instant updates.
  6. Build Locally before uploading to a testing platform.

πŸ› οΈ CLI Commands

Run the CLI:

npm run cli

Main Menu

? Select a command to run
> πŸš€ Start the Server
  πŸ“¦ Build Test
  βž• Create a New Item
  βš™οΈ Update Settings
  ❌ Exit

πŸš€ Start the Server

? What would you like to do?
> πŸ•’ Latest Test
  πŸ“š View Test History
  🎯 Run a Single Test
  πŸš€ Run Group Tests
  πŸ”™ Back
  ❌ Exit

πŸ•’ Latest Test Options

  • πŸš€ Run Latest Test
  • πŸ”„ Change Variation
  • πŸ”„ Change Test

βž• Create a New Item

? Select an option:
> πŸ†• Create New Website
  🌐 ---- website 1 ---
  🌐 ---- website 2 ---
  ...

🌐 Website Options

  • πŸ†• Create New Test
  • πŸ†Ž Test 1 – A/B Test
  • πŸ“Š Test 2 – AA Test
  • 🎯 Test 3 – Multi-touch Test
  • 🩹 Test 4 – Patch Test

πŸ†Ž Test Options

? Select an option:
> πŸ†• Create New Variation
  🎭 ---- variation 1 ---
  🎭 ---- variation 2 ---
  ...

🎭 Variation Options

  • πŸš€ Start Variation
  • πŸ“œ See Test Details
  • πŸ“¦ Build Variation
  • πŸ“€ Copy Variation to Another Test
  • ✏️ Rename Variation
  • πŸ—‘οΈ Remove Variation

πŸ“š History and Settings

πŸ“š History Records Count: 10
🎨 CSS Reload: No
πŸ–ΌοΈ Display UI: Yes
πŸ“œ JS Reload: No
πŸ“¦ Bundler Settings
πŸ’Ύ Save and Exit
❌ Exit

πŸ§ͺ Test Types

Type Description Icon
A/B Test Compare two or more variants πŸ†Ž
AA Test Identical variant comparisons πŸ“Š
Multi-touch Test Compare multiple changes at once 🎯
Patch Test Small change deployment 🩹

πŸ“‚ Full Project folder and file Structure

project structure : 
ABTestLab
β”œβ”€β”€ .vscode/                         # VS Code configuration files
β”œβ”€β”€ core/                            # Core functionalities
β”‚   β”œβ”€β”€ client/                      # Client-side scripts
β”‚   β”‚   β”œβ”€β”€ browser-Runner.js
β”‚   β”‚   └── browser-script.js
β”‚   β”œβ”€β”€ commands/                    # CLI commands
β”‚   β”‚   β”œβ”€β”€ create.js
β”‚   β”‚   β”œβ”€β”€ init.js
β”‚   β”‚   β”œβ”€β”€ settings.js
β”‚   β”‚   └── start.js
β”‚   β”œβ”€β”€ global/                       # Global configurations
β”‚   β”‚   └── config.js
β”‚   β”œβ”€β”€ public/                       # Static assets for frontend
β”‚   β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”‚   └── index.css
β”‚   β”‚   β”œβ”€β”€ documents/                # documentation
β”‚   β”‚   β”‚   β”œβ”€β”€ complete_todo.md
β”‚   β”‚   β”‚   └── todo.md
β”‚   β”‚   β”œβ”€β”€ html/
β”‚   β”‚   β”‚   └── index.html
β”‚   β”‚   β”œβ”€β”€ icons/
β”‚   β”‚   β”‚   └── close.svg
β”‚   β”‚   β”œβ”€β”€ js/                        # JavaScript assets
β”‚   β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”‚   └── index.js
β”‚   β”‚   β”‚   └── vendor/                 # Third-party scripts
β”‚   β”œβ”€β”€ scripts/                        # Utility scripts
β”‚   β”‚   β”œβ”€β”€ createSettingFile.js
β”‚   β”‚   β”œβ”€β”€ createSkeleton.js
β”‚   β”‚   └── downloadSocketIo.js
β”‚   β”œβ”€β”€ server/                         # Server-side scripts
β”‚   β”‚   β”œβ”€β”€ browserScriptCreator.js
β”‚   β”‚   └── testServer.js
β”œβ”€β”€ templates/                         # Initial Templates for A/B tests
β”‚   β”œβ”€β”€ targeting/                     # Targeting rules
β”‚   β”‚   β”œβ”€β”€ customJS.js
β”‚   β”‚   β”œβ”€β”€ elementChecker.json
β”‚   β”‚   └── urlChecker.json
β”‚   β”œβ”€β”€ targetMet/                     # When and how target conditions are met
β”‚   β”‚   β”œβ”€β”€ customJS.js
β”‚   β”‚   β”œβ”€β”€ elementChecker.js
β”‚   β”‚   └── urlChecker.js
β”‚   β”œβ”€β”€ variation/                      # Variation-related files
β”‚   β”‚   β”œβ”€β”€ index.js
β”‚   β”‚   β”œβ”€β”€ info.json
β”‚   β”‚   └── style.scss
β”‚   β”œβ”€β”€ utils/                          # Utility functions
β”‚   β”‚   β”œβ”€β”€ bundler.js
β”‚   β”‚   β”œβ”€β”€ creatorPrompts.js
β”‚   β”‚   β”œβ”€β”€ creators.js
β”‚   β”‚   β”œβ”€β”€ cssUtils.js
β”‚   β”‚   β”œβ”€β”€ fileUtils.js
β”‚   β”‚   β”œβ”€β”€ historyUtils.js
β”‚   β”‚   β”œβ”€β”€ selectors.js
β”‚   β”‚   └── startUtils.js
β”‚   └── index.js
β”œβ”€β”€ skeleton/                          # Skeleton structures
β”œβ”€β”€ websites/                          # Websites-related configurations
β”œβ”€β”€ package.json
β”œβ”€β”€ node_modules/                      # Dependencies
β”œβ”€β”€ settings.json
β”œβ”€β”€ history.json                        # Execution history
β”œβ”€β”€ .gitignore                          # Git ignored files
└── README.md                           # Project documentation

πŸ’‘ Example Use Cases

  • Create local tests before uploading to AB testing platforms.
  • Perform rapid QA with live browser previews.
  • Manage large sets of websites and tests from one place.
  • Simplify teamwork with reusable variation templates.

πŸ› οΈ One-Time Setup

Initialize your project (only once or after npm install):

πŸ› οΈ npm run cli init

πŸ“€ Build for tool (if needed)

Build your test locally:

πŸ“¦ npm run cli build #build a test

You can then upload your built files to your desired A/B testing platform.


πŸ”’ Requirements

  • Node.js v14+
  • Browser extension installed for snippet injection

πŸ™Œ Contributing

marufbillah03033@gmail.com


πŸ“„ License

MIT-Restricted License

Copyright (c) 2025 maruf1020

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, and sublicense the Software,
subject to the following conditions:

  1. Commercial Use Restriction

    • Any person, company, or organization intending to use this software for commercial purposes, profit, or financial gain must obtain prior written permission from the copyright holder (maruf1020).
    • Commercial use means using the software to make money. This includes things like selling it, renting it out, offering it as a paid service, or using it in any product or service that makes money.
  2. Grant of Use to Echologyx Ltd

    • As the copyright holder is an employee of Echologyx Ltd, the company Echologyx Ltd is granted a non-exclusive, royalty-free license to use, modify, and distribute this software
  3. Inclusion of Copyright Notice

    • The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  4. Warranty Disclaimer

    • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For commercial licensing inquiries, please contact: marufbillah03033@gmail.com.


πŸ“ž Support

For help, bugs, or feature requests, reach out via GitHub Issues or email: marufbillah03033@gmail.com

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors