Testing & QA

Thorough testing and QA are essential to ensure seamless integration of the Humance SDK. This section guides setting up a test environment, validating functionality, and handling errors effectively.


Testing Environment

Humance provides a dedicated test environment for development and QA purposes. You can safely simulate API interactions and validate functionality without affecting live data.

Test API Keys:

  • Humance provides a separate set of Test API keys (API-Key and API-Secret) specifically for testing.

  • These keys are accessible in your Humance account dashboard under the "Integration" section.


Switching Between Environments

Humance uses the same API endpoint for both test and production environments. Switching between environments is controlled by the API keys you provide:

  • Test Environment:

    • Use your Test API Key and Test API Secret to interact with the API in a sandbox environment.

    • Test keys simulate all functionality without impacting live data.

  • Production Environment:

    • Use your Production API Key and Production API Secret for live interactions.

    • Production keys interact with real data and live transactions.

How to Switch Environments:

Simply update the apiKey and apiSecret fields in the SDK configuration. The SDK automatically detects whether the keys are for test or production.

Example Configuration:

import { Humance } from 'react-native-humance-sdk';

// Test Environment
<Humance
  apiConfig={{
    userEmail: 'testuser@example.com',   // Email for generating user_hash
    apiKey: 'your-test-api-key',        // Test API Key
    apiSecret: 'your-test-api-secret',  // Test API Secret
  }}
  paymentPageBalance={1000}                // Test balance
  allowPersonalization={true}           // Enable personalized data
/>;

// Production Environment
<Humance
  apiConfig={{
    userEmail: 'produser@example.com',  // Email for generating user_hash
    apiKey: 'your-production-api-key',       // Production API Key
    apiSecret: 'your-production-api-secret', // Production API Secret
  }}
  paymentPageBalance={2440}            // Display personalized balance
  allowPersonalization={true}          // Enable personalized data
/>;

Key Testing Areas

  1. API Integration:

    • Validate all SDK interactions with the Humance API, including:

      • Fetching projects and stories.

      • Creating contributions.

      • Tracking user actions (e.g., likes, shares).

    • Ensure all required parameters are included in requests.

  2. Error Simulation:

    • Trigger error responses by:

      • Using invalid or missing API keys.

      • Sending incomplete parameters.

      • Exceeding rate limits.

    • Verify that your app handles these errors gracefully, using the message and fix fields in the error response object.

  3. SDK Functionality:

    • Test each SDK component, such as the projects-stories module, contribution workflows, and share functionality.

    • Verify proper rendering of UI elements in your app.

Last updated