From 4 Hours to 15 Minutes: Automating Regression for 1C-Bitrix

From 4 Hours to 15 Minutes: Automating Regression for 1C-Bitrix Bitrix core updates roll out every two weeks. After each update, manual regression testing takes 4–8 hours. Integration with 1C via [CommerceML](https://en.wikipedia.org/wiki/CommerceML) adds extra risk. The tight coupling and global

Our competencies:

Frequently Asked Questions

From 4 Hours to 15 Minutes: Automating Regression for 1C-Bitrix

Bitrix core updates roll out every two weeks. After each update, manual regression testing takes 4–8 hours. Integration with 1C via CommerceML adds extra risk. The tight coupling and global state interdependency necessitate meticulous bootstrap configuration and dependency isolation. We automate regression to be at least 24 times faster: tests complete in 10–15 minutes instead of four hours. With over 8 years of experience, we have automated regression for more than 30 projects. Without automation, a project can lose up to 20% of its budget on testing—that's roughly $2000 per month or $5000 annually for a typical project. With automation, the monthly testing cost drops to under $100, yielding savings of over $1,900 per month.

Why Bitrix Requires a Special Testing Approach

The main challenge is the monolithic architecture with tight coupling between components and heavy reliance on global state. All components depend on global state: \Bitrix\Main\Application::getInstance(), \CMain, $DB. Unit tests cannot run without initializing the kernel. This requires a special infrastructure. Second, frequent updates—each update can break 1C integration or custom solutions. Third, isolation complexity. Without automation, every new release is stressful. The codebase exhibits high cyclomatic complexity and side effects, making manual testing error-prone. We solve these issues with a proven tool stack.

Tool Stack

For Bitrix projects, we use a combination of the following tools:

Tool Purpose
PHPUnit Unit tests for isolated business logic
Codeception Functional and integration tests (has a Bitrix module)
Playwright E2E tests for browser behavior
PHPStan Static analysis (not a test, but part of CI)

Order a test system development today—it pays off after two updates.

How to Set Up PHPUnit for Bitrix

The core problem of unit-testing Bitrix is that code depends on global state. You cannot run a test without initializing the kernel.

The solution is to load the kernel in the test bootstrap file:

// tests/bootstrap.php $_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__); define('NO_KEEP_STATISTIC', true); define('NOT_CHECK_PERMISSIONS', true); define('BX_WITH_ON_AFTER_EPILOG', false); require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php'; 

phpunit.xml:

<phpunit bootstrap="tests/bootstrap.php"> <testsuites> <testsuite name="Unit"> <directory>tests/unit</directory> </testsuite> </testsuites> </phpunit> 

What to Test with Unit Tests

Business logic isolated in classes without direct kernel dependencies:

class ArticleResolverTest extends TestCase { public function testResolveValidArticle(): void { $resolver = new ArticleResolver($this->createMockRepository()); $result = $resolver->resolve('ABC-123', CATALOG_IBLOCK_ID); $this->assertSame(456, $result->getSkuId()); } public function testResolveUnknownArticleReturnsNull(): void { $resolver = new ArticleResolver($this->createEmptyRepository()); $this->assertNull($resolver->resolve('UNKNOWN', CATALOG_IBLOCK_ID)); } } 

Key pattern: dependency injection instead of direct calls to static Bitrix methods—this makes code testable. Savings on regression can reach 80%.

Functional Tests with Codeception

Codeception with the Bitrix module allows testing HTTP scenarios without a browser:

// tests/functional/OrderCheckoutCest.php class OrderCheckoutCest { public function addToCartAndCheckout(FunctionalTester $I): void { $I->amOnPage('/catalog/product-slug/'); $I->click('Добавить в корзину'); $I->seeInDatabase('b_sale_basket', ['PRODUCT_ID' => 123]); $I->amOnPage('/order/'); $I->fillField('NAME', 'Тест Тестов'); $I->fillField('EMAIL', '[email protected]'); $I->click('Оформить заказ'); $I->seeInDatabase('b_sale_order', ['STATUS_ID' => 'N']); } } 

E2E Tests with Playwright

For critical user paths, we use e2e tests that run a real browser:

// tests/e2e/checkout.spec.js test('full checkout flow', async ({ page }) => { await page.goto('/catalog/product-slug/'); await page.click('.add-to-cart-btn'); await expect(page.locator('.cart-count')).toHaveText('1'); await page.goto('/order/'); await page.fill('[name="NAME"]', 'Test User'); await page.fill('[name="EMAIL"]', '[email protected]'); await page.click('.submit-order-btn'); await expect(page).toHaveURL(/\/order\/success\//); }); 

How to Integrate Tests into CI/CD?

Tests run automatically on every push. We use GitHub Actions or GitLab CI. Setup takes 2–4 hours. Result: each commit passes checks—unit tests in 30 seconds, functional in 3 minutes, e2e in 5–10 minutes. On failure, the build stops and the developer gets notified.

According to 1C-Bitrix documentation, the test environment must be isolated from production. Therefore, all tests run on a copy of the database with test data.

Comparison of Manual vs Automated Testing

Criteria Manual Testing Automated Testing
Regression time 4–8 hours 10–15 minutes
Frequency After each release On every commit
Error probability High (human factor) Low (repeatable)
Cost per cycle ~$200 (labor) ~$1 (server time)
Update support Requires manual recheck Automatic run, fix 1–3 tests

Automation pays off within 2–3 months, and automated testing is 24 times faster than manual—a real breakthrough in efficiency.

Typical Stages of Test System Development

  1. Code and architecture audit (1–2 days): Identify modules to cover.
  2. Bootstrap and infrastructure setup (1–2 days): Create working test environment.
  3. Refactoring for dependency injection (3–5 days): Make code testable.
  4. Unit tests for business logic (5–10 days): Build stable unit test suite.
  5. Functional tests (Codeception) (3–5 days): Verify HTTP scenarios.
  6. E2E tests (Playwright) (3–5 days): Cover critical paths.
  7. CI/CD integration (1–2 days): Automate run on push.
  8. Documentation and training (1–2 days): Team ready to maintain.

What's Included in Test System Development

  • Audit of current code and identification of testable modules.
  • Setup of PHPUnit bootstrap environment for loading Bitrix in test mode.
  • Code refactoring for dependency injection and testability.
  • Writing unit tests for key business logic.
  • Setting up Codeception for functional HTTP scenario tests.
  • E2E tests with Playwright for critical user paths.
  • Integration into CI/CD (GitHub Actions, GitLab CI).
  • Documentation and team training.
  • Access to test environment and post-deployment support.

We guarantee test stability on core updates. Certified specialists with 5+ years of experience and over 30 Bitrix automation projects. The actual cost savings are tangible: a typical project spending $5000 annually on manual testing can reduce that to under $1200 after automation—saving $3800 each year.

Ready to automate testing for your Bitrix project? Contact us—we'll evaluate your project for free and propose a turnkey solution. Get a consultation right now. Automated testing is not just faster; it's 24 times more efficient than manual testing, giving you a competitive edge.