knitlib icon indicating copy to clipboard operation
knitlib copied to clipboard

Full testsuite for AYAB plugin

Open tian2992 opened this issue 10 years ago • 6 comments

Will require mocking and emulation of Serial Port

tian2992 avatar Jun 08 '15 04:06 tian2992

Hi @tian2992, I am currently working on this issue by creating tests for ayab_image and ayab_communication. Can I work on this issue ?

shiluka avatar Jun 13 '15 12:06 shiluka

There are two main issues that make this full stack testing hard.

  • Emulation of device The knitting process expects replies and continuous communication from the device. To fully emulate that we should develop a mock serial port object that allows for programmable message sending and message replies that is comparable to the behaviour of the real AYAB board. This would also mean doing that for every other device we would like to test.
  • User facing Interactive behaviour. Interactive callbacks reduce this problem, however as callbacks do require actions to be taken on the user side (changing some setting, moving some dial, pushing a button, etc), those need to be emulated as well. https://github.com/fashiontec/knitlib/blob/master/src/knitlib/plugins/knitting_plugin.py#L50

If you only do tests for ayab_communication, bear in mind that this tests will only cover that code instead of being a full stack test. However learning from those tests can be useful and can help to make ayab_communication more generic.

I would also not recommend creating a test for ayab_image as it is up to a certain way, a way more primitive version of the holding object of what can be in the future a Knitpat object.

tian2992 avatar Jun 13 '15 15:06 tian2992

ok thanks for the comment.

shiluka avatar Jun 13 '15 16:06 shiluka

Also please see #25 Cheers :)

tian2992 avatar Jun 13 '15 16:06 tian2992

Thanks :)

shiluka avatar Jun 13 '15 17:06 shiluka

Except for full device emulation, I'd consider this mostly done.

tian2992 avatar Jul 17 '15 06:07 tian2992