diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTAct.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTAct.extension.st index 2086269..51c54aa 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTAct.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTAct.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixUTAct } +Extension { #name : 'FamixUTAct' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTAct >> mooseNameOn: aStream [ aStream nextPutAll: 'Act'. diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTActArgument.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTActArgument.extension.st new file mode 100644 index 0000000..94b72fa --- /dev/null +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTActArgument.extension.st @@ -0,0 +1,14 @@ +Extension { #name : 'FamixUTActArgument' } + +{ #category : '*Famix-UnitTest-Entities-Extensions' } +FamixUTActArgument >> mooseNameOn: aStream [ + + aStream nextPutAll: 'Argument'. + self value ifNotNil: [ :value | + aStream nextPut: $(. + value mooseNameOn: aStream. + aStream nextPut: $) ]. + act ifNotNil: [ + aStream nextPutAll: ' of '. + act mooseNameOn: aStream ] +] diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTAssertion.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTAssertion.extension.st index 5241313..3f5e8cf 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTAssertion.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTAssertion.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixUTAssertion } +Extension { #name : 'FamixUTAssertion' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTAssertion >> mooseNameOn: aStream [ aStream nextPutAll: 'Assertion'. diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTCase.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTCase.extension.st index 81b8b9d..defccdd 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTCase.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTCase.extension.st @@ -1,12 +1,12 @@ -Extension { #name : #FamixUTCase } +Extension { #name : 'FamixUTCase' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTCase >> mooseNameOn: aStream [ aStream nextPutAll: self name ] -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTCase >> name [ ^ self testedClass name diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTEntity.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTEntity.extension.st index 0021b0c..2868895 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTEntity.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTEntity.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixUTEntity } +Extension { #name : 'FamixUTEntity' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTEntity >> mooseNameOn: aStream [ self subclassResponsibility diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTFixture.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTFixture.extension.st index e0e96ef..fd35dad 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTFixture.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTFixture.extension.st @@ -1,24 +1,24 @@ -Extension { #name : #FamixUTFixture } +Extension { #name : 'FamixUTFixture' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTFixture >> forAllInCase [ self subclassResponsibility ] -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTFixture >> forEachInCase [ self subclassResponsibility ] -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTFixture >> method [ self subclassResponsibility ] -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTFixture >> mooseNameOn: aStream [ self suite ifNotNil: [ :suite | @@ -35,7 +35,7 @@ FamixUTFixture >> mooseNameOn: aStream [ method mooseNameOn: aStream ] ] -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTFixture >> suite [ self subclassResponsibility diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTMethod.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTMethod.extension.st index 5a2149f..86a2442 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTMethod.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTMethod.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixUTMethod } +Extension { #name : 'FamixUTMethod' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTMethod >> name [ ^ name ifNil: [ diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTSetUp.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTSetUp.extension.st index fb0885a..b7edf38 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTSetUp.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTSetUp.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixUTSetUp } +Extension { #name : 'FamixUTSetUp' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTSetUp >> mooseNameOn: aStream [ aStream nextPutAll: 'SetUp'. diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTSuite.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTSuite.extension.st index 7882291..b261870 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTSuite.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTSuite.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixUTSuite } +Extension { #name : 'FamixUTSuite' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTSuite >> mooseNameOn: aStream [ diff --git a/src/Famix-UnitTest-Entities-Extensions/FamixUTTearDown.extension.st b/src/Famix-UnitTest-Entities-Extensions/FamixUTTearDown.extension.st index 051030b..e797bb6 100644 --- a/src/Famix-UnitTest-Entities-Extensions/FamixUTTearDown.extension.st +++ b/src/Famix-UnitTest-Entities-Extensions/FamixUTTearDown.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixUTTearDown } +Extension { #name : 'FamixUTTearDown' } -{ #category : #'*Famix-UnitTest-Entities-Extensions' } +{ #category : '*Famix-UnitTest-Entities-Extensions' } FamixUTTearDown >> mooseNameOn: aStream [ aStream nextPutAll: 'TearDown'. diff --git a/src/Famix-UnitTest-Entities-Extensions/package.st b/src/Famix-UnitTest-Entities-Extensions/package.st index f3ce630..38a546d 100644 --- a/src/Famix-UnitTest-Entities-Extensions/package.st +++ b/src/Famix-UnitTest-Entities-Extensions/package.st @@ -1 +1 @@ -Package { #name : #'Famix-UnitTest-Entities-Extensions' } +Package { #name : 'Famix-UnitTest-Entities-Extensions' } diff --git a/src/Famix-UnitTest-Entities/FamixTMethod.extension.st b/src/Famix-UnitTest-Entities/FamixTMethod.extension.st index efe2be3..ca364be 100644 --- a/src/Famix-UnitTest-Entities/FamixTMethod.extension.st +++ b/src/Famix-UnitTest-Entities/FamixTMethod.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixTMethod } +Extension { #name : 'FamixTMethod' } -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixTMethod >> unitTests [ "Relation named: #unitTests type: #FamixUTMethod opposite: #testedMethod" @@ -11,7 +11,7 @@ FamixTMethod >> unitTests [ ^ self attributeAt: #unitTests ifAbsentPut: [ FMMultivalueLink on: self opposite: #testedMethod: ] ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixTMethod >> unitTests: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixTClass.extension.st b/src/Famix-UnitTest-Entities/FamixTType.extension.st similarity index 74% rename from src/Famix-UnitTest-Entities/FamixTClass.extension.st rename to src/Famix-UnitTest-Entities/FamixTType.extension.st index ba29cf9..b8e2552 100644 --- a/src/Famix-UnitTest-Entities/FamixTClass.extension.st +++ b/src/Famix-UnitTest-Entities/FamixTType.extension.st @@ -1,7 +1,7 @@ -Extension { #name : #FamixTClass } +Extension { #name : 'FamixTType' } -{ #category : #'*Famix-UnitTest-Entities-accessing' } -FamixTClass >> testCase [ +{ #category : '*Famix-UnitTest-Entities-accessing' } +FamixTType >> testCase [ "Relation named: #testCase type: #FamixUTCase opposite: #testedClass" @@ -11,8 +11,8 @@ FamixTClass >> testCase [ ^ self attributeAt: #testCase ifAbsent: [ nil ] ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } -FamixTClass >> testCase: anObject [ +{ #category : '*Famix-UnitTest-Entities-accessing' } +FamixTType >> testCase: anObject [ (self attributeAt: #testCase ifAbsentPut: [nil]) == anObject ifTrue: [ ^ anObject ]. diff --git a/src/Famix-UnitTest-Entities/FamixUTAct.class.st b/src/Famix-UnitTest-Entities/FamixUTAct.class.st index cc11aca..b998c62 100644 --- a/src/Famix-UnitTest-Entities/FamixUTAct.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTAct.class.st @@ -19,16 +19,18 @@ Execution of the system under test. " Class { - #name : #FamixUTAct, - #superclass : #FamixUTEntity, + #name : 'FamixUTAct', + #superclass : 'FamixUTEntity', #instVars : [ '#arguments => FMMany type: #FamixUTActArgument opposite: #act', '#method => FMOne type: #FamixUTMethod opposite: #act' ], - #category : #'Famix-UnitTest-Entities-Entities' + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTAct class >> annotation [ @@ -37,13 +39,13 @@ FamixUTAct class >> annotation [ ^ self ] -{ #category : #adding } +{ #category : 'adding' } FamixUTAct >> addArgument: anObject [ ^ self arguments add: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAct >> arguments [ "Relation named: #arguments type: #FamixUTActArgument opposite: #act" @@ -52,14 +54,14 @@ FamixUTAct >> arguments [ ^ arguments ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAct >> arguments: anObject [ arguments value: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAct >> method [ "Relation named: #method type: #FamixUTMethod opposite: #act" @@ -69,21 +71,21 @@ FamixUTAct >> method [ ^ method ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAct >> method: anObject [ method := anObject ] -{ #category : #navigation } +{ #category : 'navigation' } FamixUTAct >> methodGroup [ ^ MooseSpecializedGroup with: self method ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAct >> receiver [ "Relation named: #receiver type: #FamixValueOfType opposite: #receiverInAct" @@ -92,7 +94,7 @@ FamixUTAct >> receiver [ ^ self attributeAt: #receiver ifAbsent: [ nil ] ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAct >> receiver: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixUTActArgument.class.st b/src/Famix-UnitTest-Entities/FamixUTActArgument.class.st index d8ab93c..6d0459c 100644 --- a/src/Famix-UnitTest-Entities/FamixUTActArgument.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTActArgument.class.st @@ -14,15 +14,17 @@ An association between an `Act` and a `Value` argument. " Class { - #name : #FamixUTActArgument, - #superclass : #FamixUTEntity, + #name : 'FamixUTActArgument', + #superclass : 'FamixUTEntity', #instVars : [ '#act => FMOne type: #FamixUTAct opposite: #arguments' ], - #category : #'Famix-UnitTest-Entities-Entities' + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTActArgument class >> annotation [ @@ -31,7 +33,7 @@ FamixUTActArgument class >> annotation [ ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTActArgument >> act [ "Relation named: #act type: #FamixUTAct opposite: #arguments" @@ -39,14 +41,14 @@ FamixUTActArgument >> act [ ^ act ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTActArgument >> act: anObject [ act := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTActArgument >> value [ "Relation named: #value type: #FamixValueOfType opposite: #argumentInActs" @@ -55,7 +57,7 @@ FamixUTActArgument >> value [ ^ self attributeAt: #value ifAbsent: [ nil ] ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTActArgument >> value: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixUTAssertion.class.st b/src/Famix-UnitTest-Entities/FamixUTAssertion.class.st index f3d81d4..bf1b9ad 100644 --- a/src/Famix-UnitTest-Entities/FamixUTAssertion.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTAssertion.class.st @@ -24,16 +24,18 @@ Verifies that the behavior or feature being tested behaves as expected. " Class { - #name : #FamixUTAssertion, - #superclass : #FamixUTEntity, + #name : 'FamixUTAssertion', + #superclass : 'FamixUTEntity', #instVars : [ '#errorMargin => FMProperty', '#method => FMOne type: #FamixUTMethod opposite: #assertions' ], - #category : #'Famix-UnitTest-Entities-Entities' + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTAssertion class >> annotation [ @@ -42,7 +44,7 @@ FamixUTAssertion class >> annotation [ ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAssertion >> errorMargin [ @@ -51,13 +53,13 @@ FamixUTAssertion >> errorMargin [ ^ errorMargin ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAssertion >> errorMargin: anObject [ errorMargin := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAssertion >> expected [ "Relation named: #expected type: #FamixValueOfType opposite: #expectedInAssertions" @@ -66,14 +68,14 @@ FamixUTAssertion >> expected [ ^ self attributeAt: #expected ifAbsent: [ nil ] ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAssertion >> expected: anObject [ self attributeAt: #expected put: (FMMultivalueLink on: self update: #expectedInAssertions from: self expected to: anObject). ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAssertion >> method [ "Relation named: #method type: #FamixUTMethod opposite: #assertions" @@ -82,14 +84,14 @@ FamixUTAssertion >> method [ ^ method ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTAssertion >> method: anObject [ method := anObject ] -{ #category : #navigation } +{ #category : 'navigation' } FamixUTAssertion >> methodGroup [ diff --git a/src/Famix-UnitTest-Entities/FamixUTCase.class.st b/src/Famix-UnitTest-Entities/FamixUTCase.class.st index ff7d834..5d79e74 100644 --- a/src/Famix-UnitTest-Entities/FamixUTCase.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTCase.class.st @@ -21,14 +21,14 @@ A class containing test methods. | `afterEach` | `FamixUTCase` | `forEachInCase` | `FamixUTTearDown` | | | `beforeAll` | `FamixUTCase` | `forAllInCase` | `FamixUTSetUp` | | | `beforeEach` | `FamixUTCase` | `forEachInCase` | `FamixUTSetUp` | | -| `testedClass` | `FamixUTCase` | `testCase` | `FamixTClass` | | +| `testedClass` | `FamixUTCase` | `testCase` | `FamixTType` | | " Class { - #name : #FamixUTCase, - #superclass : #FamixUTEntity, + #name : 'FamixUTCase', + #superclass : 'FamixUTEntity', #instVars : [ '#afterAll => FMOne type: #FamixUTTearDown opposite: #forAllInCase', '#afterEach => FMOne type: #FamixUTTearDown opposite: #forEachInCase', @@ -37,10 +37,12 @@ Class { '#methods => FMMany type: #FamixUTMethod opposite: #case', '#suite => FMOne type: #FamixUTSuite opposite: #cases' ], - #category : #'Famix-UnitTest-Entities-Entities' + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTCase class >> annotation [ @@ -49,13 +51,13 @@ FamixUTCase class >> annotation [ ^ self ] -{ #category : #adding } +{ #category : 'adding' } FamixUTCase >> addMethod: anObject [ ^ self methods add: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> afterAll [ "Relation named: #afterAll type: #FamixUTTearDown opposite: #forAllInCase" @@ -63,14 +65,14 @@ FamixUTCase >> afterAll [ ^ afterAll ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> afterAll: anObject [ afterAll := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> afterEach [ "Relation named: #afterEach type: #FamixUTTearDown opposite: #forEachInCase" @@ -78,14 +80,14 @@ FamixUTCase >> afterEach [ ^ afterEach ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> afterEach: anObject [ afterEach := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> beforeAll [ "Relation named: #beforeAll type: #FamixUTSetUp opposite: #forAllInCase" @@ -93,14 +95,14 @@ FamixUTCase >> beforeAll [ ^ beforeAll ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> beforeAll: anObject [ beforeAll := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> beforeEach [ "Relation named: #beforeEach type: #FamixUTSetUp opposite: #forEachInCase" @@ -108,14 +110,14 @@ FamixUTCase >> beforeEach [ ^ beforeEach ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> beforeEach: anObject [ beforeEach := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> methods [ "Relation named: #methods type: #FamixUTMethod opposite: #case" @@ -124,21 +126,21 @@ FamixUTCase >> methods [ ^ methods ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> methods: anObject [ methods value: anObject ] -{ #category : #navigation } +{ #category : 'navigation' } FamixUTCase >> methodsGroup [ ^ MooseSpecializedGroup withAll: self methods asSet ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> suite [ "Relation named: #suite type: #FamixUTSuite opposite: #cases" @@ -147,30 +149,30 @@ FamixUTCase >> suite [ ^ suite ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> suite: anObject [ suite := anObject ] -{ #category : #navigation } +{ #category : 'navigation' } FamixUTCase >> suiteGroup [ ^ MooseSpecializedGroup with: self suite ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> testedClass [ - "Relation named: #testedClass type: #FamixTClass opposite: #testCase" + "Relation named: #testedClass type: #FamixTType opposite: #testCase" - + ^ self attributeAt: #testedClass ifAbsent: [ nil ] ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTCase >> testedClass: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixUTEntity.class.st b/src/Famix-UnitTest-Entities/FamixUTEntity.class.st index 46d53ab..b63e62b 100644 --- a/src/Famix-UnitTest-Entities/FamixUTEntity.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTEntity.class.st @@ -1,10 +1,12 @@ Class { - #name : #FamixUTEntity, - #superclass : #MooseEntity, - #category : #'Famix-UnitTest-Entities-Entities' + #name : 'FamixUTEntity', + #superclass : 'MooseEntity', + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTEntity class >> annotation [ @@ -14,14 +16,14 @@ FamixUTEntity class >> annotation [ ^ self ] -{ #category : #testing } +{ #category : 'testing' } FamixUTEntity class >> isAbstract [ ^ self == FamixUTEntity ] -{ #category : #meta } +{ #category : 'meta' } FamixUTEntity class >> metamodel [ diff --git a/src/Famix-UnitTest-Entities/FamixUTFixture.class.st b/src/Famix-UnitTest-Entities/FamixUTFixture.class.st index 3bb038e..e3ada39 100644 --- a/src/Famix-UnitTest-Entities/FamixUTFixture.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTFixture.class.st @@ -13,12 +13,14 @@ Sets up or tears down the system to make tests repeatable. " Class { - #name : #FamixUTFixture, - #superclass : #FamixUTEntity, - #category : #'Famix-UnitTest-Entities-Entities' + #name : 'FamixUTFixture', + #superclass : 'FamixUTEntity', + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTFixture class >> annotation [ @@ -28,20 +30,20 @@ FamixUTFixture class >> annotation [ ^ self ] -{ #category : #testing } +{ #category : 'testing' } FamixUTFixture class >> isAbstract [ ^ self == FamixUTFixture ] -{ #category : #adding } +{ #category : 'adding' } FamixUTFixture >> addValue: anObject [ ^ self values add: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTFixture >> values [ "Relation named: #values type: #FamixValueOfType opposite: #fixtures" @@ -51,7 +53,7 @@ FamixUTFixture >> values [ ^ self attributeAt: #values ifAbsentPut: [ FMMultiMultivalueLink on: self opposite: #fixtures ] ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTFixture >> values: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixUTMethod.class.st b/src/Famix-UnitTest-Entities/FamixUTMethod.class.st index 5f99473..5d13f40 100644 --- a/src/Famix-UnitTest-Entities/FamixUTMethod.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTMethod.class.st @@ -32,8 +32,8 @@ Tests a specific behavior or feature of the system under test. " Class { - #name : #FamixUTMethod, - #superclass : #FamixUTEntity, + #name : 'FamixUTMethod', + #superclass : 'FamixUTEntity', #traits : 'FamixTNamedEntity', #classTraits : 'FamixTNamedEntity classTrait', #instVars : [ @@ -43,10 +43,12 @@ Class { '#setUp => FMOne type: #FamixUTSetUp opposite: #method', '#tearDown => FMOne type: #FamixUTTearDown opposite: #method' ], - #category : #'Famix-UnitTest-Entities-Entities' + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTMethod class >> annotation [ @@ -55,7 +57,7 @@ FamixUTMethod class >> annotation [ ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> act [ "Relation named: #act type: #FamixUTAct opposite: #method" @@ -63,27 +65,27 @@ FamixUTMethod >> act [ ^ act ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> act: anObject [ act := anObject ] -{ #category : #navigation } +{ #category : 'navigation' } FamixUTMethod >> actGroup [ ^ MooseSpecializedGroup with: self act ] -{ #category : #adding } +{ #category : 'adding' } FamixUTMethod >> addAssertion: anObject [ ^ self assertions add: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> assertions [ "Relation named: #assertions type: #FamixUTAssertion opposite: #method" @@ -92,21 +94,21 @@ FamixUTMethod >> assertions [ ^ assertions ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> assertions: anObject [ assertions value: anObject ] -{ #category : #navigation } +{ #category : 'navigation' } FamixUTMethod >> assertionsGroup [ ^ MooseSpecializedGroup withAll: self assertions asSet ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> case [ "Relation named: #case type: #FamixUTCase opposite: #methods" @@ -115,21 +117,21 @@ FamixUTMethod >> case [ ^ case ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> case: anObject [ case := anObject ] -{ #category : #navigation } +{ #category : 'navigation' } FamixUTMethod >> caseGroup [ ^ MooseSpecializedGroup with: self case ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> setUp [ "Relation named: #setUp type: #FamixUTSetUp opposite: #method" @@ -137,14 +139,14 @@ FamixUTMethod >> setUp [ ^ setUp ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> setUp: anObject [ setUp := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> tearDown [ "Relation named: #tearDown type: #FamixUTTearDown opposite: #method" @@ -152,14 +154,14 @@ FamixUTMethod >> tearDown [ ^ tearDown ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> tearDown: anObject [ tearDown := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> testedMethod [ "Relation named: #testedMethod type: #FamixTMethod opposite: #unitTests" @@ -168,7 +170,7 @@ FamixUTMethod >> testedMethod [ ^ self attributeAt: #testedMethod ifAbsent: [ nil ] ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTMethod >> testedMethod: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixUTModel.class.st b/src/Famix-UnitTest-Entities/FamixUTModel.class.st index 4413ee3..236be70 100644 --- a/src/Famix-UnitTest-Entities/FamixUTModel.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTModel.class.st @@ -1,18 +1,20 @@ Class { - #name : #FamixUTModel, - #superclass : #MooseModel, + #name : 'FamixUTModel', + #superclass : 'MooseModel', #traits : 'FamixUTTEntityCreator + FamixValueTEntityCreator', #classTraits : 'FamixUTTEntityCreator classTrait + FamixValueTEntityCreator classTrait', - #category : #'Famix-UnitTest-Entities-Model' + #category : 'Famix-UnitTest-Entities-Model', + #package : 'Famix-UnitTest-Entities', + #tag : 'Model' } -{ #category : #accessing } +{ #category : 'accessing' } FamixUTModel class >> allSubmetamodelsPackagesNames [ ^ #(#'Moose-Query' #'Famix-Value-Entities' #'Famix-Traits') ] -{ #category : #meta } +{ #category : 'meta' } FamixUTModel class >> annotation [ diff --git a/src/Famix-UnitTest-Entities/FamixUTSetUp.class.st b/src/Famix-UnitTest-Entities/FamixUTSetUp.class.st index 5887946..2118aaf 100644 --- a/src/Famix-UnitTest-Entities/FamixUTSetUp.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTSetUp.class.st @@ -16,18 +16,20 @@ Sets up the system to make tests repeatable. " Class { - #name : #FamixUTSetUp, - #superclass : #FamixUTFixture, + #name : 'FamixUTSetUp', + #superclass : 'FamixUTFixture', #instVars : [ '#forAllInCase => FMOne type: #FamixUTCase opposite: #beforeAll', '#forEachInCase => FMOne type: #FamixUTCase opposite: #beforeEach', '#method => FMOne type: #FamixUTMethod opposite: #setUp', '#suite => FMOne type: #FamixUTSuite opposite: #setUp' ], - #category : #'Famix-UnitTest-Entities-Entities' + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTSetUp class >> annotation [ @@ -36,7 +38,7 @@ FamixUTSetUp class >> annotation [ ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSetUp >> forAllInCase [ "Relation named: #forAllInCase type: #FamixUTCase opposite: #beforeAll" @@ -45,14 +47,14 @@ FamixUTSetUp >> forAllInCase [ ^ forAllInCase ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSetUp >> forAllInCase: anObject [ forAllInCase := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSetUp >> forEachInCase [ "Relation named: #forEachInCase type: #FamixUTCase opposite: #beforeEach" @@ -61,14 +63,14 @@ FamixUTSetUp >> forEachInCase [ ^ forEachInCase ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSetUp >> forEachInCase: anObject [ forEachInCase := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSetUp >> method [ "Relation named: #method type: #FamixUTMethod opposite: #setUp" @@ -77,14 +79,14 @@ FamixUTSetUp >> method [ ^ method ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSetUp >> method: anObject [ method := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSetUp >> suite [ "Relation named: #suite type: #FamixUTSuite opposite: #setUp" @@ -93,7 +95,7 @@ FamixUTSetUp >> suite [ ^ suite ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSetUp >> suite: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixUTSuite.class.st b/src/Famix-UnitTest-Entities/FamixUTSuite.class.st index 92bc5c2..c8df28a 100644 --- a/src/Famix-UnitTest-Entities/FamixUTSuite.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTSuite.class.st @@ -25,8 +25,8 @@ A collection of test cases. " Class { - #name : #FamixUTSuite, - #superclass : #FamixUTEntity, + #name : 'FamixUTSuite', + #superclass : 'FamixUTEntity', #traits : 'FamixTNamedEntity', #classTraits : 'FamixTNamedEntity classTrait', #instVars : [ @@ -34,10 +34,12 @@ Class { '#setUp => FMOne type: #FamixUTSetUp opposite: #suite', '#tearDown => FMOne type: #FamixUTTearDown opposite: #suite' ], - #category : #'Famix-UnitTest-Entities-Entities' + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTSuite class >> annotation [ @@ -46,13 +48,13 @@ FamixUTSuite class >> annotation [ ^ self ] -{ #category : #adding } +{ #category : 'adding' } FamixUTSuite >> addCase: anObject [ ^ self cases add: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSuite >> cases [ "Relation named: #cases type: #FamixUTCase opposite: #suite" @@ -61,21 +63,21 @@ FamixUTSuite >> cases [ ^ cases ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSuite >> cases: anObject [ cases value: anObject ] -{ #category : #navigation } +{ #category : 'navigation' } FamixUTSuite >> casesGroup [ ^ MooseSpecializedGroup withAll: self cases asSet ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSuite >> setUp [ "Relation named: #setUp type: #FamixUTSetUp opposite: #suite" @@ -83,14 +85,14 @@ FamixUTSuite >> setUp [ ^ setUp ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSuite >> setUp: anObject [ setUp := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSuite >> tearDown [ "Relation named: #tearDown type: #FamixUTTearDown opposite: #suite" @@ -98,7 +100,7 @@ FamixUTSuite >> tearDown [ ^ tearDown ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTSuite >> tearDown: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixUTTEntityCreator.trait.st b/src/Famix-UnitTest-Entities/FamixUTTEntityCreator.trait.st index b5b8410..dc5cbe4 100644 --- a/src/Famix-UnitTest-Entities/FamixUTTEntityCreator.trait.st +++ b/src/Famix-UnitTest-Entities/FamixUTTEntityCreator.trait.st @@ -5,11 +5,13 @@ It provides an API for creating entities and adding them to the model. " Trait { - #name : #FamixUTTEntityCreator, - #category : #'Famix-UnitTest-Entities-Model' + #name : 'FamixUTTEntityCreator', + #category : 'Famix-UnitTest-Entities-Model', + #package : 'Famix-UnitTest-Entities', + #tag : 'Model' } -{ #category : #meta } +{ #category : 'meta' } FamixUTTEntityCreator classSide >> annotation [ @@ -18,70 +20,70 @@ FamixUTTEntityCreator classSide >> annotation [ ^ self ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newAct [ ^ self add: FamixUTAct new ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newActArgument [ ^ self add: FamixUTActArgument new ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newAssertion [ ^ self add: FamixUTAssertion new ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newCase [ ^ self add: FamixUTCase new ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newMethod [ ^ self add: FamixUTMethod new ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newMethodNamed: aName [ ^ self add: (FamixUTMethod named: aName) ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newSetUp [ ^ self add: FamixUTSetUp new ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newSuite [ ^ self add: FamixUTSuite new ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newSuiteNamed: aName [ ^ self add: (FamixUTSuite named: aName) ] -{ #category : #'entity creation' } +{ #category : 'entity creation' } FamixUTTEntityCreator >> newTearDown [ diff --git a/src/Famix-UnitTest-Entities/FamixUTTearDown.class.st b/src/Famix-UnitTest-Entities/FamixUTTearDown.class.st index c4aa264..340b3e2 100644 --- a/src/Famix-UnitTest-Entities/FamixUTTearDown.class.st +++ b/src/Famix-UnitTest-Entities/FamixUTTearDown.class.st @@ -16,18 +16,20 @@ Tears down the system to make tests repeatable. " Class { - #name : #FamixUTTearDown, - #superclass : #FamixUTFixture, + #name : 'FamixUTTearDown', + #superclass : 'FamixUTFixture', #instVars : [ '#forAllInCase => FMOne type: #FamixUTCase opposite: #afterAll', '#forEachInCase => FMOne type: #FamixUTCase opposite: #afterEach', '#method => FMOne type: #FamixUTMethod opposite: #tearDown', '#suite => FMOne type: #FamixUTSuite opposite: #tearDown' ], - #category : #'Famix-UnitTest-Entities-Entities' + #category : 'Famix-UnitTest-Entities-Entities', + #package : 'Famix-UnitTest-Entities', + #tag : 'Entities' } -{ #category : #meta } +{ #category : 'meta' } FamixUTTearDown class >> annotation [ @@ -36,7 +38,7 @@ FamixUTTearDown class >> annotation [ ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTTearDown >> forAllInCase [ "Relation named: #forAllInCase type: #FamixUTCase opposite: #afterAll" @@ -45,14 +47,14 @@ FamixUTTearDown >> forAllInCase [ ^ forAllInCase ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTTearDown >> forAllInCase: anObject [ forAllInCase := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTTearDown >> forEachInCase [ "Relation named: #forEachInCase type: #FamixUTCase opposite: #afterEach" @@ -61,14 +63,14 @@ FamixUTTearDown >> forEachInCase [ ^ forEachInCase ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTTearDown >> forEachInCase: anObject [ forEachInCase := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTTearDown >> method [ "Relation named: #method type: #FamixUTMethod opposite: #tearDown" @@ -77,14 +79,14 @@ FamixUTTearDown >> method [ ^ method ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTTearDown >> method: anObject [ method := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTTearDown >> suite [ "Relation named: #suite type: #FamixUTSuite opposite: #tearDown" @@ -93,7 +95,7 @@ FamixUTTearDown >> suite [ ^ suite ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTTearDown >> suite: anObject [ diff --git a/src/Famix-UnitTest-Entities/FamixValueOfType.extension.st b/src/Famix-UnitTest-Entities/FamixValueOfType.extension.st index b03dece..a859336 100644 --- a/src/Famix-UnitTest-Entities/FamixValueOfType.extension.st +++ b/src/Famix-UnitTest-Entities/FamixValueOfType.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #FamixValueOfType } +Extension { #name : 'FamixValueOfType' } -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixValueOfType >> argumentInActs [ "Relation named: #argumentInActs type: #FamixUTActArgument opposite: #value" @@ -11,14 +11,14 @@ FamixValueOfType >> argumentInActs [ ^ self attributeAt: #argumentInActs ifAbsentPut: [ FMMultivalueLink on: self opposite: #value: ] ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixValueOfType >> argumentInActs: anObject [ self argumentInActs value: anObject ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixValueOfType >> expectedInAssertions [ "Relation named: #expectedInAssertions type: #FamixUTAssertion opposite: #expected" @@ -29,14 +29,14 @@ FamixValueOfType >> expectedInAssertions [ ^ self attributeAt: #expectedInAssertions ifAbsentPut: [ FMMultivalueLink on: self opposite: #expected: ] ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixValueOfType >> expectedInAssertions: anObject [ self expectedInAssertions value: anObject ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixValueOfType >> fixtures [ "Relation named: #fixtures type: #FamixUTFixture opposite: #values" @@ -46,14 +46,14 @@ FamixValueOfType >> fixtures [ ^ self attributeAt: #fixtures ifAbsentPut: [ FMMultiMultivalueLink on: self opposite: #values ] ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixValueOfType >> fixtures: anObject [ self fixtures value: anObject ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixValueOfType >> receiverInAct [ "Relation named: #receiverInAct type: #FamixUTAct opposite: #receiver" @@ -64,7 +64,7 @@ FamixValueOfType >> receiverInAct [ ^ self attributeAt: #receiverInAct ifAbsent: [ nil ] ] -{ #category : #'*Famix-UnitTest-Entities-accessing' } +{ #category : '*Famix-UnitTest-Entities-accessing' } FamixValueOfType >> receiverInAct: anObject [ diff --git a/src/Famix-UnitTest-Entities/package.st b/src/Famix-UnitTest-Entities/package.st index c71919a..e65973c 100644 --- a/src/Famix-UnitTest-Entities/package.st +++ b/src/Famix-UnitTest-Entities/package.st @@ -1 +1 @@ -Package { #name : #'Famix-UnitTest-Entities' } +Package { #name : 'Famix-UnitTest-Entities' } diff --git a/src/Famix-UnitTest-Exporter/FamixUTHelperSetUpStrategy.class.st b/src/Famix-UnitTest-Exporter/FamixUTHelperSetUpStrategy.class.st index 87e80c7..edb71bf 100644 --- a/src/Famix-UnitTest-Exporter/FamixUTHelperSetUpStrategy.class.st +++ b/src/Famix-UnitTest-Exporter/FamixUTHelperSetUpStrategy.class.st @@ -48,13 +48,8 @@ FamixUTHelperSetUpStrategy >> export: aFamixUTSetUp on: aFamixUTExporter [ ifFalse: [ value accept: valueExporter ] ifTrue: [ | methodName | - methodName := ((WriteStream with: 'given_') - << value typedEntity name - << - (value resultInSpan - ifNotNil: [ '_expected' ] - ifNil: [ '_argument' ]) << '_for_' - << aFamixUTSetUp method name) contents. + methodName := ((WriteStream with: 'given_') << value roleName + << '_for_' << aFamixUTSetUp method name) contents. helperClass ifNil: [ helperClass := self ensureHelperClassOn: aFamixUTExporter ]. helperClass addDeclaration: diff --git a/src/Famix-UnitTest-Exporter/FamixUTJUnit4Exporter.class.st b/src/Famix-UnitTest-Exporter/FamixUTJUnit4Exporter.class.st index 52dc460..17cd131 100644 --- a/src/Famix-UnitTest-Exporter/FamixUTJUnit4Exporter.class.st +++ b/src/Famix-UnitTest-Exporter/FamixUTJUnit4Exporter.class.st @@ -6,6 +6,37 @@ Class { #tag : 'Exporters' } +{ #category : 'as yet unclassified' } +FamixUTJUnit4Exporter >> makeSuiteAnnotations: aFamixUTSuite [ + + ^ { + (model newAnnotation + name: 'RunWith'; + elements: { (model newClassProperty + type: (model newIdentifier name: 'Suite'); + fieldName: 'class') }). + (model newAnnotation + name: 'SuiteClasses'; + elements: { (model newArrayAnnotationElement values: + (aFamixUTSuite cases collect: [ :case | + model newClassProperty + type: (model newIdentifier name: case name); + fieldName: 'class' ])) }) } +] + +{ #category : 'as yet unclassified' } +FamixUTJUnit4Exporter >> makeSuiteImports [ + + ^ { + (model newImportDeclaration qualifiedName: + (model newQualifiedName name: 'org.junit.runner.RunWith')). + (model newImportDeclaration qualifiedName: + (model newQualifiedName name: 'org.junit.runners.Suite')). + (model newImportDeclaration qualifiedName: + (model newQualifiedName name: + 'org.junit.runners.Suite.SuiteClasses')) } +] + { #category : 'naming' } FamixUTJUnit4Exporter >> nameOfAssertionsClass [ diff --git a/src/Famix-UnitTest-Exporter/FamixUTJUnit5Exporter.class.st b/src/Famix-UnitTest-Exporter/FamixUTJUnit5Exporter.class.st index ce2cd7c..5f82db4 100644 --- a/src/Famix-UnitTest-Exporter/FamixUTJUnit5Exporter.class.st +++ b/src/Famix-UnitTest-Exporter/FamixUTJUnit5Exporter.class.st @@ -6,6 +6,32 @@ Class { #tag : 'Exporters' } +{ #category : 'as yet unclassified' } +FamixUTJUnit5Exporter >> makeSuiteAnnotations: aFamixUTSuite [ + + ^ { + (model newAnnotation name: 'Suite'). + (model newAnnotation + name: 'SelectClasses'; + elements: { (model newArrayAnnotationElement values: + (aFamixUTSuite cases collect: [ :case | + model newClassProperty + type: (model newIdentifier name: case name); + fieldName: 'class' ])) }) } +] + +{ #category : 'exporting' } +FamixUTJUnit5Exporter >> makeSuiteImports [ + + ^ { + (model newImportDeclaration qualifiedName: + (model newQualifiedName name: + 'org.junit.platform.suite.api.Suite')). + (model newImportDeclaration qualifiedName: + (model newQualifiedName name: + 'org.junit.platform.suite.api.SelectClasses')) } +] + { #category : 'naming' } FamixUTJUnit5Exporter >> nameOfAssertionsClass [ diff --git a/src/Famix-UnitTest-Exporter/FamixUTJUnitExporter.class.st b/src/Famix-UnitTest-Exporter/FamixUTJUnitExporter.class.st index 84ab39d..b84d629 100644 --- a/src/Famix-UnitTest-Exporter/FamixUTJUnitExporter.class.st +++ b/src/Famix-UnitTest-Exporter/FamixUTJUnitExporter.class.st @@ -139,15 +139,20 @@ FamixUTJUnitExporter >> exportCase: aFamixUTCase [ (currentClass := self model newClassDeclaration) name: aFamixUTCase name; addModifier: (model newModifier token: 'public'); - addComment: self makeTestCaseComment; - addDeclaration: (self makeTestCaseReceiver: aFamixUTCase). + addComment: self makeTestCaseComment. caseSuperclass ifNotNil: [ "inherit from configured superclass" currentClass superclass: (caseSuperclass asFASTJavaTypeExpressionOn: valueExporter) ]. aFamixUTCase methods do: [ :method | - currentClass addDeclaration: (self exportMethod: method) ]. + [ currentClass addDeclaration: (self exportMethod: method) ] + on: Error + do: [ :e | "propose to skip methods with errors" + FamixUTSkipWarning signalFor: method because: e ] ]. + + "Stop here if no methods were successfully exported" + currentClass declarations ifEmpty: [ ^ nil ]. "Add 'autowire' method to add properties to the receiver." self currentClassHasAutowiredProperty ifTrue: [ @@ -165,14 +170,16 @@ FamixUTJUnitExporter >> exportCase: aFamixUTCase [ { #category : 'exporting' } FamixUTJUnitExporter >> exportCaseCompilationUnit: aFamixUTCase [ - "Export imports after the class because new dependencies can be added during the process." currentCompilationUnit := self model newCompilationUnit. - ^ currentCompilationUnit - packageDeclaration: (self exportCasePackage: aFamixUTCase); - importDeclarations: (self exportCaseImports: aFamixUTCase); - addClassDeclaration: (self exportCase: aFamixUTCase); - yourself + currentCompilationUnit + packageDeclaration: (self exportCasePackage: aFamixUTCase); + importDeclarations: (self exportCaseImports: aFamixUTCase). + (self exportCase: aFamixUTCase) + ifNil: [ "all method exports failed" + currentCompilationUnit removeFromModel ] + ifNotNil: [ :case | + currentCompilationUnit addClassDeclaration: case ] ] { #category : 'exporting' } @@ -192,20 +199,24 @@ FamixUTJUnitExporter >> exportCaseImports: aFamixUTCase [ imports add: (valueExporter builder makeImportDeclaration: caseSuperclass) ]. - self flag: #TODO. "exportCaseImports: after exportCase: then add the autowired check" - "self currentClassHasAutowiredProperty ifTrue: [" + "TODO: handle autowired import" + "exportCaseImports: after exportCase: then add the autowired check" + "self currentClassHasAutowiredProperty ifTrue: [ imports add: (model newImportDeclaration qualifiedName: (model newQualifiedName name: - 'org.springframework.beans.factory.annotation.Autowired')) "]". + 'org.springframework.beans.factory.annotation.Autowired')) ]." ^ imports ] { #category : 'exporting' } FamixUTJUnitExporter >> exportCasePackage: aFamixUTCase [ + "Export the package declaration for the test class. + The tested class can be an inner type, e.g. com.Example.Inner, so asLowercase is applied for a valid package name" ^ self model newPackageDeclaration qualifiedName: (model newQualifiedName name: - aFamixUTCase testedClass typeContainer mooseNameWithDots) + aFamixUTCase testedClass typeContainer mooseNameWithDots + asLowercase) ] { #category : 'exporting' } @@ -226,37 +237,18 @@ FamixUTJUnitExporter >> exportSuite: aFamixUTSuite [ currentCompilationUnit := self model newCompilationUnit. currentClass := model newClassDeclaration name: aFamixUTSuite name. - currentClass modifiers: { - (model newAnnotation - name: 'RunWith'; - elements: { (model newClassProperty - type: (model newIdentifier name: 'Suite'); - fieldName: 'class') }). - (model newAnnotation - name: 'SuiteClasses'; - elements: { (model newArrayAnnotationElement values: - (aFamixUTSuite cases collect: [ :case | - model newClassProperty - type: (model newIdentifier name: case name); - fieldName: 'class' ])) }). - (model newModifier token: 'public') }. + currentClass modifiers: (self makeSuiteAnnotations: aFamixUTSuite) + , { (model newModifier token: 'public') }. currentCompilationUnit packageDeclaration: (model newPackageDeclaration qualifiedName: (model newQualifiedName name: 'fr.evref.modest')); - importDeclarations: { - (model newImportDeclaration qualifiedName: - (model newQualifiedName name: 'org.junit.runner.RunWith')). - (model newImportDeclaration qualifiedName: - (model newQualifiedName name: 'org.junit.runners.Suite')). - (model newImportDeclaration qualifiedName: - (model newQualifiedName name: - 'org.junit.runners.Suite.SuiteClasses')) } - , (aFamixUTSuite cases collect: [ :case | + importDeclarations: + self makeSuiteImports , (aFamixUTSuite cases collect: [ :case | model newImportDeclaration qualifiedName: (model newQualifiedName name: - case testedClass typeContainer mooseNameWithDots , '.' - , case name) ]); + case testedClass typeContainer mooseNameWithDots + asLowercase , '.' , case name) ]); addClassDeclaration: currentClass. ^ currentCompilationUnit ] @@ -273,7 +265,7 @@ FamixUTJUnitExporter >> makeActInvocation: aFamixUTAct [ | testedMethod | testedMethod := aFamixUTAct method testedMethod. ^ self model newMethodInvocation - receiver: (self makeActReceiver: testedMethod); + receiver: (self makeActReceiver: aFamixUTAct); name: testedMethod name; arguments: (aFamixUTAct arguments collect: [ :argument | self valueExporter makeVariableExpression: argument value ]); @@ -281,11 +273,17 @@ FamixUTJUnitExporter >> makeActInvocation: aFamixUTAct [ ] { #category : 'ast' } -FamixUTJUnitExporter >> makeActReceiver: testedMethod [ +FamixUTJUnitExporter >> makeActReceiver: aFamixUTAct [ - ^ model newNewExpression type: - (testedMethod parentType asFASTJavaTypeExpressionOn: - self valueExporter) + ^ aFamixUTAct receiver + ifNotNil: [ :receiver | + model newVariableExpression name: + (valueExporter varNameFor: receiver) ] + ifNil: [ "I guess this is not a good place to initialize the receiver during the act + TODO: initialize beforehand, and always use a variable reference to receive act." + model newNewExpression type: + (aFamixUTAct method testedMethod parentType + asFASTJavaTypeExpressionOn: self valueExporter) ] ] { #category : 'ast' } @@ -324,6 +322,19 @@ FamixUTJUnitExporter >> makeJUnitImports [ package , '.' , self nameOfBeforeEachAnnotation)) } ] +{ #category : 'exporting' } +FamixUTJUnitExporter >> makeSuiteAnnotations: aFamixUTSuite [ + "Return the class annotations to apply to a suite class" + + self subclassResponsibility +] + +{ #category : 'exporting' } +FamixUTJUnitExporter >> makeSuiteImports [ + + self subclassResponsibility +] + { #category : 'exporting' } FamixUTJUnitExporter >> makeTestCaseAutowire: aFamixUTCase [ "UseCases are not autowireable, but the services are. To really test the UseCase methods, @@ -396,6 +407,7 @@ FamixUTJUnitExporter >> makeTestCaseReceiver: aFamixUTCase [ "The variable containing an instance of the tested class" | testedClass | + Error signal: 'Do not use an attribute to store receiver'. testedClass := aFamixUTCase testedClass. ^ self model newVarDeclStatement type: (testedClass asFASTJavaTypeExpressionOn: self valueExporter); diff --git a/src/Famix-UnitTest-Exporter/FamixUTSkipWarning.class.st b/src/Famix-UnitTest-Exporter/FamixUTSkipWarning.class.st new file mode 100644 index 0000000..d83aa48 --- /dev/null +++ b/src/Famix-UnitTest-Exporter/FamixUTSkipWarning.class.st @@ -0,0 +1,16 @@ +Class { + #name : 'FamixUTSkipWarning', + #superclass : 'Warning', + #category : 'Famix-UnitTest-Exporter-Exceptions', + #package : 'Famix-UnitTest-Exporter', + #tag : 'Exceptions' +} + +{ #category : 'signalling' } +FamixUTSkipWarning class >> signalFor: aFamixUTMethod because: anException [ + + ^ self signal: (String streamContents: [ :s | + s << 'Skipping export of ' << aFamixUTMethod name + << ' because: '. + anException printOn: s ]) +] diff --git a/src/Famix-UnitTest-Exporter/FamixUTStubError.class.st b/src/Famix-UnitTest-Exporter/FamixUTStubError.class.st new file mode 100644 index 0000000..503ab5d --- /dev/null +++ b/src/Famix-UnitTest-Exporter/FamixUTStubError.class.st @@ -0,0 +1,14 @@ +Class { + #name : 'FamixUTStubError', + #superclass : 'Error', + #category : 'Famix-UnitTest-Exporter-Exceptions', + #package : 'Famix-UnitTest-Exporter', + #tag : 'Exceptions' +} + +{ #category : 'exceptioninstantiator' } +FamixUTStubError class >> signal: aFamixType [ + + ^ super signal: + 'Missing sources for the type: ' , aFamixType mooseName +] diff --git a/src/Famix-UnitTest-Exporter/FamixValueOfType.extension.st b/src/Famix-UnitTest-Exporter/FamixValueOfType.extension.st index 989f919..38386c1 100644 --- a/src/Famix-UnitTest-Exporter/FamixValueOfType.extension.st +++ b/src/Famix-UnitTest-Exporter/FamixValueOfType.extension.st @@ -23,5 +23,19 @@ FamixValueOfType >> allTypesOn: aCollection seen: seen [ seen add: self. self type allTypesOn: aCollection. self typedEntity ifNotNil: [ :typedEntity | - typedEntity declaredType allTypesOn: aCollection ] + typedEntity declaredType ifNotNil: [ :declaredType | "This should not happen but it does!!!!!!!!!!!!!!!!!!" + declaredType allTypesOn: aCollection ] ] +] + +{ #category : '*Famix-UnitTest-Exporter' } +FamixValueOfType >> roleName [ + + self argumentInSpans ifNotEmpty: [ + ^ String streamContents: [ :s | + self typedEntity ifNotNil: [ :typedEntity | + s << typedEntity name << $_ ]. + s << 'argument' ] ]. + self receiverInSpan ifNotNil: [ ^ 'receiver' ]. + self resultInSpan ifNotNil: [ ^ 'expected' ]. + Error signal: 'No role for this value' ] diff --git a/src/Famix-UnitTest-Generator/FamixUnitTestGenerator.class.st b/src/Famix-UnitTest-Generator/FamixUnitTestGenerator.class.st index cd0256d..823431d 100644 --- a/src/Famix-UnitTest-Generator/FamixUnitTestGenerator.class.st +++ b/src/Famix-UnitTest-Generator/FamixUnitTestGenerator.class.st @@ -1,6 +1,6 @@ Class { - #name : #FamixUnitTestGenerator, - #superclass : #FamixMetamodelGenerator, + #name : 'FamixUnitTestGenerator', + #superclass : 'FamixMetamodelGenerator', #instVars : [ 'case', 'suite', @@ -13,30 +13,31 @@ Class { 'act', 'actArgument' ], - #category : #'Famix-UnitTest-Generator' + #category : 'Famix-UnitTest-Generator', + #package : 'Famix-UnitTest-Generator' } -{ #category : #accessing } +{ #category : 'accessing' } FamixUnitTestGenerator class >> packageName [ ^ #'Famix-UnitTest-Entities' ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUnitTestGenerator class >> prefix [ ^ #FamixUT ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUnitTestGenerator class >> submetamodels [ ^ { FamixGenerator. FamixValueGenerator } ] -{ #category : #definition } +{ #category : 'definition' } FamixUnitTestGenerator >> defineClasses [ suite := builder @@ -75,7 +76,7 @@ FamixUnitTestGenerator >> defineClasses [ value := self remoteEntity: #OfType withPrefix: #FamixValue ] -{ #category : #definition } +{ #category : 'definition' } FamixUnitTestGenerator >> defineHierarchy [ setUp --|> fixture. @@ -86,14 +87,14 @@ FamixUnitTestGenerator >> defineHierarchy [ method --|> #TNamedEntity ] -{ #category : #definition } +{ #category : 'definition' } FamixUnitTestGenerator >> defineProperties [ (assertion property: #errorMargin type: #Object) comment: 'How much deviation is allowed between the expected and actual values.' ] -{ #category : #definition } +{ #category : 'definition' } FamixUnitTestGenerator >> defineRelations [ (suite property: #cases) <>-* case. @@ -118,8 +119,7 @@ FamixUnitTestGenerator >> defineRelations [ (act property: #receiver) - (value property: #receiverInAct). (case property: #testedClass) - - - ((self remoteTrait: #TClass withPrefix: #Famix) property: #testCase). + - ((self remoteTrait: #TType withPrefix: #Famix) property: #testCase). (method property: #testedMethod) *- ((self remoteTrait: #TMethod withPrefix: #Famix) property: #unitTests) diff --git a/src/Famix-UnitTest-Generator/package.st b/src/Famix-UnitTest-Generator/package.st index cb5a1d3..7fe25b1 100644 --- a/src/Famix-UnitTest-Generator/package.st +++ b/src/Famix-UnitTest-Generator/package.st @@ -1 +1 @@ -Package { #name : #'Famix-UnitTest-Generator' } +Package { #name : 'Famix-UnitTest-Generator' } diff --git a/src/Famix-UnitTest-Importer/FamixUTImporter.class.st b/src/Famix-UnitTest-Importer/FamixUTImporter.class.st index bea64fb..c7be73b 100644 --- a/src/Famix-UnitTest-Importer/FamixUTImporter.class.st +++ b/src/Famix-UnitTest-Importer/FamixUTImporter.class.st @@ -1,76 +1,78 @@ Class { - #name : #FamixUTImporter, - #superclass : #Object, + #name : 'FamixUTImporter', + #superclass : 'Object', #instVars : [ 'model', 'nameDict' ], - #category : #'Famix-UnitTest-Importer' + #category : 'Famix-UnitTest-Importer', + #package : 'Famix-UnitTest-Importer' } -{ #category : #importing } +{ #category : 'importing' } FamixUTImporter >> fromOpenTelemetrySpans: spans [ "Use a collection of FamixOTelSpan from the Famix-OpenTelemetry project as test oracle." - (spans groupedBy: [ :span | span origin parentType ]) - associationsDo: [ :spansByClass | - | case | - case := self model newCase testedClass: spansByClass key. - spansByClass value do: [ :span | - case addMethod: (self - testMethod: span origin - receiver: span receiver - arguments: span arguments - expected: span result) ] ]. + ((spans reject: [ :span | span attributeAt: #skip ifAbsent: false ]) + groupedBy: [ :span | span origin parentType ]) associationsDo: [ + :spansByClass | + | case | + case := self model newCase testedClass: spansByClass key. + spansByClass value do: [ :span | + case addMethod: (self + testMethod: span origin + receiver: span receiver + arguments: span arguments + expected: span result) ] ]. ^ self model ] -{ #category : #initialization } +{ #category : 'initialization' } FamixUTImporter >> initialize [ nameDict := Dictionary new ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTImporter >> model [ ^ model ifNil: [ model := FamixUTModel new ] ] -{ #category : #accessing } +{ #category : 'accessing' } FamixUTImporter >> model: aFamixUTModel [ model := aFamixUTModel ] -{ #category : #importing } +{ #category : 'importing' } FamixUTImporter >> testMethod: aFamixTMethod receiver: receiver arguments: arguments expected: expected [ - "Build a unit test for a method using the given arguments and expected result." + "Build a unit test for a method using the given receiver, arguments, and expected result." | method setUp | method := self model newMethod testedMethod: aFamixTMethod; name: (self testMethodNameFor: aFamixTMethod). + model newAct + method: method; + arguments: (arguments collect: [ :argument | + model newActArgument value: argument value ]). setUp := (receiver isNotNil or: [ expected isNotNil or: [ arguments isNotEmpty ] ]) ifTrue: [ model newSetUp method: method ]. + receiver ifNotNil: [ + setUp addValue: receiver. + method act receiver: receiver ]. + arguments do: [ :argument | setUp addValue: argument value ]. expected ifNotNil: [ setUp addValue: expected. model newAssertion method: method; expected: expected ]. - arguments do: [ :argument | setUp addValue: argument value ]. - model newAct - method: method; - arguments: (arguments collect: [ :argument | - model newActArgument value: argument value ]). - receiver ifNotNil: [ - setUp addValue: receiver. - method act receiver: receiver ]. ^ method ] -{ #category : #importing } +{ #category : 'importing' } FamixUTImporter >> testMethodNameFor: aFamixTMethod [ "Give a unique name for a new test method." diff --git a/src/Famix-UnitTest-Importer/package.st b/src/Famix-UnitTest-Importer/package.st index f735b35..744c700 100644 --- a/src/Famix-UnitTest-Importer/package.st +++ b/src/Famix-UnitTest-Importer/package.st @@ -1 +1 @@ -Package { #name : #'Famix-UnitTest-Importer' } +Package { #name : 'Famix-UnitTest-Importer' }