https://github.com/browserstack/phpunit-browserstack
Selenium examples for PHPUnit and BrowserStack Automate
https://github.com/browserstack/phpunit-browserstack
Last synced: 11 months ago
JSON representation
Selenium examples for PHPUnit and BrowserStack Automate
- Host: GitHub
- URL: https://github.com/browserstack/phpunit-browserstack
- Owner: browserstack
- Created: 2016-03-01T08:33:50.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2025-03-20T02:27:57.000Z (about 1 year ago)
- Last Synced: 2025-04-22T21:06:57.829Z (11 months ago)
- Language: PHP
- Homepage: https://www.browserstack.com
- Size: 55.7 KB
- Stars: 6
- Watchers: 18
- Forks: 17
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# phpunit-browserstack
[PHPUnit](https://github.com/sebastianbergmann/phpunit) Integration with BrowserStack

## Prerequisites
1. Make sure that you have **PHP** installed on your system. You can download and install **PHP** using following commands in the terminal:
* **MacOS:**
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install php
```
* **Windows:**
```bash
sudo apt-get install curl libcurl3 libcurl3-dev php
```
**Note:** For **Windows**, you can download **PHP** from [here](http://windows.php.net/download/). Also, refer to this [documentation](http://php.net/manual/en/install.windows.php) for ensuring the accessibility of PHP through the Command Prompt.
2. Download **composer** in the project directory ([Linux/MacOS](https://getcomposer.org/download/), [Windows](https://getcomposer.org/doc/00-intro.md#installation-windows)).
**Note:** To use the **composer** command directly, it either should have been downloaded in the project directory or should be accessible globally which can be done by the command below:
```bash
mv composer.phar /usr/local/bin/composer
```
## Setup
* Clone the repo
* Install dependencies using: `composer install`
* Update `test.conf.json` file inside the `config/` directory with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings)
## Running your tests
* To run tests, run: `composer test`
* To run local tests, run: `composer local`
Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)
## Notes
* You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate)
* To test on a different set of browsers, check out our [platform configurator](https://www.browserstack.com/automate/php#setting-os-and-browser)
* You can export the environment variables for the Username and Access Key of your BrowserStack account
```
export BROWSERSTACK_USERNAME= &&
export BROWSERSTACK_ACCESS_KEY=
```
## Additional Resources
* [Documentation for writing Automate test scripts in PHP](https://www.browserstack.com/automate/php)
* [Customizing your tests on BrowserStack](https://www.browserstack.com/automate/capabilities)
* [Browsers & mobile devices for selenium testing on BrowserStack](https://www.browserstack.com/list-of-browsers-and-platforms?product=automate)
* [Using REST API to access information about your tests via the command-line interface](https://www.browserstack.com/automate/rest-api)