Cavy

Cavy

  • Documentation
  • API
  • GitHub
  • Roadmap
  • FAQ

›API reference

Getting Started

  • Installing
  • Setting up the Cavy Tester
  • Writing tests

    • Hooking up components
    • Writing test cases
  • Running tests
  • Sample app

API reference

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

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)

Cavy Native Reporter

A reporter that sends test results to native Android or iOS test runners.

  • See installation & usage instructions
  • View GitHub repo

Reference

CavyNativeReporter

The Cavy Native Reporter module.

import CavyNativeReporter from 'cavy-native-reporter';

CavyNativeReporter.reporter

Takes the test report and fires a Native Module callback when tests are finished. You can define the callback function in your native tester code.

Pass this in to the Tester component as its reporter props to override the default Cavy reporter.

iOS - Objective-C

onFinishWithBlock (class method)

Calls the block with the report if report is available (i.e. if Cavy tests have finished). If not, sets the callback as a class variable so we can access it later.

The report argument passed to the block is an NSDictionary with the following structure:

{
  duration = "0.2";
  errorCount = 0;
  results = (
    {
      message = "Test suite description: test number 1";
      passed = 1;
    },
    {
      message = "Test suite description: test number 2";
      passed = 0;
    }
  );
}

If you need to, you can iterate over the test results and log more detailed messages.

iOS - Swift

onFinish (class method)

Calls the block with the report if report is available (i.e. if Cavy tests have finished). If not, sets the callback as a class variable so we can access it later.

  • block - a callback function.

Android

waitForReport(seconds)

Wait for a test report to be available from Cavy using a CountDownLatch.

  • seconds - (integer) The number of seconds the latch should wait for the report from Cavy before timing out.

cavyReport

Static member variable used to access the test report from Cavy.

← Filtering testsSpecifing a custom app entry point →
  • Reference
    • CavyNativeReporter
    • CavyNativeReporter.reporter
  • iOS - Objective-C
    • onFinishWithBlock (class method)
  • iOS - Swift
    • onFinish (class method)
  • Android
    • waitForReport(seconds)
    • cavyReport
Pixie Labs
Docs
Getting StartedGuidesAPI Reference
Community
HelpContributorsFurther reading
More
GitHub
StarFollow @pixielabsTweet
Cavy
Copyright © 2021 Pixie Labs