Lisp HUG Maillist Archive

test frameworks

Unable to parse email body. Email id is 11556

Re: test frameworks

Nick,

There is a version of lisp-unit with extensions on Github.

https://github.com/OdonataResearchLLC/lisp-unit 

Aside from the extensions, it is little changed from the original version by Chris Riesbeck. The near term plans are listed in the README. There are no plans to implement hierarchical, composable test suites like FiveAM. That might be something worth considering in a version 2 of lisp-unit once the version 1 goals have been accomplished.

Please feel free to contact me with any questions or suggestions.

Best regards,

Tom
----------------------------------------------------------------
Thomas M. Hermann
Odonata Research LLC
http://www.odonata-research.com/
http://www.linkedin.com/in/thomasmhermann


On Wed, Apr 18, 2012 at 3:41 PM, Nick Barnes <Nick.Barnes@pobox.com> wrote:

I need a test framework for regression-testing and unit-testing some
libraries and applications written using LispWorks.  Suggestions?  I
have read this:

<http://aperiodic.net/phil/archives/Geekery/notes-on-lisp-testing-frameworks.html>

and looked through quite a few of the linked pages, as a result of
which I am favouring FiveAM, and thinking of building some
infrastructure for testing CAPI widgets.

Nick B


Re: test frameworks

Hi,

Just out of curiosity, what's wrong with just running some Lisp scripts calling assert?

Pascal

Sent from my iPad

On 18 Apr 2012, at 22:41, Nick Barnes <Nick.Barnes@pobox.com> wrote:

> 
> I need a test framework for regression-testing and unit-testing some
> libraries and applications written using LispWorks.  Suggestions?  I
> have read this:
> 
> <http://aperiodic.net/phil/archives/Geekery/notes-on-lisp-testing-frameworks.html>
> 
> and looked through quite a few of the linked pages, as a result of
> which I am favouring FiveAM, and thinking of building some
> infrastructure for testing CAPI widgets.
> 
> Nick B
> 


Re: test frameworks

Unable to parse email body. Email id is 11560

Re: test frameworks


On 19 Apr 2012, at 10:16, Nick Barnes wrote:

> At 2012-04-19 04:51:03+0000, Pascal Costanza writes:
> 
>> Just out of curiosity, what's wrong with just running some Lisp scripts calling assert?
> 
> The same things that are wrong with using wget/fetch/curl as a web
> browser, or with programming in machine code.


I don't think the analogy holds. In my experience, setting up test suites for languages like Java, Smalltalk, C++, etc., is pretty difficult and benefits strongly from testing frameworks. On the other hand, I never experienced the need for a test framework in Lisp, because writing the necessary test scripts that just call 'assert in the right places is pretty straightforward, and substantially easier to do than in those languages. So to rephrase my question, under what circumstances is testing without additional support even in Lisp difficult?


Pascal

--
Pascal Costanza




Re: test frameworks

Unable to parse email body. Email id is 11563

Re: test frameworks


On 19 Apr 2012, at 14:21, Nick Barnes wrote:

> At 2012-04-19 12:00:39+0000, Pascal Costanza writes:
>> 
>> On 19 Apr 2012, at 10:16, Nick Barnes wrote:
>> 
>>> At 2012-04-19 04:51:03+0000, Pascal Costanza writes:
>>> 
>>>> Just out of curiosity, what's wrong with just running some Lisp scripts calling assert?
>>> 
>>> The same things that are wrong with using wget/fetch/curl as a web
>>> browser, or with programming in machine code.
>> 
>> 
>> I don't think the analogy holds. In my experience, setting up test suites for languages like Java, Smalltalk, C++, etc., is pretty difficult and benefits strongly from testing frameworks. On the other hand, I never experienced the need for a test framework in Lisp, because writing the necessary test scripts that just call 'assert in the right places is pretty straightforward, and substantially easier to do than in those languages. So to rephrase my question, under what circumstances is testing without additional support even in Lisp difficult?
> 
> Well, in the current instance I want to be able to run many thousands
> of regression tests in an automated fashion, and get a detailed
> collated report of all unexpected behaviour [*] from the entire run,
> distinguishing between detected defects [*] and test system errors
> [*].  During this automated run, many different test fixtures and
> combinations of fixtures will need to be created and torn down in a
> reliable and consistent way.  Some tests will have fixed data, others
> will need to be randomized, in a manner which is reproducible from
> information contained in the report.  I will need to be able to
> manually run a single test from the suite, or a hierarchical subset,
> so both tests and subsets should be named, preferably with meaningful
> names.  I will need to be able to manually specify parameters to an
> individual test or subset of tests.
> 
> Any system like that, in any language, is going to include hundreds of
> lines of test framework, not counting the actual test and fixture
> code.  Although I've built such frameworks in various languages over
> the years, and although some languages make it easier than others (it
> was easier in Python than in C, and it's probably easier in Lisp than
> it was in Python), I'd rather not have to do it again.
> 
> [*] Avoiding the term "test failure", which is ambiguous and also
> communicates exactly the wrong message about the purpose of software
> testing.  A test which detects a defect is a success by any reasonable
> definition.


