@@ -399,6 +399,7 @@ function testGenerate(directory, options, cb) {
399399 var testModule = options . testModule || TEST_MODULES [ 0 ] ;
400400 var assertionFormat = options . assertionFormat || TEST_ASSERTION_TYPES [ 0 ] ;
401401 var overwriteAll = options . force || false ;
402+ var loadTesting = options . loadTest || false ;
402403 directory = directory || process . cwd ( ) ;
403404
404405 findProjectFile ( directory , null , function ( err , projPath ) {
@@ -456,6 +457,17 @@ function testGenerate(directory, options, cb) {
456457 assertionFormat : assertionFormat
457458 } ;
458459
460+ // pass list of paths targeted for load testing
461+ if ( loadTesting ) {
462+ if ( ( typeof loadTesting ) !== 'boolean' && fs . existsSync ( path . join ( directory , loadTesting ) ) ) {
463+ config . loadTest = parseJsonFile ( directory , loadTesting ) . loadTargets ;
464+ } else if ( fs . existsSync ( path . join ( directory , 'load-config.json' ) ) ) {
465+ config . loadTest = parseJsonFile ( directory , 'load-config.json' ) . loadTargets ;
466+ } else {
467+ return cb ( new Error ( 'Config file not found. Please specify a load test config or add load-config.json file to your project directory.' ) ) ;
468+ }
469+ }
470+
459471 var finalResult = template . testGen ( result , config ) ;
460472 var existingFiles = fs . readdirSync ( path . join ( directory , 'test/api/client' ) ) ;
461473 var skipAll = false ;
@@ -528,6 +540,10 @@ function testGenerate(directory, options, cb) {
528540 } ) ;
529541}
530542
543+ function parseJsonFile ( directory , filePath ) {
544+ return JSON . parse ( fs . readFileSync ( path . join ( directory , filePath ) ) ) ;
545+ }
546+
531547function installDependencies ( directory , message , cb ) {
532548 spawn ( 'npm' , [ 'install' ] , directory , function ( err ) {
533549 if ( err ) {
0 commit comments