php - Codeception run test from web interface

990

I need to run codeception's test from web interface. Have no idea how to do it and cant search it in google. Or it work for console only?

287

Answer

Solution:

Codeception is designed to be run from the command line, but if you want to initiate tests from within your web browser instead, you might be interested in which is a web-based front end to Codeception.

See https://github.com/jayhealey/Webception

Webception is a deployable web-application that allows you to run all your Codeception tests in the browser.

You can access multiple test suites and decide which tests to include in a run. It allows you start, stop and restart the process whilst watching the test results in the Console.

Webception demo

993

Answer

Solution:

I need to run codeception's test from web interface.

I am assuming by web interface you mean, running acceptance tests on web browser like firefox, chrome etc.

If thats the case, then follow the steps from this page http://codeception.com/docs/03-AcceptanceTests

Scroll down to the section: Selenium-WebDriver

  1. First create/generate a basic cept or cest test inside your acceptance directory

    ./vendor/bin/codecept generate:cept acceptance your-test-name
    
  2. Edit the acceptance.suite.yml:

    modules:
        enabled:
            - WebDriver
        config:
            WebDriver:
                url: 'http://www.yoursite.com'
                browser: 'firefox'
    
  3. If you don't have the selenium server yet, get it from http://www.seleniumhq.org/download/. (Grab the Selenium Standalone Server - current version is 2.47.0). We need the selenium server running to communicate with the browser (web interface) using the webdriver. To start the server, run the following command in a terminal window ( * replace it with the version you downloaded )

     java -jar /path/to/selenium-server-standalone-*.jar 
    
  4. Run the test on a separate terminal

    ./vendor/bin/codecept run acceptance --steps
    

This should start the test in firefox browser. If you don't have firefox browser, please download it. If you like to use chrome instead, make sure to first get the correct chromedriver for your os, and then pass the path to chromedriver when you start the selenium server

java -jar /path/to/selenium-server-standalone-*.jar -Dwebdriver.chrome.driver=/path/to/chromedriver

People are also looking for solutions to the problem: Fatal error: Call to undefined function (works within the same PHP but not when seperate)

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.