Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/christophwurst/nextcloud_testing

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit
https://github.com/christophwurst/nextcloud_testing

Last synced: 3 months ago
JSON representation

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

Awesome Lists containing this project

README

        

# Nextcloud Testing

Simple and fast unit and integration testing framework for Nextcloud 25+, based on PHPUnit

Features
* Minimal setUp/tearDown overhead for unit tests
* Simple trait-based mechanism to reset database after integration tests
* Based on PHPUnit

## Unit Tests

Use ``TestCase`` as base class for your test case:

```php
webDriver`:

```php
webDriver->get('http://localhost:8080/index.php/login');


}

}
```

This framework targets [Sauce Labs](https://saucelabs.com/) as testing back-end that runs the test
browser instances. Hence, it is necessary to set the `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` env
variables. `SELENIUM_BROWSER` lets you choose the browser to run your tests against.

## Test Users

Include the `TestUser` trait in your test case to conveniently generate new test users. The trait
will create a new user with a random UID (including collision detection).

```php
createTestUser();


}

}
```

The returned user is of type `IUser`. You can read its UID with `$user->getUID()`. Note that the
user is not removed after the test.