Skip to main content
🏠Documentation|Behave

Last updated on : 09 Jan 2026

Behave

Overview

Behave is a behavior-driven development (BDD) testing framework for Python, similar to Cucumber, Cucumber-JVM, and SpecFlow. It allows you to write test scenarios in plain, human-readable language rather than direct code.

Key Features:

  • Uses Gherkin syntax (Given-When-Then) to describe test behaviors
  • Enables sharing of test steps across multiple scenarios
  • Supports mobile app testing on both iOS and Android platforms via Pcloudy
  • Separates test specification from implementation
  • More accessible to non-technical stakeholders than traditional frameworks like unittest or pytest

Prerequisites

Before setting up Behave for mobile testing, ensure you have:

  1. Python and PIP - Latest versions installed on your system
  2. Virtual Environment - Familiarity with creating Python virtual environments using venv
  3. Pcloudy Account - Active account with valid credentials
  4. API Access Key - Available in your account profile or Quick Actions tab
  5. Mobile App Upload - Your Android (.apk) or iOS (.ipa) application uploaded to Pcloudy via the web interface
  6. Project Files - Access to your test project repository

Setup Instructions

1. Create Virtual Environment

python -m venv behave-env
source behave-env/bin/activate

On Windows:

behave-envScriptsactivate

2. Install Dependencies

Copy your project files into the virtual environment directory, then install required packages:

pip install -r requirements.txt

3. Configure Test Environment

Edit the config.json file with your credentials and mobile configuration. The sample below shows the basic structure—refer to the Capability Generator page for a complete customized configuration tailored to your needs:

Java
"Pcloudy_Username": "your-email@example.com",
"Pcloudy_ApiKey": "your-api-access-key",
"Pcloudy_ApplicationName": "your_app.apk",
"Pcloudy_DeviceFullName": "SAMSUNG_GalaxyS21_Android_12.0.0",
"Pcloudy_DurationInMinutes": 10

Configuration Parameters:

  • Pcloudy_Username: Your registered email address
  • Pcloudy_ApiKey: Your API access key (found in account profile or Quick Actions tab)
  • Pcloudy_ApplicationName: Exact filename of your uploaded app (e.g., "your_app.apk" or "your_app.ipa")
  • Pcloudy_DeviceFullName: Target device identifier from Pcloudy (e.g., "SAMSUNG_GalaxyS21_Android_12.0.0")
  • Pcloudy_DurationInMinutes: Maximum test session duration in minutes

Running Tests

Single Device Execution

Navigate to your project directory and execute:

paver run SingleDevice

This command will launch the Behave test suite on a single mobile device in the Pcloudy cloud.

Optional: Advanced Features

Enable additional capabilities in your configuration:

  • Video Recording: Capture test execution videos for review
  • Performance Data: Collect performance metrics during tests
  • Device Logs: Gather device logs for debugging
  • WildNet: Test local applications

Troubleshooting

Common Issues:

  • Authentication failed - Verify your username and API key are correct
  • App not found - Ensure the app is uploaded and filename matches exactly in config
  • Device not available - Check device name spelling or try a different device

Additional Resources

Did this page help you?