Coded folders

As I understand it, from the Codeception, all tests will be placed in one of the folders it makes based on a type like unit, function or accept. Large projects that can easily get out of hand. I'm trying to figure out how to create a structure like this:

- functional
    - Module1
        - Applications
            - ApplicationType1Cept.php
            - ApplicationType2Cept.php
        - Accounts
            - AccountType1Cept.php
            - AccountType2Cept.php

      

When I do this:

codecept.phar generate:cept functional AccountType1Cept

      

It will place the new file at the root of the functional folder. I've tried doing something like:

codecept.phar generate:cept functional/Module1/Applications AccountType1Cept

      

But it doesn't work. I suspect it has something to do with sets , but I'm not sure.

How can I get code generation to generate (and execute) tests in a more organized structure?

+3


source to share


2 answers


I'm working on something similar, but on Windows. Right now I have set Codeception as global using Composer:

composer global require "codeception/codeception=2.0.*"
composer global require "codeception/specify=*"
composer global require "codeception/verify=*"

      

This allows me to switch to a specific folder like "/ Module1 / Applications /" and then issue commands directly, like:

a) set up test directory:

codecept bootstrap

      

b) create tests:



codecept generate:cept functional AccountType1Cept

      

If you prefer, you can do it from the main directory, but first you must give Codeception a name, then use the -c option to indicate that you want to run the command in the next directory below, and then the target directory. In your case (using Linux) this would be:

codecept.phar generate:cept functional AccountType1Cept -c ~/Module1/Applications 

      

but it prints too much for me, it's easier to just switch to target folder and issue all commands there :-)

More information: http://codeception.com/docs/07-AdvancedUsage#Running-from-different-folders

0


source


I had a similar need. What you need to do is something like this:

codecept.phar generate:cept functional "Application\ApplicationType1Cept"
codecept.phar generate:cept functional "Account\AccountType1Cept"

      



This creates test files in the folders you want and namespaces as well.

0


source







All Articles