Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ BaselineOfExecutableRequirements >> baselineForCommon: spec [

{ #category : 'baselines' }
BaselineOfExecutableRequirements >> coreDependencies: spec [

"No dependencies"
spec
baseline: 'MethodProxies'
with: [ spec repository: 'github://Nyan11/MethodProxies/src' ]

]

{ #category : 'baselines' }
Expand Down
7 changes: 7 additions & 0 deletions src/ExecutableRequirements-Tests/ExReqMockTestObject.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ ExReqMockTestObject >> methodToTestMetaSafeRecursion [
^ true
]

{ #category : 'as yet unclassified' }
ExReqMockTestObject >> methodToTestTheExceptionExit [

x := [ true ifTrue: [ Exception signal ] ] value.
^ Color blue
]

{ #category : 'as yet unclassified' }
ExReqMockTestObject >> methodToTestTheNonLocalReturn [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ ExReqRepositoryReportTest >> tearDown [
repository := nil
]

{ #category : 'tests' }
ExReqRepositoryReportTest >> testCreateTracingPoints [

self assert: ExReqTracingPoint all isEmpty.
self assert: self report tracingPoints isEmpty.
self report createTracingPoints.
self assert: ExReqTracingPoint all isNotEmpty.
self assert: self report tracingPoints isNotEmpty
]

{ #category : 'tests' }
ExReqRepositoryReportTest >> testExecuteTracingPoints [

Expand All @@ -67,15 +57,11 @@ ExReqRepositoryReportTest >> testExecuteTracingPoints [
{ #category : 'tests' }
ExReqRepositoryReportTest >> testInstallTracingPoints [

self assert: ExReqTracingPoint all isEmpty.
self assert: self report tracingPoints isEmpty.
self assert: self report builder isEmpty.
self report installTracingPoints.

self assert: ExReqTracingPoint all isNotEmpty.
self assert: self report tracingPoints isNotEmpty.
self assert: self report builder isNotEmpty.
self report removeTracingPoints.
self assert: ExReqTracingPoint all isEmpty.
self assert: self report tracingPoints isEmpty.
self assert: self report builder isEmpty.
]

{ #category : 'tests' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@ ExReqSafePassingControlTest >> req3 [
yourself
]

{ #category : 'as yet unclassified' }
ExReqSafePassingControlTest >> req4 [

<ExReqSafePassingControl>
^ ExReqRequirement new
title: 'A requirement verifications shall handle exception';
addVerification: [ :verify |
verify
addStepOnAST:
((ExReqMockTestObject methodNamed:
#methodToTestTheExceptionExit) ast allChildren select: [
:each | each isMessage ]) first
withPrecondition: [ true ]
withPostcondition: [ true ] ];
yourself
]

{ #category : 'running' }
ExReqSafePassingControlTest >> setUp [

Expand All @@ -85,6 +102,18 @@ ExReqSafePassingControlTest >> tearDown [
repository := nil
]

{ #category : 'tests' }
ExReqSafePassingControlTest >> testExceptionExit [

| requirement requirementReport |
self report installTracingPoints.
self should: [ExReqMockTestObject new methodToTestTheExceptionExit] raise: Exception.
requirement := self req4.
requirementReport := self report findRequirementReport: requirement.
self assert: requirementReport isValid.
self report removeTracingPoints
]

{ #category : 'tests' }
ExReqSafePassingControlTest >> testMetaSafeRecursion [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,9 +1006,14 @@ ExReqToploLoginRequirements >> capella_requirement_3 [
(ExReqToploLoginSimulation >> #authenticateUsername:password:)
ast
withPrecondition: [ :obj :args |
(obj
perform: #authenticateUsername:password:
withArguments: args) not ].
[
obj
perform: #authenticateUsername:password:
withArguments: args.
false ]
on: Exception
do: [ true ] ]
withPostcondition: [ true ].
verif
addStepOnAST: (ExReqToploLoginWidget >> #loginAction) ast
withPostcondition: [ :obj :args |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ExReqToploLoginSimulation >> authenticateUsername: aUsernameString password: aPa
self database
at: aUsernameString
ifPresent: [ :value | ^ aPasswordString = value ]
ifAbsent: [ ^ false ]
ifAbsent: [ Exception signal: 'Wrong credentials' ]
]

{ #category : 'as yet unclassified' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ ExReqToploLoginWidget >> initialize [
{ #category : 'as yet unclassified' }
ExReqToploLoginWidget >> loginAction [

(self authenticationBlock
value: self usernameValue
value: self passwordValue)
ifTrue: [ self loginBlock value ]
ifFalse: [
[ self authenticationBlock
value: self usernameValue
value: self passwordValue.
self loginBlock value ]
on: Exception do: [ :error |
self loginStatusContainer visibility: BlVisibility visible.
self passwordInput text: '' ]
]
Expand Down
69 changes: 15 additions & 54 deletions src/ExecutableRequirements/ExReqRepositoryReport.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Class {
#instVars : [
'requirementReports',
'repository',
'tracingPoints',
'announcer'
'announcer',
'builder'
],
#category : 'ExecutableRequirements-Model-Report',
#package : 'ExecutableRequirements',
Expand Down Expand Up @@ -73,6 +73,12 @@ ExReqRepositoryReport >> associatedPackages [
^ self repository associatedPackages.
]

{ #category : 'as yet unclassified' }
ExReqRepositoryReport >> builder [

^ builder
]

{ #category : 'as yet unclassified' }
ExReqRepositoryReport >> closeReport [

Expand All @@ -81,40 +87,6 @@ ExReqRepositoryReport >> closeReport [
requirementReports := { }
]

{ #category : 'as yet unclassified' }
ExReqRepositoryReport >> createTracingPoints [

| stepReports preconditionNodeDictionary postconditionNodeDictionary|
"
- Step1: Get all step reports.
- Step2: Create a dictionary with all ast -> step reports.
- Step3: Create all PreconditionTracingPoint.
- Step4: Create a dictionary with all ast & ast methodNode -> step reports.
- Step5: Create all PostconditionTracingPoint.
"
stepReports := self requirementReports flatCollect: [ :req |
req verificationReports flatCollect: #stepReports ].
preconditionNodeDictionary := Dictionary new.
postconditionNodeDictionary := Dictionary new.
stepReports do: [ :stepReport |
preconditionNodeDictionary
at: stepReport step node
ifPresent: [ :col | col add: stepReport ]
ifAbsentPut: [ OrderedCollection with: stepReport ].
postconditionNodeDictionary
at: stepReport step node
ifPresent: [ :col | col add: stepReport ]
ifAbsentPut: [ Set with: stepReport ].
postconditionNodeDictionary
at: stepReport step node methodNode
ifPresent: [ :col | col add: stepReport ]
ifAbsentPut: [ Set with: stepReport ].
].
self tracingPoints: OrderedCollection new.
self tracingPoints addAll: (preconditionNodeDictionary associations collect: [ :asso | ExReqTracingPoint installPreconditionOn: asso key withStepReports: asso value ]).
self tracingPoints addAll: (postconditionNodeDictionary associations collect: [ :asso | ExReqTracingPoint installPostconditionOn: asso key withStepReports: asso value ]).
]

{ #category : 'as yet unclassified' }
ExReqRepositoryReport >> findRequirementReport: anExReqRequirement [
| result |
Expand All @@ -128,15 +100,17 @@ ExReqRepositoryReport >> findRequirementReport: anExReqRequirement [
ExReqRepositoryReport >> initialize [

super initialize.
tracingPoints := OrderedCollection new.
announcer := Announcer new
announcer := Announcer new.
builder := NeoExReqInstrumentationBuilder new.
]

{ #category : 'as yet unclassified' }
ExReqRepositoryReport >> installTracingPoints [

self createTracingPoints.
self tracingPoints do: [ :each | each install ].
| stepReports |
stepReports := self requirementReports flatCollect: [ :req |
req verificationReports flatCollect: #stepReports ].
self builder installAllStepReports: stepReports.
self isInstalled: true.
self isRunning: true.
self annouceTracingPointInstalled
Expand All @@ -157,8 +131,7 @@ ExReqRepositoryReport >> isValid [
{ #category : 'as yet unclassified' }
ExReqRepositoryReport >> removeTracingPoints [

self tracingPoints do: [ :each | each remove ].
self tracingPoints: { }.
self builder uninstallAllStepReports.
self isRunning: false.
self annouceTracingPointRemoved
]
Expand Down Expand Up @@ -189,15 +162,3 @@ ExReqRepositoryReport >> subReports [

^ self requirementReports
]

{ #category : 'accessing' }
ExReqRepositoryReport >> tracingPoints [

^ tracingPoints
]

{ #category : 'accessing' }
ExReqRepositoryReport >> tracingPoints: aCollection [

tracingPoints := aCollection
]
41 changes: 41 additions & 0 deletions src/ExecutableRequirements/ExReqStepReport.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,47 @@ ExReqStepReport >> subReports [
^ { }
]

{ #category : 'as yet unclassified' }
ExReqStepReport >> verifyPostconditionWithReceiver: anObject withArguments: aCollection [

self step ifNil: [ ^ self ].
postconditionValidity ifTrue: [ ^ self ].
self preconditionIsValid ifFalse: [ ^ self ].
self step postcondition ifNil: [
postconditionValidity := true.
self announceValidity.
^ self ].
postconditionValidity := self hasPostcondition
ifTrue: [
self step postcondition
valueWithEnoughArguments: {
anObject.
aCollection.
self requirement } ]
ifFalse: [ true ].

self isValid ifTrue: [ self announceValidity ]
]

{ #category : 'as yet unclassified' }
ExReqStepReport >> verifyPreconditionWithReceiver: anObject withArguments: aCollection [
trigger := true.
preconditionValidity ifTrue: [ ^ self ].
self isPreviousStepValid ifFalse: [
preconditionValidity := false.
postconditionValidity := false.
^ self ].
preconditionValidity := self hasPrecondition
ifTrue: [
self step precondition
valueWithEnoughArguments: {
anObject.
aCollection.
self requirement } ]
ifFalse: [ true ].
self isValid ifTrue: [ self announceValidity ]
]

{ #category : 'as yet unclassified' }
ExReqStepReport >> verifyStepPostconditionWithContext: aContext [
"
Expand Down
2 changes: 1 addition & 1 deletion src/ExecutableRequirements/ExReqTracingPoint.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ ExReqTracingPoint >> metaLink [
{ #category : 'accessing' }
ExReqTracingPoint >> name [

^ name ifNil: [ #TracingPoint ]
^ name ifNil: [ name := #TracingPoint ]
]

{ #category : 'default values' }
Expand Down
Loading
Loading