>> Classes, however, should follow LSP, so tests a base class should pass
>> the derived class should pass too.

Philipp Meier wrote:

> How should Truck pass CarTest? Or should TruckTest inherite from CarTest
> and override test_wheels? Would this be according to LSP?

LSP means the caller (in this case the test engine) can't tell we called 
one test or another. That's fine because tests should not push side-effects 
into the engine.

LSP in the tested classes means they should not surprise their callers. Not 
that they always have the same wheel count. For the above situation...


class Car
        def wheels
                return 4
        end
end

class Truck
        def wheels
                return 8
        end
end


class VehicleTest
        def test_wheels
                testee = warmUp()
                assert_equal ( myWheelCount(), testee.wheels() )
        end
end

class CarTest < VehicleTest
        def warmUp()
                @testee = Car.new()
                return @testee
        end

        def myWheelCount
                return 4
        end
end


class TruckTest < VehicleTest
        def warmUp()
                @testee = Truck.new()
                return @testee
        end

        def myWheelCount
                return 8
        end
end

Now push CarTest and TruckTest, but not VehicleTest, into the test suite.

Thanks for helping me create a concrete example.

-- 
  Phlip
       http://www.greencheese.org/LucidScheming
  --  All sensors report Patti having a very good time  --