Search This Blog

Tuesday, May 20, 2014

First Selenium Test-Codeception

Codeception is very nice and powerful tool for defining acceptance tests.Internally it uses Mink library to interact with browser.Whereas it can also run tests in headless browser mode as well.

To define our acceptance test we have to add tests under the respective folder(acceptance).

In order to generate our first test , following command can be fired : -

codecept generate:cept acceptance seleniumtest




It'll create the tests under acceptance folder as noticed below : -







Now if we edit the test seleniumtestCept.php, we can see the test definition structure.









It looks like plain English which  anyone can understand juts by looking at it.

Defining Selenium Test: -

In order to define selenium test and run under a browser, we would have to start the selenium server first : -

Step-1: - Start selenium server by the below command : -



Step-2 :- Define the test  as below using predefined codeception actions -



Step-3:-Configure acceptance.suite.yml with the Browser type,URL etc.



 Step-4:
If you'd like to run only your acceptance tests, you can use the following command:

codecept run acceptance

Additionally, you can see the full list of actions performed by using the --steps flag: 
 run acceptance --steps

I hope this helps:)
-----------------x--------------------------------x---------------------------------x----------------------

2 comments:

  1. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    ReplyDelete
  2. outsourcingall.com "Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it.
    This paragraph gives clear idea for the new viewers of blogging, Thanks you. You’re doing a great job Man, Keep it up.
    web hosting service in bangladesh

    ReplyDelete