Mohd Shahid
Mohd Shahid

Reputation: 1606

Codeception Api Test gives error in Yii2

I have below YML code in api.suite.yml

class_name: ApiTester
modules:
    enabled: [PhpBrowser, REST]
    depends: 
         REST: PhpBrowser
    config:
        PhpBrowser:
            url: 'http://localhost/testapi/'
        REST:
            url: 'http://localhost/testapi/json/1.0/'

It gives below error when I run using ./vendor/bin/codecept run

  [Codeception\Exception\ModuleRequireException]              
  REST module requirements are not met!                       
  This module depends on Codeception\Lib\InnerBrowser         

  Example configuring PhpBrowser as backend for REST module.  
  --                                                          
  modules:                                                    
      enabled: REST:                                          
          depends: PhpBrowser                                 
          url: http://localhost/api/                          
  --                                                          
  Framework modules can be used for testing of API as well.   

I tried many YML config combinations without any luck. How to fix this issue?

Upvotes: 0

Views: 1262

Answers (1)

catilgan
catilgan

Reputation: 23

I had the same exception. After doing some research, if could fix my issue with the following configuration:


class_name: ApiTester
modules:
  enabled:
    - REST:
        depends: PhpBrowser
        url: http://127.0.0.1/api/v1/

Yaml files are whitespace-sensitive. So you have to pay attention on the indentations.

Upvotes: 2

Related Questions