Abtestgen
An Android library for generating simple A/B tests
Install / Use
/learn @MattAFRL/AbtestgenREADME
An A/B Testing Library for Android...
...that makes writing simple tests simpler by using annotations.
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'
Related Skills
gh-issues
335.2kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
335.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Writing Hookify Rules
82.5kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
