moosh
moosh copied to clipboard
Add test framework to Moosh
- moosh version: master
- moodle version: any
- database:
- php version: any
- operating system: linux
Actual behaviour
Moosh is an excellent tool and the code base is growing steadily. However, as I was developping a couple of additional commands I found myself struggling with the way "unit testing" was setup in this project (https://moosh-online.com/dev/). I would like to use this ticket as an epic so we can track further improvements to the way we can add then test a new Moosh functionality.
Expected behaviour
I would go by a couple of steps:
- Remove unused/ not useful ways of testing: looking at the dev page (https://moosh-online.com/dev/), I am wondering if the Vagrant box is sill in use or up to date and used for testing. There seems to be missing the test database and it is creating a subfolder called moosh-src which is a problem if it was designed for testing (we are running a copy of the source code that needs to be updated). If it was deemed for production usage and not for testing/development, maybe we ought to create a docker image instead.
- Use docker and create a script that will setup the test environment as indicated. This can be either done via a Dockerfile or even ansible. Either one image per version of moodle to be tested, or all moodle version in the same container.
- Use the docker image to test all commands in tests/commands
- For command line testing use something like expect or bats
Any comments ? If it is a direction we want to go, I am ready to tackle a couple steps now and then.
Hi David,
the vagrant box could probably be upgraded. Anyway, your proposition is solid. Docker could be a nice and lighter way of recreating test environment and run test scenarios. If you're up to for a docker collaboration let me know. Perhaps I might help.
Cheers
Hi Andrej,
Thanks for the reply. Yes I am up for it and really happy it can be a way forward. Let's connect in Jan. as I will have more time to dedicate to it then.
Ok, we can experiment on a separate branch and see how we can optimize testing, provide some pro/cons and valid use cases so others can give us feedback. @tmuras
Hi guys. The testing is something that bothers me for a long time. Here is what I've come up with - https://moosh-online.com/dev/
Any suggestions are most welcome.