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 @@ -37,7 +37,7 @@ ClyShowCritiqueDetailsCommand >> execute [

self specUIManager
title: critique title;
label: self critiqueDescription;
message: self critiqueDescription;
acceptLabel: 'close';
extent: 500 @ 500;
openDialog
Expand Down
92 changes: 43 additions & 49 deletions src/SUnit-Basic-CLI/HDTestReport.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,16 @@ HDTestReport class >> currentStageName: aStageName [
{ #category : 'running' }
HDTestReport class >> runClasses: aCollectionOfClasses named: packageName [

| suite classes time result |
| suite classes result |
suite := TestSuite named: packageName.
ShuffleSeed ifNotNil: [ suite shuffleSeed: ShuffleSeed asInteger ].
classes := (aCollectionOfClasses select: [ :class |
class isTestCase and: [ class isAbstract not ] ])
asSortedCollection: [ :a :b | a name <= b name ].

classes := (aCollectionOfClasses select: [ :class | class isTestCase and: [ class isAbstract not ] ]) asSortedCollection: [ :a :b | a name <= b name ].
classes ifEmpty: [ ^ nil ].

classes do: [ :class | suite addTests: class buildSuite tests ].
time := DateAndTime now.
('Beginning to run tests of ' , packageName , ' with random seed '
, suite shuffleSeed asString , OSPlatform current lineEnding)
traceCr.
result := self runSuite: suite.
('Finished to run tests of ' , packageName , ' in '
, (DateAndTime now - time) humanReadablePrintString
, OSPlatform current lineEnding) traceCr.
^ result
^ result
]

{ #category : 'running' }
Expand All @@ -66,7 +59,9 @@ HDTestReport class >> runPackage: aString [
{ #category : 'running' }
HDTestReport class >> runSuite: aTestSuite [

^ self new runSuite: aTestSuite
^ self new
suite: aTestSuite;
run
]

{ #category : 'running' }
Expand Down Expand Up @@ -98,12 +93,6 @@ HDTestReport >> calculateNodeName [
ifAbsent: [ '' ]
]

{ #category : 'running' }
HDTestReport >> done [
"just close the file"
[ progressStream close ] on: Error do: []
]

{ #category : 'private' }
HDTestReport >> generateTestName: aTestCase [

Expand Down Expand Up @@ -138,11 +127,6 @@ HDTestReport >> initialize [

]

{ #category : 'initialization' }
HDTestReport >> initializeOn: aTestSuite [
suite := aTestSuite
]

{ #category : 'private' }
HDTestReport >> newLogDuring: aBlock [

Expand Down Expand Up @@ -252,16 +236,11 @@ HDTestReport >> reportTestCase: aTestCase runBlock: aBlock [
HDTestReport >> run [

[
self setUp.
suiteTime := [ self runAll ] millisecondsToRun ] ensure: [
self tearDown ]
]

{ #category : 'running' }
HDTestReport >> runAll [
CurrentExecutionEnvironment runTestsBy: [
suite tests do: [ :each | each run: self ]
]
| time |
self setUp.
time := DateAndTime now.
CurrentExecutionEnvironment runTestsBy: [ suite tests do: [ :each | each run: self ] ].
suiteTime := DateAndTime now - time ] ensure: [ self tearDown ]
]

{ #category : 'running' }
Expand All @@ -278,14 +257,6 @@ HDTestReport >> runCase: aTestCase [
]
]

{ #category : 'running' }
HDTestReport >> runSuite: aTestSuite [
^ self
initializeOn: aTestSuite;
run;
done
]

{ #category : 'running' }
HDTestReport >> serializeError: error of: aTestCase [

Expand Down Expand Up @@ -318,10 +289,20 @@ HDTestReport >> serializeError: error of: aTestCase [
{ #category : 'running' }
HDTestReport >> setUp [

| aFile |
| aFile logString |
self openProgressStream.
progressStream nextPutAll: 'running suite: ';
nextPutAll: suite name ; crlf; flush.
logString := String streamContents: [ :aStream |
aStream
nextPutAll: 'Beginning to run tests of ';
nextPutAll: suite name;
nextPutAll: ' with random seed ';
print: suite shuffleSeed;
nextPutAll: OSPlatform current lineEnding ].
"We print in the progress file but also in the stdout for the CI infos."
logString trace.
progressStream
nextPutAll: logString;
flush.

aFile := File named: self suiteFileNameWithoutExtension , '.xml' .
aFile delete.
Expand Down Expand Up @@ -374,6 +355,12 @@ HDTestReport >> stageName: anObject [
stageName := anObject
]

{ #category : 'initialization' }
HDTestReport >> suite: aTestSuite [

suite := aTestSuite
]

{ #category : 'accessing' }
HDTestReport >> suiteErrors [
^ suiteErrors
Expand Down Expand Up @@ -408,6 +395,7 @@ HDTestReport >> suiteTotal [

{ #category : 'running' }
HDTestReport >> tearDown [
| logString |
suite resources
do: [ :each | each reset ].

Expand All @@ -419,13 +407,19 @@ HDTestReport >> tearDown [
stream
nextPutAll: ' failures="'; print: suiteFailures;
nextPutAll: '" errors="'; print: suiteErrors;
nextPutAll: '" time="'; print: suiteTime / 1000.0;
nextPutAll: '" time="'; print: suiteTime asMilliSeconds / 1000.0;
nextPutAll: '">'.
stream close.

progressStream
nextPutAll: 'finished running suite: ';
nextPutAll: suite name;
logString := String streamContents: [ :aStream |
aStream
nextPutAll: 'Finished to run tests of ';
nextPutAll: suite name;
nextPutAll: ' in '.
suiteTime printHumanReadableOn: aStream ]. "We print in the progress file but also in the stdout for the CI infos."
logString traceCr.
progressStream
nextPutAll: logString;
close
]

Expand Down
4 changes: 0 additions & 4 deletions src/SUnit-UI/CommandLineTestRunner.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ CommandLineTestRunner >> createStdout [
^ Stdio stdout
]

{ #category : 'running' }
CommandLineTestRunner >> done [
]

{ #category : 'helper' }
CommandLineTestRunner >> increaseTestCount [
currentTest := currentTest + 1
Expand Down