SimonBiggs / scriptedforms

Quickly create live-update GUIs for Python packages using Markdown and simple HTML elements.
Apache License 2.0
508 stars 34 forks source link

Tests of Watchdog #174

Closed robmarkcole closed 6 years ago

robmarkcole commented 6 years ago

Hi @SimonBiggs I need to write tests for my Home-Assistant watchdog component and came looking here for ideas, however it appears you have no tests yet?

SimonBiggs commented 6 years ago

Hi @robmarkcole, I just have a small selection of e2e tests with selenium.

Definitely many more tests to write.

An e2e test for watchdog over here: https://github.com/SimonBiggs/scriptedforms/blob/master/scriptedforms/tests_e2e/src/watchdog-test.spec.ts

https://github.com/SimonBiggs/scriptedforms/blob/master/scriptedforms/tests_e2e/src/watchdog-manage.md

https://github.com/SimonBiggs/scriptedforms/blob/master/scriptedforms/tests_e2e/src/watchdog-template.md

SimonBiggs commented 6 years ago

That test is essentially a ScriptedForm which has an element which writes to its own template. The test writes something into the string variable, changes the file and checks to see if the file automatically updated.

SimonBiggs commented 6 years ago

Have a look at

To run all the current tests go to the tests_e2e directory run:

yarn
yarn selenium

Then in another terminal run

yarn e2e
SimonBiggs commented 6 years ago

Also with regard to the number of tests in its current state. My first priority is getting scriptedforms to a state where we can be regularly dogfooding it.

Dogfooding provides an important investigative manual testing avenue. Natural "being a user" investigative tests have been picking up many issues thus far and at the moment I am the primary dogfooder.

Once it is in wider use within my own company, I then need to prioritise fixing any issues that that investigative dogfooding testing brings up otherwise I am at risk of losing users within my own company.

After all those issues are cleared up, I want to write the interactive docs, and then I can have the exhaustive interactive docs also be automated with selenium which would then double as another e2e testing suite verifying that every documented feature works.

Then as I need more granuality in diagnosing faults I shall write unit tests.

That's my plan anyway. Does that sound reasonable?

robmarkcole commented 6 years ago

That sounds fine to me 👌