src/run.js
/**
 * Execute all functions in class Action. 
 * - Functions will be ignored if the name starts with '_'
 * - constructor() will be ignored
 */
Execute all functions in class Action.
- Functions will be ignored if the name starts with '_'
- constructor() will be ignored
Execute all functions in class Action . - Functions will be ignored if the name starts with ' _ ' - constructor () will be ignored
async function callUserScenario(userId, iterationNum){
    let action = new Action()
    action.userId = userId
    action.iterationNum = iterationNum
    const funcNameLst = Object.getOwnPropertyNames(Action.prototype)
    for (let i = 0; i < funcNameLst.length; i++){
        let funcName = funcNameLst[i]
        if ( funcName == 'constructor' || funcName[0] == '_' ){
        }
        else{
            await action[funcName]()
        }
    }
}
async function callUserScenario ( userId , iterationNum ) { let action = new Action ( ) action . userId = userId action . iterationNum = iterationNum const funcNameLst = Object . getOwnPropertyNames ( Action . prototype ) for ( let i = 0 ; i < funcNameLst . length ; i ++ ) { let funcName = funcNameLst [ i ] if ( funcName == 'constructor' || funcName [ 0 ] == '_' ) { } else { await action [ funcName ] ( ) } } }
Execute all functions in class Action.
Execute all functions in class Action .
// create action instance // get all functions' name // pass // invoke the function