-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from DurieuxPol/feat/testFilter
Implemented test filters
- Loading branch information
Showing
10 changed files
with
204 additions
and
3 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
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,13 @@ | ||
Class { | ||
#name : 'MTFreeTestFilter', | ||
#superclass : 'MTTestFilter', | ||
#category : 'MuTalk-Model-Test filters', | ||
#package : 'MuTalk-Model', | ||
#tag : 'Test filters' | ||
} | ||
|
||
{ #category : 'enumerating' } | ||
MTFreeTestFilter >> filterTests: aTestCaseCollection [ | ||
|
||
^ aTestCaseCollection | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Class { | ||
#name : 'MTTestFilter', | ||
#superclass : 'Object', | ||
#instVars : [ | ||
'condition' | ||
], | ||
#category : 'MuTalk-Model-Test filters', | ||
#package : 'MuTalk-Model', | ||
#tag : 'Test filters' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
MTTestFilter class >> for: aCondition [ | ||
|
||
^ self new | ||
condition: aCondition; | ||
yourself | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MTTestFilter >> condition [ | ||
|
||
^ condition | ||
] | ||
|
||
{ #category : 'accessing' } | ||
MTTestFilter >> condition: aCondition [ | ||
|
||
condition := aCondition | ||
] | ||
|
||
{ #category : 'enumerating' } | ||
MTTestFilter >> filterTests: aTestCaseCollection [ | ||
|
||
^ self subclassResponsibility | ||
] |
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,14 @@ | ||
Class { | ||
#name : 'MTTimeTestFilter', | ||
#superclass : 'MTTestFilter', | ||
#category : 'MuTalk-Model-Test filters', | ||
#package : 'MuTalk-Model', | ||
#tag : 'Test filters' | ||
} | ||
|
||
{ #category : 'enumerating' } | ||
MTTimeTestFilter >> filterTests: aTestCaseCollection [ | ||
|
||
^ aTestCaseCollection select: [ :testCaseReference | | ||
testCaseReference lastTimeToRun <= condition ] | ||
] |
12 changes: 12 additions & 0 deletions
12
src/MuTalk-TestResources/MTAuxiliarClassForTimeTestFilter.class.st
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,12 @@ | ||
Class { | ||
#name : 'MTAuxiliarClassForTimeTestFilter', | ||
#superclass : 'Object', | ||
#category : 'MuTalk-TestResources', | ||
#package : 'MuTalk-TestResources' | ||
} | ||
|
||
{ #category : 'accessing' } | ||
MTAuxiliarClassForTimeTestFilter >> simpleMethod [ | ||
|
||
^ 1 + 1 | ||
] |
18 changes: 18 additions & 0 deletions
18
src/MuTalk-TestResources/MTAuxiliarClassForTimeTestFilterTest.class.st
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,18 @@ | ||
Class { | ||
#name : 'MTAuxiliarClassForTimeTestFilterTest', | ||
#superclass : 'TestCase', | ||
#category : 'MuTalk-TestResources', | ||
#package : 'MuTalk-TestResources' | ||
} | ||
|
||
{ #category : 'tests' } | ||
MTAuxiliarClassForTimeTestFilterTest >> test10Milliseconds [ | ||
|
||
10 milliSeconds wait | ||
] | ||
|
||
{ #category : 'tests' } | ||
MTAuxiliarClassForTimeTestFilterTest >> test1Second [ | ||
|
||
1 second wait | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Class { | ||
#name : 'MTTestFilterTest', | ||
#superclass : 'TestCase', | ||
#instVars : [ | ||
'analysis' | ||
], | ||
#category : 'MuTalk-Tests', | ||
#package : 'MuTalk-Tests' | ||
} | ||
|
||
{ #category : 'testing' } | ||
MTTestFilterTest class >> isAbstract [ | ||
|
||
^ self == MTTestFilterTest | ||
] | ||
|
||
{ #category : 'running' } | ||
MTTestFilterTest >> runAnalysisWithFilter: aTestFilter on: classesToMutate withTests: testCases [ | ||
|
||
analysis := MTAnalysis new | ||
testClasses: testCases; | ||
classesToMutate: classesToMutate; | ||
testFilter: aTestFilter. | ||
|
||
analysis run | ||
] |
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,52 @@ | ||
Class { | ||
#name : 'MTTimeTestFilterTest', | ||
#superclass : 'MTTestFilterTest', | ||
#category : 'MuTalk-Tests', | ||
#package : 'MuTalk-Tests' | ||
} | ||
|
||
{ #category : 'running' } | ||
MTTimeTestFilterTest >> runAnalysisForTimeCondition: aDuration [ | ||
|
||
self | ||
runAnalysisWithFilter: (MTTimeTestFilter for: aDuration) | ||
on: { MTAuxiliarClassForTimeTestFilter } | ||
withTests: { MTAuxiliarClassForTimeTestFilterTest } | ||
] | ||
|
||
{ #category : 'running' } | ||
MTTimeTestFilterTest >> testWith10MillisecondsCondition [ | ||
|
||
| testCaseReference | | ||
testCaseReference := MTTestCaseReference | ||
for: #test10Milliseconds | ||
in: MTAuxiliarClassForTimeTestFilterTest. | ||
self runAnalysisForTimeCondition: | ||
(self timeToRunFor: testCaseReference) * 10. | ||
|
||
self | ||
assert: (analysis generalResult particularResults at: 1) runCount | ||
equals: 1 | ||
] | ||
|
||
{ #category : 'running' } | ||
MTTimeTestFilterTest >> testWith1SecondCondition [ | ||
|
||
| testCaseReference | | ||
testCaseReference := MTTestCaseReference | ||
for: #test1Second | ||
in: MTAuxiliarClassForTimeTestFilterTest. | ||
self runAnalysisForTimeCondition: | ||
(self timeToRunFor: testCaseReference) * 10. | ||
|
||
self | ||
assert: (analysis generalResult particularResults at: 1) runCount | ||
equals: 2 | ||
] | ||
|
||
{ #category : 'running' } | ||
MTTimeTestFilterTest >> timeToRunFor: aTestCaseReference [ | ||
|
||
aTestCaseReference runUnchecked. | ||
^ aTestCaseReference lastTimeToRun | ||
] |