douju7503 2015-01-02 15:49 采纳率: 0%
浏览 45

Codeception子文件夹

As I understand it, out of the box Codeception will put all tests in one of the folders it makes based on type such as unit, functional, or acceptance. With large projects, that can easily get out of hand though. I'm trying to figure out how to have 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 put the new file in the root of the functional folder. I've tried doing something like:

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

But that does not work. I suspect it has something to do with suites, but not sure.

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

  • 写回答

2条回答 默认 最新

  • douxue4395 2015-01-17 18:41
    关注

    I am working on something similar, but on Windows. Right now I have installed 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 yours "/Module1/Applications/" and then issue the commands directly, e.g.:

    a) set up the test directory:

    codecept bootstrap
    

    b) create the tests by:

    codecept generate:cept functional AccountType1Cept
    

    If you prefer, you can do it from the main directory, but you have first to tell Codeception the name, then use the "-c" option to indicate that you want to execute the command in the directory that follows, and then the target directory. In your case (using Linux) it would be:

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

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

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

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么