2014-04-24

How to initiate CodeCeption Test Suite?

In this article we are going to see commands on how to start CodeCeption Test by initiating Test Suit. In this part we will see
A. How to install codeception? and
B. How to generate test suite ? in Two ways.

As we know, in codeception test, a Test Suite will contain, Acceptance Test case, Functional Test Case and Unit Test Case. So, when we initiate the suite, a folder structure will be generated where these there type of test will be there. I will make a separate post on what are those folder structure.

I am using PHPstorm as IDE. We must have PHP installed and set in environment path(see this post)
So, We can generate in 2 ways.

1. Using codecept.phar : (If we download this phar and then try to make the suit) : (download link)

a. Keep the downloaded codecept.phar in root of the project
b. Open Command Line and go to the root of the project
c. Write Command : php codecept.phar bootstrap
image

We will see a new folder inside of the project root tests and a configuration settings yml file codeception.yml
So, we have created the test suite for codeception test.

2. Using composer package manager: Install composer and keep composer in path variable(you can use my this post)

a. Go to project Root folder and create a composer.json file(I use empty text file and rename). This is actually composer package definition file. We will add our codeception package here.
b. open that composer.json file with text editor and add following in this file
{
    "require": {
        "codeception/codeception": "*"
    }
}
image
c. Open command prompt and go to Root of the project.
image
d. Write Command (for updating package, this will install codeception) :  composer update
We will see a folder named vendor. It contains codeception executable along with all necessary packages(from method 1, our codecept.phar contains all in zipped format)
image
e. From command prompt write and run the command : 
For Windows .\vendor\bin\codecept bootstrap
For Linux : ./vendor/bin/codecept bootstrap

image
This will do the the same thing like as previous method. It will create tests folder that contain three type of tests along with codeception.yml.
 So, test suit created. Now we are ready for writing test cases.

Thanks …:) 

No comments:

Post a Comment