tobijk / caius

A functional testing framework in object-oriented Tcl
MIT License
26 stars 5 forks source link

RFE - ability to run only tests that match a pattern #8

Closed apnadkarni closed 9 years ago

apnadkarni commented 9 years ago

The tcltest package that is part of the Tcl core has the -match command line option that permits specification of a pattern. If specified, only tests whose names match the pattern are executed. This is very useful during development when (for example) enhancing a module feature and running the entire tests suite for the module is time consuming.

A similar capability for Caius where one could specify a pattern for the module and for the tests within the module would be useful.

tobijk commented 9 years ago

At least for filtering tests inside a module, I would be able to do some thing like this in my Linux shell:

./mytests.tcl -l | egrep <regexp> | while read test; do ./mytest.tcl $test; done

Do you think both caius runplan and TestObject::run should have a way to filter?

apnadkarni commented 9 years ago

For some reason, I completely missed that you could enumerate tests on the command line though it is clearly spelt out in the documentation! So the feature is not as important as I had thought.

Having said that, I think it might be a simple matter to treat the passed arguments on the command line as test patterns instead of test name constants so one could say

./mytests.tcl *file* *socket*

to run all tests with "file" or "socket" in them. When test modules involve significant setup (e.g. in one of my cases, I have to load up Active Directory with a tens of thousands of objects) this would be a time-saver compared to the shell based solution.

Personally, I don't see a big need for runplan to support filtering.

/Ashok

tobijk commented 9 years ago

Released in 0.13.0.