-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for parallel test cases and example implementation
- Loading branch information
1 parent
cd60831
commit e72ec5c
Showing
5 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/src/main/java/resource/component/org/lucee/cfml/test/LuceeTestCaseParallel.cfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
component extends="org.lucee.cfml.test.LuceeTestCase" { | ||
|
||
|
||
private function parallel(title, threadCount=1, repetitition=1, body) { | ||
if(arguments.threadcount<1 || arguments.threadcount>1000) { | ||
throw "thread count need to be a number between 1 and 1000, now it is [#arguments.threadcount#]"; | ||
} | ||
if(arguments.repetitition<1 || arguments.repetitition>1000) { | ||
throw "repetitition need to be a number between 1 and 1000, now it is [#arguments.repetitition#]"; | ||
} | ||
if(arguments.threadcount==1 || arguments.repetitition==1) { | ||
throw "repetitition or thread count need to be bigger than 1"; | ||
} | ||
var prefix=createUniqueID(); | ||
var exceptions = []; | ||
for (var i = 1; i <= arguments.repetitition; i++) { | ||
var names = []; | ||
for (var y = 1; y <= arguments.threadcount; y++) { | ||
var name="testThread-#prefix#:#i#:#y#"; | ||
arrayAppend(names, name); | ||
thread action="run" name=name title=arguments.title body=arguments.body exceptions=exceptions { | ||
try { | ||
it(title,body); | ||
} | ||
catch(e) { | ||
arrayAppend(exceptions, e); | ||
} | ||
} | ||
} | ||
thread action="join" name=arrayToList(names); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters