Art-of-WiFi / UniFi-API-client

A PHP API client class to interact with Ubiquiti's UniFi Controller API
MIT License
1.09k stars 217 forks source link

Functional testing framework #126

Closed icanhazpython closed 2 years ago

icanhazpython commented 2 years ago

Pardon me if this is a naive idea, but such a thing sounds great in theory for quickly and easily validating that new Unifi releases work with this library. Some ideas about how to go about this:

Any thoughts on this?

malle-pietje commented 2 years ago

I like the idea of having a 'standardized' method to test releases before committing them to the repo. However, since there is no standardized UniFi controller environment publicly available this is quite difficult to achieve. Ubiquiti's demo controller was a nice option for this for a while until they stopped upgrading it and now they finally shut it down completely.

One other approach we could take is to implement a testing script that anyone can run against their own test environment and use the output to quickly determine whether everything is working as it should. It could be based on this script but be more extensive and for example write, read and delete specific types of objects: https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/examples/test_connection.php

Obviously, these test actions should be non-intrusive.

Keen to hear what suggestions you have for such a script.

thib3113 commented 2 years ago

@malle-pietje about the public environment, you can easily deploy a docker image, with a site backup, and do the tests on them (I saw it on multiples unifi clients repos) .

Just need to find a "lab", take the backup, and import it ? but nothing will be "alive" ( no stats, no active clients / devices ... ) . Not really good to tests .

malle-pietje commented 2 years ago

I prefer to describe a recommended test process and provide a sample test script and have everyone implement their own based on that. There are just too many different types of environments (and different skill levels of developers) to take into account IMHO.