From Test::Simple to Test::Extreme - Get The Most Out of Your Tests 21

Skip Tests - Don't Let Them Fail!

  • For tests that are supposed to fail, either:

  • comment them out

        # ok_isa(DBI->connect($connect_string), 'DBI' 'DB logging'); # Damn DB Logging never works
    
  • use a skip block:

        use Test::More;
    
        skip {
            ok_isa(DBI->connect($connect_string), 'DBI' 'DB logging'),
        } 1, "DB Logging never works
    
  • use a todo block:

        use Test::More;
    
        todo {
            ok_isa(DBI->connect($connect_string), 'DBI' 'DB logging'),
        } 1, "This will work when we install DBI
    

 

YAPC::CA << Previous | Index | Next >>
Copyright © 2003 Michael Graham