I am beginning to learn and use test driven development in my projects. I've noticed that NX does not use the standard "tcltest" package in Tcl but instead provides it's own "nx::test". Is there a specific reason for that?
Thanks,
Victor
Victor,
I am beginning to learn and use test driven development in my projects. I've noticed that NX does not use the standard "tcltest" package in Tcl but instead provides it's own "nx::test". Is there a specific reason for that?
I can't give you the full story, only some observations of mine. To some extent, nx::test and especially its predecessors (xotcl::test) are a legacy:
OTcl had its own testing environment, not using or not building upon tcltest, and so had XOTcl; see e.g. http://otcl-tclcl.cvs.sourceforge.net/viewvc/otcl-tclcl/otcl/lib/test.tcl?vi...
test migration vs. test continuity so is the issue here. also: nx::test & friends have always been used to test core functionality of the language system, rather than application testing. for your XOTcl/nx application, tcltest is certainly a viable option (coming with nice helpers actually missing in nx::test). another answer along these lines is probably that a home-brewed testing evironment is usually one of the first prototype applications written by the language authors in their language.
as for application testing, however, an object-aware testing environment comes handy; you can refine your test suites occasionally through mixins; or nx::test traces object lifecycles during test execution to maintain a prestine testing sandbox to avoid unwanted test interactions. however, that does not mean that you could not realise all of this using tcltest.
some further pointers, especially when it comes to TDD (which is, by the way, something different than merely writing and executing tests in the sense of tcltest or nx::test):
Two or three years ago, I had a look at a xUnit framework for XOTcl: http://xotcllib.cvs.sourceforge.net/viewvc/xotcllib/xounit/
While it gave me a xUnit environment, it found it incomplete and its implementation rather clumsy (including its usage of Exception objects ontop of Tcl's error control flow mechanism).
More recently, Mark published on a scenario-driven approach and prototype framework (STORM) which I successfully used in one or two dev projects of mine. It comes with essentials concepts for applying a test-first development approach:
http://wi.wu-wien.ac.at/home/mark/publications/se2011-extended.pdf
I don't know whether the prototype implementation (the XOTcl script) is publicly available, but you could most certainly talk Mark into providing it to you :)
//stefan
Thanks,
Victor _______________________________________________ Xotcl mailing list Xotcl@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
Just to provide a short addon to stefan's long response: - some tests in xotcl/nx are indeed legacy of otcl (testo.xotcl). - the first generation of regression tests were written in the otcl style (testx.xotcl). - these tests are in part "designed", but also in part tricky cases derived from bug reports. Many of these tests are rather integration tests than unit tests, testing interdependencies of language features. From the debugging point of view these are a mess, since it might take quite some time to find the source of a misbehavior. At the same time, these are real-world examples and they are valuable for the project, since these are testing simultaneously several complex features, so i'll leave these for the time being.
The newer generation of tests (package nx::test) are built just around the needs of xotcl/nx, for making testing more convenient. nx::test is an - oo-based test environment with - automated cleanup for the objects created in a test run, - provides error/exception handling and - simple means for speed comparison, - triggers routines for internal (c-level) consistency checking, and - provides a simple syntax
Writing test environments in Tcl is very simple and quite straightforward, but depending on your needs, different approaches are reasonable.
In case, you are in an environment where you are using already many xUnit tests for several other languages, and you are using eclipse, you might find xounit from Ben Thomasson useful (some more pointer in addition to Stefan's) http://xotcllib.sourceforge.net/xounit.html which seems to be integrated via plugin into eclipse.dltk http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.dltk/xotcl/plugins/org... http://download.eclipse.org/eclipse/pde/apitools/eclipse-galileo-rc4/api-htm...
some people seem to like tclTkUnit (which disappeared from the public pages a few years ago) which is as well modeled close to JUnit: http://classic-web.archive.org/web/20080822172425/http://park.ruru.ne.jp/and...
-gustaf neumann
Hi Victor,
in case you like to give it a try: version 0.5 of the basic STORM test environment (including a small example written by Stefan) can be downloaded from the following URL: http://wi.wu.ac.at/home/mark/STORM/storm-v.0.5.tar.gz or http://wi.wu.ac.at/home/mark/STORM/storm%2dv%2e0%2e5%2etar%2egz
best regards,
Mark
On Tuesday 26 April 2011 12:40:14 Stefan Sobernig wrote:
Victor,
I am beginning to learn and use test driven development in my projects. I've noticed that NX does not use the standard "tcltest" package in Tcl but instead provides it's own "nx::test". Is there a specific reason for that?
I can't give you the full story, only some observations of mine. To some extent, nx::test and especially its predecessors (xotcl::test) are a legacy:
OTcl had its own testing environment, not using or not building upon tcltest, and so had XOTcl; see e.g. http://otcl-tclcl.cvs.sourceforge.net/viewvc/otcl-tclcl/otcl/lib/test.tcl?vi...
test migration vs. test continuity so is the issue here. also: nx::test & friends have always been used to test core functionality of the language system, rather than application testing. for your XOTcl/nx application, tcltest is certainly a viable option (coming with nice helpers actually missing in nx::test). another answer along these lines is probably that a home-brewed testing evironment is usually one of the first prototype applications written by the language authors in their language.
as for application testing, however, an object-aware testing environment comes handy; you can refine your test suites occasionally through mixins; or nx::test traces object lifecycles during test execution to maintain a prestine testing sandbox to avoid unwanted test interactions. however, that does not mean that you could not realise all of this using tcltest.
some further pointers, especially when it comes to TDD (which is, by the way, something different than merely writing and executing tests in the sense of tcltest or nx::test):
Two or three years ago, I had a look at a xUnit framework for XOTcl: http://xotcllib.cvs.sourceforge.net/viewvc/xotcllib/xounit/
While it gave me a xUnit environment, it found it incomplete and its implementation rather clumsy (including its usage of Exception objects ontop of Tcl's error control flow mechanism).
More recently, Mark published on a scenario-driven approach and prototype framework (STORM) which I successfully used in one or two dev projects of mine. It comes with essentials concepts for applying a test-first development approach:
http://wi.wu-wien.ac.at/home/mark/publications/se2011-extended.pdf
I don't know whether the prototype implementation (the XOTcl script) is publicly available, but you could most certainly talk Mark into providing it to you :)
//stefan
Thanks,
Victor _______________________________________________ Xotcl mailing list Xotcl@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
Thanks to everyone for your replies. They were very helpful.
Victor
On Tue, Apr 26, 2011 at 6:09 AM, Mark Strembeck strembeck@acm.org wrote:
Hi Victor,
in case you like to give it a try: version 0.5 of the basic STORM test environment (including a small example written by Stefan) can be downloaded from the following URL: http://wi.wu.ac.at/home/mark/STORM/storm-v.0.5.tar.gz or http://wi.wu.ac.at/home/mark/STORM/storm%2dv%2e0%2e5%2etar%2egz
best regards,
Mark
On Tuesday 26 April 2011 12:40:14 Stefan Sobernig wrote:
Victor,
I am beginning to learn and use test driven development in my projects. I've noticed that NX does not use the standard "tcltest" package in Tcl but instead provides it's own "nx::test". Is there a specific reason for that?
I can't give you the full story, only some observations of mine. To some extent, nx::test and especially its predecessors (xotcl::test) are a legacy:
OTcl had its own testing environment, not using or not building upon tcltest, and so had XOTcl; see e.g. http://otcl-tclcl.cvs.sourceforge.net/viewvc/otcl-tclcl/otcl/lib/test.tcl?vi...
test migration vs. test continuity so is the issue here. also: nx::test & friends have always been used to test core functionality of the language system, rather than application testing. for your XOTcl/nx application, tcltest is certainly a viable option (coming with nice helpers actually missing in nx::test). another answer along these lines is probably that a home-brewed testing evironment is usually one of the first prototype applications written by the language authors in their language.
as for application testing, however, an object-aware testing environment comes handy; you can refine your test suites occasionally through mixins; or nx::test traces object lifecycles during test execution to maintain a prestine testing sandbox to avoid unwanted test interactions. however, that does not mean that you could not realise all of this using tcltest.
some further pointers, especially when it comes to TDD (which is, by the way, something different than merely writing and executing tests in the sense of tcltest or nx::test):
Two or three years ago, I had a look at a xUnit framework for XOTcl: http://xotcllib.cvs.sourceforge.net/viewvc/xotcllib/xounit/
While it gave me a xUnit environment, it found it incomplete and its implementation rather clumsy (including its usage of Exception objects ontop of Tcl's error control flow mechanism).
More recently, Mark published on a scenario-driven approach and prototype framework (STORM) which I successfully used in one or two dev projects of mine. It comes with essentials concepts for applying a test-first development approach:
http://wi.wu-wien.ac.at/home/mark/publications/se2011-extended.pdf
I don't know whether the prototype implementation (the XOTcl script) is publicly available, but you could most certainly talk Mark into providing it to you :)
//stefan
Thanks,
Victor _______________________________________________ Xotcl mailing list Xotcl@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl