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 …:) 

2014-04-12

How to install GIT in Windows

In this article, we are going to learn about how to install GIT system in windows. Specifically Git and GitHub Client. The main goal is to make a software development environment with GIT.

As we know, GIT is a file management system with version controlling. We will use git to manage our developed source files. And, as Git maintain repository(public free, private paid), we will use them. I will make separate posts for GIT architecture and Git Commands.

So, For installing GIT System( lets call is system because it consists of more than one software). we need to download these two installers.

A. Git Environment Installer : We need that to support git commands in the system . Use latest build. I will use 1.9
B. Git- Hub windows client : We will use the GUI to manage out repository(folder in git hub & Local)
And, dont’ forget to have a account in github.com. Its free. Now, lets get started with following steps.

Step 1.
Run Git-1.9.0-preview20140217.exe installer in windows( I am using windows 7x64). Follow the full process of installation. In the process you have to take care of following things.

a. Select the advance context menu
image
b.  I like to use Windows Command Prompt rather than others
image

c. I prefer windows style for checking & commit.
image

d. Though the application will include in the path but make sure that you have this in your path variable.
image

Please check that you have installed Git. To do that, open command prompt and type git –version
And you will see git version number

image

We will get Git-Bash and Git Gui in program files. Git Gui is gui control of git command. We can create SSH key , repository using GUI also.  We will use Git hub client to do that.
So, we have successfully Installed Git in the system. Now, it is time to install Git Hub client.

Step 2.
Run Git hub windows client (GitHubSetup.exe). And follow steps that required to complete setup.

a. Log in with exist username /password or create a new account in GitHub.
image

b, After log in, We will see that our Windows Client has already add a SSH key with PC Name. If we go to this link with our account , we see a new entry. I will provide another post for how to create and use custom SSH key with key generation tool.

image

c. Now, we have define the Local directory where our repository will be downloaded. To do that,image

we have to go to Tools –> Option, Then we get the default location and PowerShell as default shell. This part is fully optional, I like Git Bash, so I use GitBash(some time I use Cmd also).
image
Now, press Update and we have completed the Github Windows Client setup.
We can Get our repositories from left panel of client and select the project/repository and click Clone. (actually cloning the repository)
image image

I will provide a separate blog for Git Architecture, Terms as well as Commands. 

Note : We may use TortoiseGIT which is very handy. If you are too much familiar with TortoiseSVN, I would recommend to use TortoiseGIT.

Thanks.. :)

2014-03-14

What is composer? How to install composer in windows?

In this article we are going know about Composer and how to use composer. I am writing this because we will need composer for installing dependency packages for Codeception.

What is Composer? 
Composer is a PHP dependency manager. You may find similar to Maven for java. The main difference is , Maven use XML where Composer use JSON file to write dependencies. And, in Maven we can manage the package but composer deals with framework/libraries.

Composer finds out specific version of a package needs to be installed and install it with its dependent packages.

Requirements : 
Composer needs minimum PHP 5.3.2.
PC should have cUrl with PHP installed(not only for composer, other tools also)

How to install ?
Step 1 : There are several ways to download, but as I use Windows, I download this and install in windows. 
Step 2 : Set installed folder location (C:\ProgramData\ComposerSetup\bin) in system's path variable.( get help from this post) 

How to Declare Dependencies? 
Declaring composer is very simple. In the project root, create a file composer.json . Edit that json file with text editor start like this .
{
"require" : {

                   }
{

Then we add our dependency packages along with version number in the require braces. Ex: for installing codeception, we have to write like this
{
    "require": {
        "codeception/codeception": "*"
    }
}

 
To write package, we have to follow JSON way. Like "Vendor Name/Package Name" : "Version Number".  In version number ,
* = any version,
1.3.*=  any version start with 1.3.

And , to install that dependencies, we need write this in command line
cd <project folder where composer.json is present>
composer update


Note : Here we have manually added composer.json. If we use composer init in command prompt, we will get a wizard in command line to create composer.json file with specific package. 
 
 
We can use Auto loading(before launching application)  with composer

When we use? 
1. When we have a project which is dependent on a number of Libraries
2. Some of those libraries are dependent on other libraries.
3. We might have our own custom dependent libraries


To get more detail, you may read this PDF.

Thanks..:)