GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing codeception.com — Getting Started - Codeception Docs Guides
Testomatio - Test Management for Codeception Search💡 You are reading docs for latest Codeception 5. Read for 4.x
Getting StartedLet’s take a look at Codeception’s architecture. We’ll assume that you have already installed it
and bootstrapped your first test suites. Codeception has generated three of them: Unit, Functional, and Acceptance.
They are well described in the Introduction. Inside your /tests folder you will have three The Codeception SyntaxCodeception follows simple naming rules to make it easy to remember (as well as easy to understand) its method names.
ActorsOne of the main concepts of Codeception is the representation of tests as actions of a person. We have a “UnitTester”, who executes functions and tests the code. We also have a “FunctionalTester”, a qualified tester, who tests the application as a whole, with knowledge of its internals. Lastly we have an “AcceptanceTester”, a user who works with our application in a real browser. Methods of actor classes are generally taken from Codeception Modules. Each module provides predefined actions for different testing purposes, and they can be combined to fit the testing environment.
Codeception tries to solve 90% of possible testing issues in its modules, so you don’t have to reinvent the wheel.
We think that you can spend more time on writing tests and less on writing support code to make those tests run.
By default, AcceptanceTester relies on the PhpBrowser module, which is set in the In this configuration file you can enable/disable and reconfigure modules for your needs.
When you change the configuration, the actor classes are rebuilt automatically. If the actor classes are not created or updated as you expect,
try to generate them manually with the Writing a Sample TestCodeception has its own testing format called “Cest” (a combination of “Codecept” and “Test”). To start writing a test we need to create a new Cest file. We can do that by running the following command: This will generate the We have Before we execute this test, we should make sure that the website is running on a local web server.
Let’s open the After configuring the URL we can run this test with the This is the output we should see: Let’s get some detailed output: We should see a step-by-step report on the performed actions: This simple test can be extended to a complete scenario of site usage, therefore, by emulating the user’s actions, you can test any of your websites. To run more tests, create a public method for each of them. If your tests share common setup actions, put them into the Learn more about the Cest format in the Advanced Testing chapter. Behavior Driven Development (BDD)Codeception allows execution of user stories in Gherkin format in a similar manner as it is done in Cucumber or Behat. Please refer to the BDD chapter to learn more. ConfigurationCodeception has a global configuration file Running TestsTests can be started with the With the first argument you can run all tests from one suite: To limit tests run to a single class, add a second argument. Provide a local path to the test class, from the suite directory: Alternatively you can provide the full path to the test file: You can further filter which tests to run by appending a method name to the class, separated by a colon: You can provide a directory path as well. This will execute all Acceptance tests from the Using regular expressions, you can even run many different test methods from the same directory or class.
For example, this will execute all Acceptance tests from the To execute a group of tests that are not stored in the same directory, you can organize them in groups. ReportsTo generate JUnit XML output, you can provide the This command will run all tests for all suites, displaying the steps, and building HTML and XML reports. The reports will be stored in the Learn more about available reports. DebuggingTo receive detailed output, tests can be executed with the Learn more about debugging. GeneratorsThere are plenty of useful Codeception commands:
ConclusionWe have taken a look into Codeception’s structure. Most of the things you need were already generated by the
Don't know how to write tests on your own? We will build or improve them for you.
Request a quote for official
enterprise
support or trainings
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |