T
T
tampliyer2016-11-22 13:20:35
Yii
tampliyer, 2016-11-22 13:20:35

codeception. Problem loading Actor classes?

I'm trying to set up a package for unit tests in Codeception. The problem is that codeception tries to load the UnitTester class twice. The first time this class is loaded is when initializing the Loader (Codeception\Test\Loader) when the GherkinLoader is initialized. The second time an error occurs, class loading occurs when the class actor is initialized with the test suite in the setUp() method. At first I thought that the problem was in the namespaces, but everything is in order there. Configuration files below. Perhaps I missed something in the settings? I will be very grateful for your help.
codeception.yml:

actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
settings:
    bootstrap: _bootstrap.php
    colors: true
    memory_limit: 1024M
modules:
    config:
        Yii2:
            configFile: 'config/test-local.php'

unit.suite.yml:
class_name: UnitTester
modules:
    enabled:
        - Yii2
        - Asserts

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tampliyer, 2016-11-23
@tampliyer

I found the reason for this error.
The configuration file codeception.ymlis missing a namespace parameter. Since Codeception Loadersearched for classes in the directories associated with the test suite without specifying a namespace, it found the right file with the class. That is, when I tried to load UnitTester, in my case, the class rest\tests\UnitTester. Reusing the class UnitTesteragain tried to load because rest\tests\UnitTester. It was not to this attempt that the error was thrown.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question