LambdaTestAutomation Testing ● PHPUnit and Selenium: Running PHPUnit Automated Testing Scripts on Cloud Selenium Grid

PHPUnit and Selenium: Running PHPUnit Automated Testing Scripts on Cloud Selenium Grid

Execute your automation test scripts with Selenium WebDriver instantly through LambdaTest which is a cloud-based, cross browser testing tool offering a Selenium grid consisting 2000+ browsers and browser versions running on real operating systems to pace up automation testing of your web-app or website. In this topic, you will learn how to automate your website testing using PHPUnit Selenium test framework on LambdaTest.

By the end of this topic, you will be able to:

  • Run a sample PHPUnit Selenium test script on LambdaTest automation.
  • Set up an environment for testing your locally hosted web pages.
  • Understand & configure PHPUnit desired capabilities for executing a Selenium test.
  • Explore advanced features of LambdaTest.

Prerequisites For Running PHPUnit automated testing with Selenium

All the code samples in this documentation can be found in the PHPUnit LambdaTest Repository on GitHub. You can either download or clone the repository to quickly run your tests.

Before you begin PHPUnit Automated Testing with Selenium, be ready with the below essentials:

  • Make sure that you have the latest PHP installed on your system. If you are using a Mac then PHP would be installed by default. For Linux you would need to enter the below command in terminal:
  • For Windows, you can download PHP from here. Also, refer to this documentation for ensuring the accessibility of PHP through Command Prompt(cmd).

  • Install PHPUnit Selenium Test framework using the below command with composer:
  • If you don’t have composer installed in your system then click here.

  • Once you have composer installed, you can leverage Composer to download and install Selenium dependencies. For that first create a composer.json file in your directory and add the following code to the json.
  • Check out our GitHub repository for finding all the code references that will be discussed in this topic.

Getting Started With PHPUnit Selenium Test Execution on LambdaTest

Let us have a look at an example which will validate your LambdaTest credentials for authentication purpose. Later, the code will select the basic capabilities such as OS, browser, browser version and so on. This code is also available on our PHPUnit GitHub repository for you to clone and play around.(smile)

Now, Create LambdaTestSetup.php.

Now, Create globals.php

Now, finally add single.conf.json.

Execute The PHPUnit Selenium Test

You would need to execute the below command in your terminal/cmd.