From: Richard Conroy Date: 2010-02-12T00:38:35+09:00 Subject: Re: Test script --0003255547a29d99ac047f54e39d Content-Type: text/plain; charset=ISO-8859-1 What you are attempting to do here is an acceptance test, not a unit test. Test::Unit will facilitate both in this case. What you want to do is call your program from the shell, with all of the correct arguments, and assert that your program gives the correct output. THen do it again with random or incorrect arguments and verify that your program gives the correct error response or exit code. You will also need to verify the programs side effects. (Any files that it creates, deletes or touches), On Thu, Feb 11, 2010 at 5:48 AM, Antoine Makhassak wrote: > I have used Test:Unit and the assert_equal function, but I am just able > to call a method I have written and check for expected and actual > outputs. > But the user will be entering the inputs in the command line, therefore > he may enter too few or too many arguments. I couldn't find a way to > test for these errors using the assert_equal function (since if i call > the method I have written and pass too few or too many arguments I > obviously get a compilation error) > I hope you get what I mean > > so basically let's say my source file is called code.rb > In the command line, I can enter: > ruby code.rb 2 3 > ruby code.rb 2 3 4 > ruby code.rb 2 3 4 5 > I want to call these commands directly from a batch or shell script > > Thanks, > Antoine > > > > > Hi, > > > > Already ruby has framework named as Test::Unit. > > > > So if you want to create a test-driven software then just analyse the > > framework and design the software goal. > > > > More about Test:Unit --> > > http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html > > > > > > Thanks > > P.Raveendran > > http://raveendran.wordpress.com > > -- > Posted via http://www.ruby-forum.com/. > > -- http://richardconroy.blogspot.com --0003255547a29d99ac047f54e39d--