Skip to content

Codeception template to create automated tests on external APIs

Notifications You must be signed in to change notification settings

tecnocen-com/codeception-api-skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codeception Api Skeleton

Skeleton to create codeception tests using for external projects using suites

  • functional
  • api
  • acceptance

Requirements

Installation

The preferred way to install is through composer.

composer create-project --prefer-dist tecnocen/codeception-api-skeleton codeception-tests

The command installs the advanced application in a directory named codeception-tests. You can choose a different directory name if you want.

If you cloned the project using a CVS like git then run

composer install --prefer-dist

on the root project before continuing preparations.

Preparing application

composer deploy

This library provides a console command to help initialize the application.

composer deploy -- os=win32 gecko=0.18.0 chrome=2.32 selenium=3.6.0

It accepts parameters

  • os: the Operative system version which will run the selenium web driver. By default it will be auto determined by php.
  • selenium: the version for selenium standalone jar file.
  • gecko: the version of Gecko Driver to be used.
  • chrome: the version of Chrome Driver to be used.

This will install the php dependencies using composer and download selenium standalone and the supported webdrivers in the files selenium-ss.jar,

geckodriver and chromedriver

Edit your configuration files

Configure codeception to use your project url.

  • tests/functional.suite.yml configuration PhpBrowser.url
  • tests/api.suite.yml configuration Rest.url
  • tests/acceptance.suite.yml configuration WebDriver.url

Initialize web drivers

This library also provides commands to easily initialize the selenium web drivers

  • composer init-chromedriver to run the tests on chrome or chromium browser.
  • composer init-geckodriver to run the tests on firefox.

Run Tests

You can run tests by using the following composer scripts.

  • composer run-functional-tests run functional tests. (selenium not required)
  • composer run-api-tests run REST api tests. (selenium not required)
  • composer run-acceptance-tests run acceptance tests. (selenium required)
  • composer run-tests all supported tests

Write tests

This skeleton uses codeception so direct to that guide on how to write tests for each suite.

Unit tests and Code Coverage

Since this is an standalone library meant to work without access to the api source code its not possible to create unit tests or review test coverage.

About

Codeception template to create automated tests on external APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages