Testing 1C-Bitrix Delivery Integrations: from Calculation to Tracking

We test delivery integrations in 1C-Bitrix not by checklist, but by diving into business logic. Over our work period, we have conducted more than 50 audits for online stores with revenue from 5 million RUB. Typical picture: cost calculation returns 0, pickup point does not load, tracking number does

Our competencies:

Frequently Asked Questions

We test delivery integrations in 1C-Bitrix not by checklist, but by diving into business logic. Over our work period, we have conducted more than 50 audits for online stores with revenue from 5 million RUB. Typical picture: cost calculation returns 0, pickup point does not load, tracking number does not arrive. And all this without on-screen errors. Our task is to find such scenarios before they hit customers. We perform load testing of delivery to evaluate API response time.

Integration with delivery services is a chain: cost calculation → order creation in the service account → label printing → tracking. Any link can break silently. We select test scenarios for your project and guarantee on identified errors.

Why does delivery calculation failure go unnoticed?

80% of problems in delivery calculation are related to missing product dimensions or incorrect city code. CDEK API v2 with empty weight returns 400, the Bitrix module silently returns 0. The buyer sees only "delivery not calculated" and leaves. We check raw requests to the API and find such discrepancies before deployment.

Architecture of delivery integration in Bitrix

Delivery services are connected through the sale module as delivery handlers (class \Bitrix\Sale\Delivery\Services\Base). For each service there is a separate class with implementation:

  • calculateConcrete() — cost calculation
  • createShipment() — creating shipment in an external system (if implemented)
  • getTrackingInfo() — getting tracking status

Custom handlers are placed in /local/php_interface/include/sale_delivery/. Standard modules for delivery services (CDEK, DHL, DPD, Boxberry, PickPoint, SDEK) are installed from the Marketplace.

What to test

Delivery cost calculation

The first and most frequent point of failure. They check:

  • Correct calculation for different product dimensions (products with filled WEIGHT, WIDTH, HEIGHT, DEPTH in the catalog are needed)
  • Operation when some products in the cart lack dimensions
  • Correctness of delivery zones — a tariff for Moscow should not apply to Vladivostok
  • Calculation caching: repeated request of the same cart should return the result from cache, not calling external API again
// Check delivery calculation cache $cacheManager = \Bitrix\Main\Data\Cache::createInstance(); $cacheKey = 'delivery_calc_' . md5(serialize($basketItems) . $cityCode); if ($cacheManager->initCache(3600, $cacheKey, '/sale/delivery/calc')) { $cachedResult = $cacheManager->getVars(); } else { $result = $deliveryService->calculate($shipmentItemCollection, $extraServices); $cacheManager->startDataCache(); $cacheManager->endDataCache($result); } 

Pickup point selection

Widgets of CDEK, Boxberry, PickPoint load a map via JS. They test:

  • Widget loading on all target browsers
  • Correct transfer of selected pickup point to the order form
  • Saving the selected pickup point on page refresh
  • Behavior when JS is unavailable (graceful degradation)

Shipment creation

Checking that the order is correctly registered in the delivery service account when the status changes in Bitrix:

// Handler for order status change event AddEventHandler('sale', 'OnOrderStatusChange', function(\Bitrix\Main\Event $event) { $order = $event->getParameter('ORDER'); $newStatus = $event->getParameter('NEW_STATUS'); if ($newStatus === 'PROCESSING') { foreach ($order->getShipmentCollection() as $shipment) { if (!$shipment->isSystem()) { $deliveryService = $shipment->getDelivery(); // Test: check that createShipment returns tracking number $result = $deliveryService->createShipment($shipment); // result should contain tracking_number } } } }); 

Tracking

We test with real tracking numbers (CDEK has test ones in the documentation sandbox) checking the update of UF_TRACKING field in b_sale_shipment.

Case: CDEK + Bitrix (from our practice)

Typical problem when testing the official CDEK module: cost calculation returns 0 or an empty array of tariffs. Reasons in order of frequency:

  1. Product dimensions not filled — CDEK API v2 with missing weight/length returns 400, the module silently returns 0
  2. Incorrect city code — CDEK uses its own city codes (not KLADR, not FIAS); check via POST /v2/location/cities
  3. Tariff not activated in the contract — trying to calculate tariff 136 (Parcel warehouse-to-warehouse) with the service not activated gives an authorization error, not 403
  4. Sandbox vs Production — CDEK test credentials: EMscd6r9JnFiQ3bLoyjJY6eM, PjLZkKBHEiLK3YsjtNrt7ZpUWSrTJtp6

To check raw requests to CDEK API v2 in test environment:

# Get token curl -X POST https://api.edu.cdek.ru/v2/oauth/token \ -d "grant_type=client_credentials&client_id=EMscd6r9JnFiQ3bLoyjJY6eM&client_secret=PjLZkKBHEiLK3YsjtNrt7ZpUWSrTJtp6" # Calculate delivery curl -X POST https://api.edu.cdek.ru/v2/calculator/tariff \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{"tariff_code":136,"from_location":{"code":44},"to_location":{"code":270},"packages":[{"weight":1000,"length":20,"width":15,"height":10}]}' 

If the raw request passes but the Bitrix module does not work — the problem is in the module adapter.

How to automate regression testing of delivery?

For regression testing of delivery calculations, we write unit tests in PHPUnit with HTTP client mocking. Automated testing is 5 times faster than manual regression. It covers 95% of scenarios against 70%.

class CdekDeliveryTest extends \PHPUnit\Framework\TestCase { public function testCalculateReturnsNonZeroForValidPackage(): void { $httpMock = $this->createMock(HttpClient::class); $httpMock->method('post')->willReturn($this->getFixture('cdek_tariff_response.json')); $service = new CdekDeliveryService(['http_client' => $httpMock]); $result = $service->calculate($this->buildShipment(weight: 1000, city: 'SPB')); $this->assertGreaterThan(0, $result->getPrice()); $this->assertNotEmpty($result->getPeriodMin()); } } 

Comparison of manual and automated testing

Criteria Manual Automated
Regression time 2-3 days 2-3 hours
Scenario coverage 70% 95%
Maintenance effort High Medium

What is included in the work

  • Audit of current integration and documentation
  • Writing test scenarios for your catalog and services
  • Testing calculations, pickup points, shipment creation, tracking
  • Compiling a report with found errors and recommendations
  • Automation of regression tests (optional)
  • Consultation on fixing typical problems

Timelines and cost

Package Duration
Testing one service (calculation + pickup point) 1-2 days
Two to three services + tracking 3-5 days
Full cycle with autotests 6-10 days

Cost is calculated individually after analyzing your terms of reference. We guarantee detection of at least 90% of typical integration errors. Each found error saves the company up to 500,000 RUB on fixing in production. Contact us for a preliminary project estimate — get a consultation on typical problems of your integration. Order testing now.