Git Product home page Git Product logo

abtestgen's Introduction

An A/B Testing Library for Android...

...that makes writing simple tests simpler by using annotations.

Android Arsenal

How it works

Currently you can use two different annotations: @TextTest and @ResourceTest. @TextTest is for plugging Strings into a generated test; @ResourceTest is for plugging resource IDs. Example usage may be as follows:

@TextTest(testName="firstTest", method="setText", values={"hello", "howdy"})
TextView helloTextView;

which will automatically generate a class which you can run by calling ABTester.with(activity).run("firstTest");. Or, if you're running the test from outside of an Activity, ABTester.with() can also take a second Object parameter where you've put in the annotations.

You can also cover multiple fields in the same test, as follows:

@TextTest(testName="firstTest", method="setText", values={"hello", "howdy"})
TextView helloTextView;

@ResourceTest(testName="firstTest", method="setText", values={R.string.yo, R.string.sup})
TextView otherTextView;

@TextTest(testName="firstTest", method="setText", values={"world", "globe"})
TextView thirdTextView;

And that will generate a class which will create two tests that will cover those three TextViews.

There's also a CustomTest class which allows you to define more complex tests that may not be possible to generate with the annotation processor.

By default, tests will be weighted to have an equal chance to be selected. However, by extending the TestPicker class you can weight the tests however you like.

To obtain...

You'll want to include

maven { url "https://jitpack.io" }

in either your allprojects.repositories or your module's repositories section. Whatever you like!

You will also need the APT plugin, so you will want to put this into your root build.gradle's buildscript.dependencies:

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

and apply this plugin to the modules you're doing your tests in:

apply plugin: 'com.neenbedankt.android-apt'

Then, you'll want to bang these bad boys into your build.gradles' dependencies:

apt 'com.github.imperial-crystalline-recursion.abtestgen:ab-compiler:0.4.1'
compile 'com.github.imperial-crystalline-recursion.abtestgen:ab-annotations:0.4.1'
compile 'com.github.imperial-crystalline-recursion.abtestgen:ab-lib:0.4.1'

abtestgen's People

Contributors

imperial-crystalline-recursion avatar mcpotter avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.