OK, thank you very much. This is a very clear and helpful answer.

Best,
Pascal

--
Pascal Costanza




Re: test frameworks

Pascal Costanza <pc@p-cos.net> writes:

> On 19 Apr 2012, at 10:16, Nick Barnes wrote:
>
>> At 2012-04-19 04:51:03+0000, Pascal Costanza writes:
>> 
>>> Just out of curiosity, what's wrong with just running some Lisp scripts calling assert?
>> 
>> The same things that are wrong with using wget/fetch/curl as a web
>> browser, or with programming in machine code.
>
>
> I don't think the analogy holds. In my experience, setting up test
> suites for languages like Java, Smalltalk, C++, etc., is pretty
> difficult and benefits strongly from testing frameworks. On the other
> hand, I never experienced the need for a test framework in Lisp,
> because writing the necessary test scripts that just call 'assert in
> the right places is pretty straightforward, and substantially easier
> to do than in those languages. So to rephrase my question, under what
> circumstances is testing without additional support even in Lisp
> difficult?

I second the question.  

- one of my projects where testing was big, "unit" test frameworks
  weren't useful because what we wanted to test was end-to-end and
  round-trip of a SMTP based system.  I wrote that in emacs lisp (it was
  before I switched to CL and that was what motivated me to switch to
  CL).

- on another of my project where I needed more than (defun  test/feature
  () (assert …)… :success), I wrote my own simple test framework in less
  than 130 lines of lisp.  I lost 10% of that time browsing the
  documentation of the other lisp test frameworks, without being
  convinced of their usefulness for my project.



Not to say that they are never useful, but the cases are rare IMO.
One thing on the other hand that may be more useful is to provide a test
"target" to our ASDF system.  Not a lot of libraries have it.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


Re: test frameworks


On Thu, Apr 19, 2012 at 7:36 AM, Pascal J. Bourguignon <pjb@informatimago.com> wrote:

[ snipped lots of stuff ]
 
Not to say that they are never useful, but the cases are rare IMO.
One thing on the other hand that may be more useful is to provide a test
"target" to our ASDF system.  Not a lot of libraries have it.

I don't use unit testing for all of my code. Creating tests for program behavior is tedious. The idea of a unit test framework is to reduce the tedium of writing and interpreting the tests to promote testing.

When I take the time to write tests, the code being tested benefits from the process. There is a gulf between concept and implementation and writing tests helps bridge this gulf. A decent set of tests will provide a reasonable level of verification that the program is correct for proper input and generates errors for improper input. Creating the tests necessitates that you think about the atomic program behavior in the concrete. I benefit from conceiving the tests and have found errors in both my logic and implementation when writing unit tests. I've also discovered corner cases that I didn't anticipate. A unit test framework is nothing more than collecting the "simple test framework in less than 130 lines of lisp" into a package for reuse.

During the initial development phase, writing the tests provides a preliminary, atomic, feel for the API. I've revised function names, lambda lists, and return values while writing tests for aesthetic reasons. The tests provided an early look at using the library.

When a bug in the code is found, you can create tests specific to that bug. The tests will aid in verify that the bug is corrected and that that behavior doesn't surface in the future. The existing unit tests for the rest of the code help with fixing bugs by verifying that other behavior of the code has not been effected by correcting the bug. Similarly, unit tests are useful when factoring code to verify that the changes have not changed the behavior. This makes the code easier to maintain.

None of the testing I do is comprehensive or for that matter provably correct in any sense of the word. Nonetheless, it is useful. I have more confidence in code with some test coverage than code with none.. The ironic thing at the moment is that there are no unit tests for lisp-unit. I'm working on internal tests for lisp-unit core and then using that core to write unit tests for the extensions. It is my intent to write unit tests for all code that I generate.

Best regards,

Tom
----------------------------------------------------------------
Thomas M. Hermann
Odonata Research LLC
http://www.odonata-research.com/
http://www.linkedin.com/in/thomasmhermann


Re: test frameworks

Nick Barnes wrote on Wed, 18 Apr 2012 21:41:48 +0100 00:41:

| I need a test framework for regression-testing and unit-testing some
| libraries and applications written using LispWorks.  Suggestions?  I
| have read this:
| 
| <http://aperiodic.net/phil/archives/Geekery/notes-on-lisp-testing-frame
| works.html>
| 
| and looked through quite a few of the linked pages, as a result of
| which I am favouring FiveAM, and thinking of building some
| infrastructure for testing CAPI widgets.

Looking at cliki.net and cl-user.net could also be valuable.

I would recommend the tester module from the acl-compat library.
For a small except from it I use on LispWorks, please see
http://lisp.ystok.ru/projects.html#acl-compat
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Updated at: 2020-12-10 08:36 UTC