AssetItemIterator it = item.listAssetsByFormat( new String[]{AssetFormats.TEST_SCENARIO} );
List<ScenarioResultSummary> resultSummaries = new ArrayList<ScenarioResultSummary>();
RuleBase rb = ruleBaseCache.get( item.getUUID() );
Package bin = rb.getPackages()[0];
RuleCoverageListener coverage = new RuleCoverageListener( expectedRules( bin ) );
while ( it.hasNext() ) {
AssetItem as = it.next();
if ( !as.getDisabled() ) {
RuleAsset asset = loadAsset( as );
Scenario sc = (Scenario) asset.content;
runScenario( item.getName(),
sc,
coverage );//runScenario(sc, res, workingMemory).scenario;
int[] totals = sc.countFailuresTotal();
resultSummaries.add( new ScenarioResultSummary( totals[0],
totals[1],
asset.metaData.name,
asset.metaData.description,
asset.uuid ) );
}
}
ScenarioResultSummary[] summaries = resultSummaries.toArray( new ScenarioResultSummary[resultSummaries.size()] );
BulkTestRunResult result = new BulkTestRunResult( null,
resultSummaries.toArray( summaries ),
coverage.getPercentCovered(),
coverage.getUnfiredRules() );
return result;
} finally {
Thread.currentThread().setContextClassLoader( originalCL );
}