How to test Ruby scripts which offer functionality between runs?
Asked Answered
T

1

6

What's a good method for unit testing which test a script's ability to maintain correct data between executions--after a script is terminated with Ctrl-C and then re-run? Are there any tests for existing modules or scripts that do something similar that could be reviewed for best practices?

Trophozoite answered 20/8, 2011 at 17:6 Comment(0)
P
1

Use library like http://avdi.org/devblog/2010/07/19/greenletters-painless-automation-and-testing-for-command-line-applications/ or expect, run, terminate and rerun your program, and check if it behaves correctly. Good practice is to design program as independent modules, each well tested, to minimize integration test in console.

Panayiotis answered 22/8, 2011 at 11:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.