PageRenderTime 57ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/codeception/codeception/docs/reference/Commands.md

https://gitlab.com/itlboy/yii2-starter-installed
Markdown | 271 lines | 145 code | 126 blank | 0 comment | 0 complexity | 13d89877238bc6c77aafa5b93e3a790e MD5 | raw file
  1. # Console Commands
  2. ## DryRun
  3. Shows step by step execution process for scenario driven tests without actually running them.
  4. * `codecept dry-run acceptance`
  5. * `codecept dry-run acceptance MyCest`
  6. * `codecept dry-run acceptance checkout.feature`
  7. * `codecept dry-run tests/acceptance/MyCest.php`
  8. ## GenerateSuite
  9. Create new test suite. Requires suite name and actor name
  10. * ``
  11. * `codecept g:suite api` -> api + ApiTester
  12. * `codecept g:suite integration Code` -> integration + CodeTester
  13. * `codecept g:suite frontend Front` -> frontend + FrontTester
  14. ## GherkinSnippets
  15. Generates code snippets for matched feature files in a suite.
  16. Code snuppets are expected to be implemtned in Actor or PageOjects
  17. Usage:
  18. * `codecept gherkin:snippets acceptance` - snippets from all feature of acceptance tests
  19. * `codecept gherkin:snippets acceptance/feature/users` - snippets from `feature/users` dir of acceptance tests
  20. * `codecept gherkin:snippets acceptance user_account.feature` - snippets from a single feature file
  21. * `codecept gherkin:snippets acceptance/feature/users/user_accout.feature` - snippets from feature file in a dir
  22. ## Console
  23. Try to execute test commands in run-time. You may try commands before writing the test.
  24. * `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
  25. ## GenerateGroup
  26. Creates empty GroupObject - extension which handles all group events.
  27. * `codecept g:group Admin`
  28. ## GenerateCept
  29. Generates Cept (scenario-driven test) file:
  30. * `codecept generate:cept suite Login`
  31. * `codecept g:cept suite subdir/subdir/testnameCept.php`
  32. * `codecept g:cept suite LoginCept -c path/to/project`
  33. ## Run
  34. Executes tests.
  35. Usage:
  36. * `codecept run acceptance` - run all acceptance tests
  37. * `codecept run tests/acceptance/MyCept.php` - run only MyCept
  38. * `codecept run acceptance MyCept` - same as above
  39. * `codecept run acceptance MyCest:myTestInIt` - run one test from a Cest
  40. * `codecept run acceptance checkout.feature` - run feature-file
  41. Full reference:
  42. ```
  43. Arguments:
  44. suite suite to be tested
  45. test test to be run
  46. Options:
  47. --config (-c) Use custom path for config
  48. --report Show output in compact style
  49. --html Generate html with results (default: "report.html")
  50. --xml Generate JUnit XML Log (default: "report.xml")
  51. --tap Generate Tap Log (default: "report.tap.log")
  52. --json Generate Json Log (default: "report.json")
  53. --colors Use colors in output
  54. --no-colors Force no colors in output (useful to override config file)
  55. --silent Only outputs suite names and final results
  56. --steps Show steps in output
  57. --debug (-d) Show debug and scenario output
  58. --coverage Run with code coverage (default: "coverage.serialized")
  59. --coverage-html Generate CodeCoverage HTML report in path (default: "coverage")
  60. --coverage-xml Generate CodeCoverage XML report in file (default: "coverage.xml")
  61. --coverage-text Generate CodeCoverage text report in file (default: "coverage.txt")
  62. --no-exit Don't finish with exit code
  63. --group (-g) Groups of tests to be executed (multiple values allowed)
  64. --skip (-s) Skip selected suites (multiple values allowed)
  65. --skip-group (-x) Skip selected groups (multiple values allowed)
  66. --env Run tests in selected environments. (multiple values allowed, environments can be merged with ',')
  67. --fail-fast (-f) Stop after first failure
  68. --help (-h) Display this help message.
  69. --quiet (-q) Do not output any message.
  70. --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  71. --version (-V) Display this application version.
  72. --ansi Force ANSI output.
  73. --no-ansi Disable ANSI output.
  74. --no-interaction (-n) Do not ask any interactive question.
  75. ```
  76. ## SelfUpdate
  77. Auto-updates phar archive from official site: 'http://codeception.com/codecept.phar' .
  78. * `php codecept.phar self-update`
  79. @author Franck Cassedanne <franck@cassedanne.com>
  80. ## GenerateTest
  81. Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
  82. * `codecept g:test unit User`
  83. * `codecept g:test unit "App\User"`
  84. ## Build
  85. Generates Actor classes (initially Guy classes) from suite configs.
  86. Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
  87. * `codecept build`
  88. * `codecept build path/to/project`
  89. ## GenerateHelper
  90. Creates empty Helper class.
  91. * `codecept g:helper MyHelper`
  92. * `codecept g:helper "My\Helper"`
  93. ## Bootstrap
  94. Creates default config, tests directory and sample suites for current project.
  95. Use this command to start building a test suite.
  96. By default it will create 3 suites **acceptance**, **functional**, and **unit**.
  97. * `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir.
  98. * `codecept bootstrap --empty` - creates `tests` dir without suites
  99. * `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers.
  100. * `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests.
  101. * `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed
  102. ## GenerateEnvironment
  103. Generates empty environment configuration file into envs dir:
  104. * `codecept g:env firefox`
  105. Required to have `envs` path to be specifed in `codeception.yml`
  106. ## GenerateFeature
  107. Generates Feature file (in Gherkin):
  108. * `codecept generate:feature suite Login`
  109. * `codecept g:feature suite subdir/subdir/login.feature`
  110. * `codecept g:feature suite login.feature -c path/to/project`
  111. ## GeneratePhpUnit
  112. Generates skeleton for unit test as in classical PHPUnit.
  113. * `codecept g:phpunit unit UserTest`
  114. * `codecept g:phpunit unit User`
  115. * `codecept g:phpunit unit "App\User`
  116. ## GenerateScenarios
  117. Generates user-friendly text scenarios from scenario-driven tests (Cest, Cept).
  118. * `codecept g:scenarios acceptance` - for all acceptance tests
  119. * `codecept g:scenarios acceptance --format html` - in html format
  120. * `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir
  121. ## GenerateStepObject
  122. Generates StepObject class. You will be asked for steps you want to implement.
  123. * `codecept g:step acceptance AdminSteps`
  124. * `codecept g:step acceptance UserSteps --silent` - skip action questions
  125. ## Clean
  126. Cleans `output` directory
  127. * `codecept clean`
  128. * `codecept clean -c path/to/project`
  129. ## GherkinSteps
  130. Prints all steps from all Gherkin contexts for a specific suite
  131. ```
  132. codecept gherkin:steps acceptance
  133. ```
  134. ## GenerateCest
  135. Generates Cest (scenario-driven object-oriented test) file:
  136. * `codecept generate:cest suite Login`
  137. * `codecept g:cest suite subdir/subdir/testnameCest.php`
  138. * `codecept g:cest suite LoginCest -c path/to/project`
  139. * `codecept g:cest "App\Login"`
  140. ## GeneratePageObject
  141. Generates PageObject. Can be generated either globally, or just for one suite.
  142. If PageObject is generated globally it will act as UIMap, without any logic in it.
  143. * `codecept g:page Login`
  144. * `codecept g:page Registration`
  145. * `codecept g:page acceptance Login`