ed-cooper/lecture-hoarder

Add automated testing

Opened this issue · 6 comments

Will allow us to track regressions.

I considered this, but I wasn't sure whether it would be worth the time spent refactoring for how little changes will probably be made from this point onwards.

Plus we'd probably need a username and password combination for running tests with? (Unless you mean only doing tests locally with supplied usernames?)

I see two main approaches forward:

  1. A fake http server that will return cached results from the official server (but slightly edited of course)

  2. Separating out the web requests into their own object, and just stubbing that object when testing the rest of the logic

The HTML parsing is one of the most important parts of the logic imo, and probably the easiest to break.

Therefore the HTTP server would be the way forwards.

It would be easy enough to introduce variables for the https://login.manchester.ac.uk/ and https://video.manchester.ac.uk/ base URLs, which could then be changed for testing purposes.

But trying to create a semi-accurate web server is more effort than I'd want to do, so I'd be leaving it up to you to implement.

I agree with this course of action.

I would suggest you add the "help-wanted" or/and "up-for-grabs" labels onto this issue

The login and video URLs are now exposed in the settings, so theoretically setup with a fake HTTP server would now be possible

Abstraction of web requests has been completed, now a unit testing setup with dependency injection can be implemented