Codeception Set Up

Installation Process

Download and install Java sdk
Download and install eclipse-php-luna
Download “Microsoft Web Platform” (http://www.microsoft.com/web/downloads/platform.aspx). This will be like this file “wpilauncher”. Then open “wpilauncher”, search for php (PHP 5.6.something) and Add/Install it.
Download “selenium-server-standalone” version 2.53 (http://www.seleniumhq.org/download/)
Download codeception (http://codeception.com/)
Latest version . It will be a codecept.phar file

Download latest chromedriver

Development process Create Workspace
Open Eclipse (luna)
Create a new project (Ex.: salesforcePractice)
Go to Workspace, here you will find a project/folder (salesforcePractice)
Copy “codecept.phar” and “selenium-server-standalone” in “salesforcePractice” folder under workspace.
OR
Create Workspace
Create a folder named “Test2” under “C:\Users\Lenovo\Documents”
Copy “codecept.phar” and “selenium-server-standalone-2.47.1” in “Test2” folder.
Copy and paste “.buildpath” and “.project” files in “Test2” folder.
Open “.project” folder and write “test2” under “ . Save it.

Command Prompt Commands
How to start selenium server
Open command prompt
Go to the folder where is the project workspace (Example: cd D:\Jaspal\PHP Workspace\salesforcePractice)
Then write this command “Java -jar selenium-server-standalone.jar” and press enter (This command should be on the basis of “selenium stand alone” file name in your system)
Now minimize this command prompt
Codeception commands
Open new command prompt
Go to the folder where is the project workspace (Example: cd D:\Jaspal\PHP Workspace\salesforcePractice)
Command to initialize any project
Go to the folder where is the project workspace
Php codecept.phar bootstrap
Command to check php installed version is Php –v

After initialize a project, now under Eclipse, do some changes in acceptance suite
Change PhpDriver to WebDriver, change(pass) application url, choose browser. Please consider below example:
Codeception Test Suite Configuration

Suite for acceptance tests. Perform tests in browser using the WebDriver or PhpBrowser. If you need both WebDriver and PHPBrowser tests - create a separate suite.

class_name: AcceptanceTester
modules:
enabled: - WebDriver: url: http://getskills.co.nz browser: firefox - \Helper\Acceptance

Command to generate new Test Case
D:\Jaspal\PHP Workspace\salesforcePractice>php codecept.phar generate:cept acceptance login

Command to Run Test Case with input data description
D:\Jaspal\PHP Workspace\salesforcePractice>php codecept.phar run tests\acceptance\loginCept.php --debug

Command to Run Test Case with input data description and html result report
D:\Jaspal\PHP Workspace\salesforcePractice>php codecept.phar run tests\acceptance\loginCept.php --debug --html

Commands helpful when Working with page object
Php codecept.phar generate:pageobject login
Php codecept.phar generate:cept acceptance login
Php codecept.phar run tests\acceptance\loginCept.php --debug --html
Php codecept.phar run tests\acceptance\ –debug –html (To run all the test cases in acceptance)
Php codecept.phar run tests\acceptance\loginCept.php –debug –html

Codeception BDD - Preferred Method of Test Automation Implementation

In recent versions Codeception has added a support for Gherkin and it works perfectly as a BDD framework.

All the commands to generate gherkin snippets, test methods, configuration files and examples for Gherkin can be found on this link below
http://codeception.com/docs/07-BDD