How to test Ruby scripts that offer functionality between runs?

What is a good unit testing method that tests the ability of a script to maintain the correct data between execution - after the script completes with Ctrl-C and then re-runs? Are there any tests for existing modules or scripts that do something similar that could be reviewed for best practices?

+6
source share
1 answer

Use a library, for example http://avdi.org/devblog/2010/07/19/greenletters-painless-automation-and-testing-for-command-line-applications/ , or wait, start, end and restart your program and check if she is behaving properly. It’s good practice to design the program as independent modules, each of which is well tested to minimize the integration test in the console.

+1
source

Source: https://habr.com/ru/post/895497/


All Articles