Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We need a test suite #527

Open
lcpz opened this issue Mar 24, 2022 · 4 comments
Open

We need a test suite #527

lcpz opened this issue Mar 24, 2022 · 4 comments

Comments

@lcpz
Copy link
Owner

lcpz commented Mar 24, 2022

The idea is to have a lain-test.lua, which requires lain-test-{util, widget, layout}.lua, each of which requires all elements of the respective submodule with all possible options set. Tests could be performed with Xephyr as follows:

Xephyr :1 -screen 1280x800 2> stdout.txt & DISPLAY=:1 awesome -c lain-test.lua

This structure and workflow will serve as a unit, integration and system test suite.

They will also be used to do regression testing for each new commit (e.g., using Travis CI).

@thomascft
Copy link
Contributor

I think rather than using xorg-server-xephyr we should use xorg-server-xvfb.
Here's a dockerfile I spun up for testing just to figure out the concept. I'll modify the rc.lua file a bit for testing and setup Github Actions. I'll make a push when I get it working.

@thomascft
Copy link
Contributor

Ok, so... I wrote a script with Github Actions, but I'm not sure how to implement the widget tests. Right now i just require("lain.widget"). Does that enumerate through the widgets below it or not. I could just make an array with all the widget's names but It'd be important to update that list whenever a new one is added.

@thomascft
Copy link
Contributor

If you want to see what I've done so far, check the actions branch over here.

@Aire-One
Copy link
Contributor

Hello,

That's nice to see some effort in this direction. The more the Awesome WM ecosystem (awesome itself and third-party modules / dependencies) has automatic test, the more it can be considered as mature and stable.

Regarding our tests at Awesome, we have a similar test suite for our integration tests than the one you propose here : https://github.com/awesomeWM/awesome/blob/master/tests/run.sh. It starts Xephyr and run step-by-step tests withing a graphical instance of Awesome. I think, the biggest downside of it, is that it's a homegrown tool, so not exactly what you expect from a conventional/standardized tool, and you have to learn it from scratch. It's not hard, but I'm not sure how easy it would be to reuse a similar script on another context, like for the lain module.

Unit testing is done with busted (https://olivinelabs.com/busted/). Because unit tests don't load a full working environment with Awesome, but only the part that is tested, we need to mock dependent modules in our tests, and to have this preload script (https://github.com/awesomeWM/awesome/blob/master/spec/preload.lua). It's a common annoyance of unit testing that you can't avoid. I'm also not sure how bad it would be for third-party modules.

(just my 2cts about CI testing Awesome WM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants