RSpec, TestUnit, Cucumber and Autotest

OS=CentOS-5.2
Ruby=1.8.6
Rails=2.2.1_RC
Gems all up to date

I have been experimenting with autotest and I have a few questions.

  1. given export AUTOFEATURES=TRUE if ./test exists (with tests) then
    these tests are run and the features are not. Is this intended
    behaviour?

  2. given require ‘autotest/redgreen’ in .autotest if /test tests are run
    then all I get colourized is a line of ‘======’ but if /test is removed
    and features run then the Failed message and the backtrace are
    colourized. Is this intentional as well?

James B. wrote:

Try doing TRUE in all lowercase.

-Ben

Ben M. wrote:

James B. wrote:

Try doing TRUE in all lowercase.

-Ben

$ set
AUTOFEATURE=true
BASH=/bin/bash

James B. wrote:

OS=CentOS-5.2
Ruby=1.8.6
Rails=2.2.1_RC
Gems all up to date

I have been experimenting with autotest and I have a few questions.

  1. given: export AUTOFEATURES=true, if ./test exists (with tests) then
    these tests are run and the features are not. Is this intended
    behaviour?

I have investigated further and the situation is this. If all the
unit/functional tests under ~/test pass then, and only then, cucumber
feature tests are run. If any unit/functional tests fail then cucumber
is not invoked. It is not immediately clear to me whether this
behaviour is intended or not. Can someone provide the answer?

On Thu, Nov 20, 2008 at 11:55 AM, Ben M. [email protected] wrote:

James B. wrote:

It is not immediately clear to me whether this behaviour is
intended or not. Can someone provide the answer?

After reading the wiki I think what you are seeing is the expected
behaviour. I don’t think it is suppose to run the features until all your
tests are passing.

Yes, that’s the intended behavior. According to that workflow, if
you’ve got unit tests failing, that’s what you should be working on.

In RSpec, if you have failing examples which you don’t actually want
to deal with yet, you can make them pending, and Autotest will ignore
the fact that they’re not working. I don’t think Test::Unit provides
an equivalent feature, though.

Peter

James B. wrote:

these tests are run and the features are not. Is this intended
behaviour?

I have investigated further and the situation is this. If all the
unit/functional tests under ~/test pass then, and only then, cucumber
feature tests are run. If any unit/functional tests fail then cucumber
is not invoked. It is not immediately clear to me whether this
behaviour is intended or not. Can someone provide the answer?

Ahh… I didn’t notice that you said you were using TestUnit. Sorry
about not catching on sooner… The cucumber autotest integration was
developed with autospec and rspec in mind. I wouldn’t be surprised if
it never was tested with testunit so it might have some rough edges.
Peter J., the one who wrote the plugin, explained how the plugin is
suppose to work/behave in the wiki:

(under ‘What does it do?’)

After reading the wiki I think what you are seeing is the expected
behaviour. I don’t think it is suppose to run the features until all
your tests are passing.

-Ben

Peter J. wrote:

In RSpec, if you have failing examples which you don’t actually want
to deal with yet, you can make them pending, and Autotest will ignore
the fact that they’re not working. I don’t think Test::Unit provides
an equivalent feature, though.

Peter

Yes, and no. You can emulate a pending test by creating an empty
method:

def test_should_show_me
#TODO Pending
end

As you imply, this will not show in the test run output. It does show
up with the rake notes task though:

$ rake notes
(in ~/Software/Development/Projects/proforma.git)
test/functional/clients_controller_test.rb:

  • [ 33] [TODO] Pending