rahu28 / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

Add support for data providers #160

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I would like to be able to add support for data providers, like the ones 
PHPUnit provides:

http://www.phpunit.de/manual/3.4/en/writing-tests-for-phpunit.html#writing-tests
-for-phpunit.data-providers

For now I'm using this helper for the job:

function DataProvider(func,args,bind){
    return function(){
       for (var i = args.length-1; i>=0; i--) func.apply(bind,args[i]);    
    };       
}

TestCase("A test",{
 "test data provider" : DataProvider(
       function(a,b){assertEquals(a,b)}
       , [ [1,2] , [2,2] , [3,3] ]
 });
);

but it doesn't run setUp and tearDown for each run. It also stops once one of 
the data provided fails, which misses the point.

Original issue reported on code.google.com by arieh.glazer on 8 Nov 2010 at 8:31