Testing logo

Testing

Organization
RevenueCat
testing

Use this skill when testing a RevenueCat Android integration. Covers the RevenueCat Test Store (test_ API key prefix, in dialog choice of Test valid purchase, Test failed purchase, or Cancel), mockk based unit testing with an interface wrapper around Purchases, and a GitHub Actions CI pattern. Avoids Google Play sandbox for day to day test iteration.

Overview

PublisherRevenueCat
Repositoryplay-billing-skills
Skill nametesting
Stars
58
Forks
0
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by RevenueCat on GitHub. Read the source before you install it.

Installation

Install the Testing AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/RevenueCat/play-billing-skills/tree/main/revenuecat/testing
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RevenueCat/play-billing-skills.git /tmp/play-billing-skills
mkdir -p .claude/skills
cp -r /tmp/play-billing-skills/revenuecat/testing .claude/skills/testing
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Testing in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Testing on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Testing is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Testing RevenueCat on Android

Use this skill to stand up a fast test loop for a RevenueCat Android integration. The Test Store replaces the Google Play sandbox for most work, a BillingService interface makes Purchases mockable, and a small GitHub Actions job runs unit tests on every push.

Full source: see the full chapter on revenuecat.com.


Phase 1: Discovery

Before changing anything, learn what already exists. Answer each question with a file or a "no".

CheckWhere to lookWhat you want
Test API key configured?app/build.gradle.kts, local.properties, envA test_... value bound to BuildConfig.RC_API_KEY in debug
Release key separate?build.gradle.kts release blockA goog_... key, never test_...
Purchases wrapped?app/src/main/java/**/*Billing*.ktAn interface that hides Purchases.sharedInstance
CI present?.github/workflows/*.ymlA job running ./gradlew testDebugUnitTest
Secret wired?GitHub repo settings, workflow env:RC_TEST_STORE_KEY referenced from secrets
Test library?app/build.gradle.kts dependenciesio.mockk:mockk and kotlinx-coroutines-test

If the project has none of these, start from scratch in Phase 3. If some exist, only fill the gaps.


Phase 2: Plan

Pick the test path per scenario. The Test Store is the default; fall back to Google Play sandbox only when you need store behavior the Test Store does not simulate.

ScenarioUse
Success, failure, cancel pathsTest Store
Unit tests of ViewModelsmockk against BillingService
CI on every pushTest Store + unit tests
Subscription renewal cycles (up to 5 accelerated renewals)Test Store
Grace period, account holdGoogle Play Sandbox
Pending purchase (parental approval)Google Play Sandbox
Full end-to-end paymentGoogle Play Sandbox

Write the plan as a short checklist in tasks/todo.md before coding. If the app ships subscriptions, keep one Sandbox pass in the pre-ship checklist even if the Test Store covers daily iteration.


Phase 3: Execute

Step 1: Generate the test API key

In the RevenueCat dashboard, open your app, go to Apps & providers, then Create Test Store. Copy the test_... key. Do not commit it. Put it in local.properties or a CI secret.

Step 2: Wire the key into debug builds

kotlin
// build.gradle.kts
android {
    buildFeatures {
        buildConfig = true
    }
    buildTypes {
        debug {
            buildConfigField("String", "RC_API_KEY", "\"test_YOUR_KEY\"")
        }
        release {
            buildConfigField("String", "RC_API_KEY", "\"${providers.gradleProperty("RC_API_KEY").get()}\"")
        }
    }
}

AGP 8.0+ does not generate BuildConfig by default; buildFeatures { buildConfig = true } is required or the fields above fail to build.

For CI, read the debug key from env so it never lands in git. Change only the debug field from Step 2. The release field reads the same RC_API_KEY Gradle property as configuring-the-sdk, so pass it in CI (-PRC_API_KEY=... or ORG_GRADLE_PROJECT_RC_API_KEY). Never put the test_ key in defaultConfig, or it ships in release builds too:

kotlin
// build.gradle.kts
val testKey = System.getenv("RC_TEST_STORE_KEY") ?: "test_placeholder"
android {
    buildFeatures {
        buildConfig = true
    }
    buildTypes {
        debug {
            buildConfigField("String", "RC_API_KEY", "\"$testKey\"")
        }
        release {
            buildConfigField("String", "RC_API_KEY", "\"${providers.gradleProperty("RC_API_KEY").get()}\"")
        }
    }
}

Step 3: Configure Purchases with the build config key

kotlin
class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        if (BuildConfig.DEBUG) Purchases.logLevel = LogLevel.DEBUG
        Purchases.configure(
            PurchasesConfiguration.Builder(this, BuildConfig.RC_API_KEY).build()
        )
    }
}

Step 4: Trigger the Test Store dialog

Run the app in debug and call awaitPurchase() from your paywall. A "Test Store Purchase" dialog appears with Test valid purchase, Test failed purchase, and Cancel. Each choice resolves the same way production would: Test valid purchase returns a PurchaseResult with active entitlements, Test failed purchase throws PurchasesTransactionException with error.code == PurchasesErrorCode.TestStoreSimulatedPurchaseError and userCancelled == false, and Cancel throws with userCancelled = true. Walk every branch of your error handling to verify UI states.

Step 5: Wrap Purchases in a BillingService

The Purchases singleton is not mockable. A thin interface lets you inject a fake in tests and keeps ViewModels free of SDK types.

kotlin
interface BillingService {
    suspend fun getOfferings(): Offerings
    suspend fun purchase(activity: Activity, pkg: Package): CustomerInfo
    suspend fun getCustomerInfo(): CustomerInfo
}
kotlin
class RevenueCatBillingService : BillingService {
    override suspend fun getOfferings() =
        Purchases.sharedInstance.awaitOfferings()

    override suspend fun purchase(activity: Activity, pkg: Package): CustomerInfo =
        Purchases.sharedInstance.awaitPurchase(
            PurchaseParams.Builder(activity, pkg).build()
        ).customerInfo

    override suspend fun getCustomerInfo() =
        Purchases.sharedInstance.awaitCustomerInfo()
}

Step 6: Write mockk unit tests

kotlin
class PaywallViewModelTest {
    private val billing = mockk<BillingService>()
    private val viewModel = PaywallViewModel(billing)

    @Test
    fun `purchase success grants access`() = runTest {
        val info = mockk<CustomerInfo> {
            every { entitlements["pro_access"]?.isActive } returns true
        }
        coEvery { billing.purchase(any(), any()) } returns info
        viewModel.purchase(mockActivity, mockPackage)
        assertTrue(viewModel.state.value is PaywallState.Success)
    }
}

Add one test per branch: success grants access, failure shows error, cancel stays idle.

Step 7: Add a minimal GitHub Actions job

yaml
# .github/workflows/test.yml
name: test
on: [push, pull_request]
jobs:
  unit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: 17
      - name: Run tests
        env:
          RC_TEST_STORE_KEY: ${{ secrets.RC_TEST_STORE_KEY }}
        run: ./gradlew testDebugUnitTest

Store the test_... key as the RC_TEST_STORE_KEY repository secret. The job runs without a device or a Google account.


Verification

After each purchase, open the RevenueCat dashboard, go to Customers, pick the user, and confirm the purchase, the entitlement, and the CustomerInfo JSON. The Events tab shows webhooks fired for the test purchase.

Pre-Ship Checklist

  • Purchases.logLevel = LogLevel.DEBUG gated on BuildConfig.DEBUG
  • Release build uses the goog_ key, not the test_ key
  • test_ key is not committed (env var or local.properties)
  • Success, failure, and cancel paths exercised through the Test Store dialog
  • At least one end-to-end flow verified in Google Play Sandbox
  • Webhook endpoint receives events for sandbox purchases

References

Frequently asked questions

What does the Testing AI skill do?

Use this skill when testing a RevenueCat Android integration. Covers the RevenueCat Test Store (test_ API key prefix, in dialog choice of Test valid purchase, Test failed purchase, or Cancel), mockk based unit testing with an interface wrapper around Purchases, and a GitHub Actions CI pattern. Avoids Google Play sandbox for day to day test iteration.

Why use Testing on TypingMind?

Because you install it once and use it with any model. Testing is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Testing in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/RevenueCat/play-billing-skills/tree/main/revenuecat/testing. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Testing?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Testing?

As many as you like. As long as a model supports skills, you can use Testing with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Testing AI skill free?

Yes. It is published on GitHub by RevenueCat under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