Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Unittests?

 [1/7] from: robert::muench::robertmuench::de at: 1-Nov-2002 17:46


Hi, I have found an old scrip from Stan Silver for unit testing. However, IMO unit testing should be integral part of Rebol. I would like to be able to start Rebol with a unit test flag, in this case Rebol will first execute all defined unit tests and continue only if all succeeded. Wouldn't this be cool? So we have a continuous quality check of code. Further it makes library usage a lot easier. While developing you will find bugs earlier. Do we need to change Rebol for this or does anyone has an idea how to do it with what we have? Robert

 [2/7] from: greggirwin:mindspring at: 1-Nov-2002 12:05


Hi Robert, Have you seen David Vydra's REBOL-Unit scripts? I don't know that you need it built into the language, since you could just specify some special argument your scripts look for. E.g. some folks load libraries with something like "do/args %mylib.r 'as-lib" and the library itself checks to see if it gets any args. If it sees 'as-lib, it knows it's being loaded by another process. If there are no args, it's being run standalone and executes some tests. I have less-than-half-baked ideas for testing tools and methods, but haven't pursued them yet. --Gregg

 [3/7] from: al:bri:xtra at: 2-Nov-2002 9:19


Robert wrote:
> Do we need to change Rebol for this or does anyone has an idea how to do
it with what we have? I think just a simple script would be sufficient to do this. Just click on it and execute the library unit tests. And if one wants to, just put: do %UnitTests.r in the %User.r file, to get it done on every startup. Andrew Martin ICQ: 26227169 http://valley.150m.com/

 [4/7] from: robert:muench:robertmuench at: 2-Nov-2002 10:25


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 3>>
> Subject: [REBOL] Re: Unittests? > Have you seen David Vydra's REBOL-Unit scripts?
Hi, no I haven't. Where can I find it?
> I don't know that you need it built into the language, since > you could just specify some special argument your scripts > look for. E.g. some folks load libraries with something like > "do/args %mylib.r 'as-lib" and the library itself checks to > see if it gets any args.
IMO this is a sub-optimal solution because you will need a special loader put into your source-code. IMO it's better to just have a 'unititest [] block or something like this, which gets executed before the normal script execution starts. So unit-tests are not executed by inserting special trigger code instead it's done automatically. I have thought about something like this several times now: 1. I would like to be able to run a script before the normal script is executed. Something like a preprocessor, a prolog for the actual script. This epilog should get some datastructures it can traverse like: - forall functions, forall blocks, forall unittests etc. With this you could do anything with the actual script. At the moment I find it quite hard to parse rebol-code. Maybe I haven't seen the right trick at the moment. I want to analyze the script that should be executed. 2. The same can be done for an epilog that get's executed after the script run. With this I could get all unittest blocks and execute these. I hope you understand where I want to go. Robert

 [5/7] from: robert:muench:robertmuench at: 2-Nov-2002 10:25


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 6>>
> one wants to, just put: do %UnitTests.r > in the %User.r file, to get it done on every startup.
Well, this seperates the unit-tests from the application code. But it makes more sense to execute unittests within the context of your application to see if you got some side-effects. That's why I want to do unittests from the application code, not only for the library codes. Robert

 [6/7] from: greggirwin:mindspring at: 3-Nov-2002 10:40


Hi Robert, <<
> Have you seen David Vydra's REBOL-Unit scripts?
Hi, no I haven't. Where can I find it?
>>
vydra.net/rebol-unit/rebol-unit.html I'll have to think about this some more. I really like the more declarative style your suggestions targets, but I'm not sure what the best solution is. E.g. embedded processing at the native level or a generic "unit-tester" script that can be run *against* a script which contains unit tests or against a set of unit tests that exercise one or more scripts. --Gregg

 [7/7] from: christophe:royer:worldonline at: 3-Nov-2002 19:42


I think it's a confusion, my name is ROYER and not ROBERT. I'll try rebol and maybe take contact with you. Bye Christophe from France Hi Robert, << <
>> Have you seen David Vydra's REBOL-Unit scripts?
Hi, no I haven't. Where can I find it?
>> >
vydra.net/rebol-unit/rebol-unit.html I'll have to think about this some more. I really like the more declarative style your suggestions targets, but I'm not sure what the best solution is. E.g. embedded processing at the native level or a generic "unit-tester" script that can be run *against* a script which contains unit tests or against a set of unit tests that exercise one or more scripts. --Gregg

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted