Join our community at https://www.reddit.com/r/HotelByte/

HotelByte
HomepageWaitlist
HomepageWaitlist
Hotel Partners Roadmap
Submit issues
  1. 2. Guides
  • 1. Get started
    • Overview
    • Booking flow
    • Certification and Go Live
    • Frequently Asked Questions (FAQ)
  • 2. Guides
    • Quick start
    • Error handling
    • Rate limit
    • Certification cases
    • Test more scenarios
  • 3. API Reference
    • Authentication
      • Ticket
    • Content
      • Destinations
      • HotelStaticDetail
      • HotelsMetadata
    • Search
      • HotelList
      • HotelRates
    • Make bookings
      • CheckAvail
      • Book
    • Manage bookings
      • QueryOrders
      • Cancel
  1. 2. Guides

Test more scenarios

Test More Scenarios Guide#

Overview#

The Test header field in HotelByte API provides a powerful sandbox testing mechanism that allows you to simulate various real-world scenarios without affecting production data. This feature is essential for comprehensive integration testing, ensuring your application handles all possible edge cases gracefully.

Who Should Use This Guide#

Business Teams: Understand what scenarios can be tested and their business impact
Product Teams: Learn how to validate product features against different conditions
Development Teams: Implement comprehensive testing strategies using the Test header

Test Header Format#

The Test header accepts key-value pairs in URL query string format:

Basic Syntax#

Multiple Parameters#

Supported Test Scenarios#

1. Availability Scenarios#

scenario=available#

Purpose: Test normal availability flow
Business Impact: Standard hotel search and booking process
Use Case: Verify your application handles successful searches correctly

scenario=soldOut#

Purpose: Simulate hotel/room sold out conditions
Business Impact: Test fallback mechanisms and alternative suggestions
Use Case: Ensure your app gracefully handles unavailability

2. Pricing Scenarios#

scenario=priceChanged#

Purpose: Simulate price changes between search and booking
Business Impact: Test price validation and user notification systems
Use Case: Verify your app handles price discrepancies correctly

3. Service Scenarios#

scenario=serviceUnavailable#

Purpose: Simulate supplier service downtime
Business Impact: Test error handling and service degradation
Use Case: Ensure your app provides meaningful error messages

scenario=unknownInternalError#

Purpose: Simulate unexpected system errors
Business Impact: Test robust error handling
Use Case: Verify your app handles unexpected failures gracefully

Cache Control Parameters#

rawcache Parameter#

Control supplier response caching behavior:
rawcache=on (default): Enable caching
rawcache=off: Disable caching, always fetch fresh data
rawcache=bypass: Bypass cache for this request only
rawcache=only: Only use cached data, don't fetch from supplier

rawttl Parameter#

Set cache time-to-live:

Hotel-Specific Testing#

hotel Parameter#

Test specific hotel scenarios:

Supplier-Specific Testing#

supplier Parameter#

Test specific supplier scenarios:

Complete Examples#

Example 1: Basic Price Change Test#

Example 2: Multi-Supplier Sold Out Test#

Example 3: Service Unavailability Test#

JavaScript/Node.js Examples#

Basic Test Function#

Comprehensive Test Suite#

Python Examples#

Python Basic Test Function#

cURL Examples#

Price Change Test#

Sold Out Test#

Testing Best Practices#

1. Comprehensive Scenario Coverage#

Test all critical user journeys:
Normal booking flow
Price changes during booking
Hotel sold out scenarios
Service unavailability
Network timeouts

2. Error Handling Validation#

Ensure your application:
Displays meaningful error messages
Provides fallback options
Maintains user session state
Logs errors appropriately

3. Performance Testing#

Use cache control parameters to test:
Response times with and without cache
Cache invalidation behavior
Performance under different load conditions

4. Integration Testing#

Test across different suppliers:
Dida scenarios
DerbySoft scenarios
Multi-supplier fallback

Troubleshooting#

Common Issues#

Test Header Not Working#

Problem: Test scenarios not being triggered
Solution:
Verify header format: Test: key=value&key2=value2
Check for typos in parameter names
Ensure you're using the test environment

Unexpected Behavior#

Problem: Test results don't match expectations
Solution:
Check parameter values are correct
Verify hotel/supplier IDs exist
Review server logs for additional context

Cache Issues#

Problem: Cached responses interfering with tests
Solution:
Use rawcache=off to bypass cache
Set appropriate rawttl values
Clear cache between test runs

Debug Tips#

1.
Enable Detailed Logging: Check server logs for test parameter processing
2.
Verify Parameters: Use simple test cases first, then add complexity
3.
Test Incrementally: Start with basic scenarios before complex combinations
4.
Monitor Response Times: Use cache control to test performance scenarios

Business Impact Analysis#

For Business Teams#

ScenarioBusiness ImpactUser ExperienceMitigation Strategy
priceChangedRevenue protectionPrice transparencyReal-time price validation
soldOutLost bookingsAlternative suggestionsDynamic inventory management
serviceUnavailableService degradationError handlingMulti-supplier fallback
unknownInternalErrorSystem reliabilityUser trustRobust error recovery

For Product Teams#

Feature Validation: Test new features against edge cases
User Journey Mapping: Ensure smooth experience across all scenarios
Performance Benchmarking: Validate response times and reliability
Error Message Testing: Verify user-friendly error communication

For Development Teams#

Integration Testing: Comprehensive API integration validation
Error Handling: Robust exception management
Performance Optimization: Cache behavior and response time testing
Monitoring Setup: Error tracking and alerting configuration

Security Considerations#

Test headers are only processed in sandbox/test environments
Production environments ignore unrecognized test parameters
No sensitive data is exposed through test scenarios
All test data is isolated from production systems

Support and Resources#

Technical Support: support@hotelbyte.com
API Documentation: Complete reference at openapi.hotelbyte.com
Test Environment: https://api-test.hotelbyte.com
Community: Join our developer community for best practices and tips

This guide is regularly updated. For the latest information, always refer to the official API documentation.
Previous
Certification cases
Next
3. API Reference