Tools__AbstractTestRunner.st
changeset 9952 c0f118b6b0aa
child 9957 35dc65b35806
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tools__AbstractTestRunner.st	Thu Jun 30 21:50:28 2011 +0200
@@ -0,0 +1,141 @@
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+"{ Package: 'stx:libtool' }"
+
+"{ NameSpace: Tools }"
+
+ApplicationModel subclass:#AbstractTestRunner
+	instanceVariableNames:''
+	classVariableNames:'NotRunColor PassedColor FailureColor ErrorColor'
+	poolDictionaries:''
+	category:'Interface-Test Runner 2'
+!
+
+!AbstractTestRunner class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+! !
+
+!AbstractTestRunner class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    NotRunColor     := Color redByte:145 greenByte:145 blueByte:145.
+    PassedColor     := Color redByte:92 greenByte:166 blueByte:92.
+    FailureColor    := Color redByte:194 greenByte:110 blueByte:110.
+    ErrorColor      := FailureColor
+
+    "Modified: / 15-03-2010 / 21:59:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!AbstractTestRunner class methodsFor:'accessing'!
+
+errorColor
+    ^ ErrorColor
+
+    "Created: / 07-02-2010 / 14:43:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 15-03-2010 / 21:53:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+failedColor
+    ^ FailureColor
+
+    "Modified: / 15-03-2010 / 21:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+notRunColor
+    ^ NotRunColor
+
+    "Created: / 15-03-2010 / 09:55:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 15-03-2010 / 21:53:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+passedColor
+    ^ PassedColor
+
+    "Modified: / 15-03-2010 / 21:54:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!AbstractTestRunner methodsFor:'private'!
+
+buildSuiteFromClass:testCaseCls
+
+    ^testCaseCls asTestCase buildSuite
+
+    "Modified: / 04-03-2011 / 08:22:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isTestCaseLike:cls 
+
+    ^cls isTestCaseLike
+
+    "Modified: / 28-02-2011 / 21:31:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!AbstractTestRunner methodsFor:'utilities'!
+
+suiteNameFromClasses: classes
+
+    classes size = 1 ifTrue:
+        [^classes anyOne nameWithoutPrefix].
+    classes size = 2 ifTrue:
+        [^String streamContents:
+            [:s|classes 
+                do:[:cls|s nextPutAll: cls nameWithoutPrefix]
+                separatedBy:[s nextPutAll:' & ']]].
+
+    ^classes size printString , ' test cases'.
+
+    "Created: / 15-03-2010 / 13:23:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+suiteNameFromMethods: methods
+
+    methods size = 1 ifTrue:[^methods anyOne selector].
+    ^methods size printString , ' tests from ' ,
+        (self suiteNameFromClasses: (methods collect:[:m|m mclass]) asSet)
+
+    "Created: / 15-03-2010 / 13:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+suiteNameFromProtocols: protocols
+
+    protocols size = 1 ifTrue:[^'tests categorized "', protocols anyOne , '"'].
+    ^'tests in ', protocols size printString , ' categories'
+
+    "Created: / 15-03-2010 / 13:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 15-03-2010 / 19:53:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!AbstractTestRunner class methodsFor:'documentation'!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__AbstractTestRunner.st,v 1.1 2011-06-30 19:50:28 cg Exp $'
+!
+
+version_SVN
+    ^ '§Id: Tools__AbstractTestRunner.st 7681 2011-03-04 11:30:02Z vranyj1 §'
+! !
+
+AbstractTestRunner initialize!