MMM-Remote-Control icon indicating copy to clipboard operation
MMM-Remote-Control copied to clipboard

[Feature Request] Automated Tests Needed

Open ezeholz opened this issue 2 years ago • 6 comments

Description

Given the small window of time each month that I have, and most probably would be smaller in the following days. I would rather have some tests in place to check that new PRs don't break anything critical.

I used to test them in my own MagicMirror, and also in a controlled VM. But nowadays I don't own a MagicMirror anymore, and I started using docker for testing.

Even with that, tests consume excessive amount of time, which can be seen in stale PRs. And my knowledge in automatic testing it's almost none. So in the meantime, and if someone it's available and can develop those tests, I'll gladly review and prioritize that.

(I'll update this issue with the tests that I run by myself.)

Changelog

No response

Requirements

No response

Additional info

No response

ezeholz avatar Jan 08 '24 17:01 ezeholz

@ezeholz I would like to push this forward :muscle:

My plan to tackle this would be to introduce simple tests like linter, formatter and spell checker as a first step. This will already allow us to identify and catch some issues. Once that is done, I would start writing tests for a test runner. I would write the tests using the new test-runner built into node.js, rather than using jest (which has been a common choice so far). I'm not an expert in testing, and I'm not yet familiar with all the features of MMM-Remote-Control, but I think we can make progress step by step.

I would also update the dependencies and probably fix one or two issues on the way.

I consider this my to-do list for now, and I would update and add to it as I go along:

  • [x] #308
  • [x] Add JavaScript linter with soft rules - PR #310
  • [x] Add GitHub workflow for automated testing - PR #310
  • [x] Update dependencies
  • [x] Add CSS linter - Release 2.5.4
  • [x] Add markdown linter - Release 2.5.4
  • [x] Add formatter - Release 2.5.4
  • [x] Add stylistic rules for JavaScript - Release 3.0.1
  • [x] JavaScript linter with harder rules
  • [x] Add test runner
  • [ ] Handle "old" pull requests"
  • [ ] Tackle issues

I will start with the points where I see the least chance of breaking something. Spell check and CSS linter, for example.

What do you think about this?

KristjanESPERANTO avatar Nov 06 '24 19:11 KristjanESPERANTO

Seems good to me! I'll try to get docker installed to help you out a bit over testing.

So far, I've been on testing for Python, but I know most of Remote Control code. Ask me for a hand in any step you need!

Thanks! ✨️

ezeholz avatar Nov 06 '24 19:11 ezeholz

@ezeholz I don't want to put any pressure on you but it would be nice if we could move forward even with small baby steps (like my last PR) 🙂 If you don't have enough time I would also offer to help with maintenance. I'm maintaining a few other modules and a new module list so I'd be happy to help out here too.

KristjanESPERANTO avatar Nov 13 '24 22:11 KristjanESPERANTO

I'm sorry, forgot about it. Already merged!

ezeholz avatar Nov 18 '24 11:11 ezeholz

@ezeholz Thanks! :smiley:

PR #310 would be the next step with the first automated tests :rocket:

KristjanESPERANTO avatar Nov 18 '24 22:11 KristjanESPERANTO

With release 2.5.4 I just added linter for CSS and markdown and a formatter to the CI.

KristjanESPERANTO avatar Mar 02 '25 23:03 KristjanESPERANTO

With release 3.2.4 I just added an initial unit test and a coverage foundation. This is a foundation for many more tests 🙂

KristjanESPERANTO avatar Sep 09 '25 21:09 KristjanESPERANTO

With the release of version 3.2.7, we now have a solid testing framework in place (see https://github.com/Jopyth/MMM-Remote-Control/tree/master/tests) 🥳, so I feel free to close this issue. However, if any further testing requirements arise, let's create a new issue.

KristjanESPERANTO avatar Oct 09 '25 19:10 KristjanESPERANTO