Cavy

Cavy

  • Documentation
  • API
  • GitHub
  • FAQ

›API reference

Getting Started

  • Installing
  • Setting up the Cavy Tester
  • Writing tests

    • Hooking up components
    • Writing test cases
  • Running tests

Guides

  • Specifing a custom app entry point
  • Writing your own spec helpers
  • Writing your own custom reporter
  • Cavy Native Reporter

    • Using Cavy Native Reporter
    • iOS XCTest example (Obj-C)
    • iOS XCTest example (Swift)
    • Android example (JUnit)

API reference

  • CLI Commands
  • Helpers
  • Tester Component
  • Test Hooks
  • Cavy Native Reporter

Tester Component

Wraps your entire app to run tests against that app, interacting with registered components in your test cases via the Cavy helpers.

import { Tester } from 'cavy';

Props

NameTypeDescriptionDefault
specs (required)ArrayYour spec functions-
store (required)TestHookStoreA store of references to UI components in your app-
reporterFunctionCalled once all tests have finished. Takes the test report as an argument. If undefined, Cavy will send a test report to cavy-cli if it is running.undefined
waitTimeIntegerTime in milliseconds that your tests should wait to find a component2000
startDelayIntegerTime in milliseconds before test execution begins0
clearAsyncStorageBooleanIf true, clears AsyncStorage between each test e.g. to remove a logged in userfalse

Example

// index.test.js
import { Tester, TestHookStore } from 'cavy';

import MyFeatureSpec from './specs/MyFeatureSpec';
import OtherFeatureSpec from './specs/OtherFeatureSpec';
import App from './App';

const testHookStore = new TestHookStore();

export default class AppWrapper extends React.Component {
  render() {
    return (
      <Tester specs={[MyFeatureSpec, OtherFeatureSpec]} store={testHookStore}>
        <App />
      </Tester>
    );
  }
}
← HelpersTest Hooks →
  • Props
  • Example
Cavy
Docs
Getting StartedGuidesAPI Reference
Community
HelpContributorsFurther reading
More
GitHub
Star
Follow @pixielabs
Tweet
Copyright © 2019 Pixie Labs