paperprograms icon indicating copy to clipboard operation
paperprograms copied to clipboard

Figure out an appropriate way to test this

Open chrisuehlinger opened this issue 7 years ago • 1 comments

In a project this complicated (i.e. one which relies on hardware, real-world lighting, browser features hidden behind flags, etc.) I imagine it's difficult to write useful unit tests in any conventional way. However, I also think it's really important that developers have a couple smoke tests to validate that they aren't breaking things when they check in code. I can think of a few steps that would help make the code more testable:

  1. Break the call to navigator.mediaDevices.getUserMedia() out of CameraVideo and instead pass a stream as a prop.
  2. In general, divorce the openCV-related stuff from the React components and just pass the components the minimal state they need to render. That state could be managed by something like Redux, although in my experience Redux itself is not always a good fit for apps whose state includes "blobby" things like MediaStreams.
  3. I haven't dug too deep into the server side, but if we could find a way to mock the DB (or just the calls to the DB) it would make it easier to test changes to the API.

Given that Paper Programs is still young, there might be other higher priorities right now. I just wanted to throw this out there as something to think about while moving forward or designing new parts of the system.

chrisuehlinger avatar Jan 24 '18 17:01 chrisuehlinger

Good ideas! Smoke tests would be nice indeed. But yeah some things are just way too experimental maybe? For example, I would imagine that a good calibration routine could eliminate all manual steps, in which case it would be a bit pointless to test those things.

janpaul123 avatar Jan 26 '18 01:01 janpaul123