SimpleAB


Source link: https://github.com/julioz/simpleab

SimpleAB - A simple framework for A/B tests

SimpleAB is a framework to help you A/B test your Android applications with no hassle. A/B testing should be as simple as it needs to, and if you're not interested in handling huge SDKs and understanding complex dashboards and documentation articles, SimpleAB is the tool you was looking for.

SimpleAB will make A/B tests as easy to run as to write a one-liner like:

SimpleAB.with(context).perform(abTest).now();

Usage

Defining Tests

A test is defined through an ID by a class extending AbstractABTest:

AbstractABTest firstTest = new MyFirstABTest(new ABTestVariant() {

@Override
public void perform() {

  // do something

}

@Override
public String getId() {

  return "A";

}
 
}
, new ABTestVariant() {

@Override
public void perform() {

  // do something else

}

@Override
public String getId() {

  return "B";

}
 
}
);

Note that you can define as many variants as you want, as long as you define different IDs for them. The IDs, by themselves can be any String you want, as long as they are not equals().

Drawers

A Drawer is responsible for selecting which ABTestVariant will be executed. The library has a default Drawer built-in, that leverages the usual java Random implementation for pseudo-randomic choosing.

If you want, you can also define your own class that implements ABTestDrawer. You can then define any strategy to select test variants, for example by defining weights for each variant (this example is implemented in the sample project of the library), or by taking in account the IDs of the variants.

Listener for callback

It's also optional to define an ABTestListener so you can have a callback after a variant is drawn. To do that, simply define a class that implements the interface and override its methods. The callback method will be executed after the A/B test runs. This way, you can perform any subsequent task to the test, like POST-ing the result to a server, for example.

The API will then be something like:

SimpleAB.with(context).perform(abTest).withDrawer(variantDrawer).listener(listener).now();

Persistence of chosen variants

By default, the library persists the chosen variants in SharedPreferences. This way, once your app runs for the first time and the variants are chosen by the Drawer, the app state regarding your A/B tests will stay the same for the subsequent runs (unless the user clears app data).

Debugging

If you are debugging your application and want to avoid the need to clear the app data to re-draw your A/B tests variants, you can simply call

SimpleAB.with(this).alwaysDrawVariants();

before performing your A/B tests. This will bypass the persisting step of the library, and by that, the system will always draw() variants based on your Drawer.


Download

Right now the library is not yet available through gradle, but this is in the roadmap. For now, just checkout the directory folder and add it as a module to your project, or download the aar from the repository adding it to the libs directory in your project.

Then, add this to your build.gradle dependencies:

compile 'br.com.zynger.simpleab:simpleab:1.0@aar'

And this to your repositories node in the top-level build.gradle:

flatDir {

dirs 'libs' 
}

License

Copyright 2015 Julio Zynger, Inc.  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

jadx - Dex to Java decompiler.

Command line and GUI tools for produce Java source code from Android Dex and Apk files.

LinearLayout with "pull-to-refresh" feature.

FragmentSwapper is an Open Source Android library that allows easy fragment's management. It is somewhat similar to Activities management model. For instance, new fragment can be launched from another one with action's request (using request code) and then recieve the result.

A couple of sticky header decorations for android's RecyclerView.

A 'Google Fit' like activity indicator for Android.

The Cult will provide a new layout for your Toolbar. This allow you to use with a custom SearchView with animation and more.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes