1 " |
1 " |
2 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
2 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
3 Copyright (c) 2009-2010 eXept Software AG |
3 Copyright (c) 2009-2010 eXept Software AG |
|
4 Copyright (c) 2021 LabWare |
4 |
5 |
5 Permission is hereby granted, free of charge, to any person |
6 Permission is hereby granted, free of charge, to any person |
6 obtaining a copy of this software and associated documentation |
7 obtaining a copy of this software and associated documentation |
7 files (the 'Software'), to deal in the Software without |
8 files (the 'Software'), to deal in the Software without |
8 restriction, including without limitation the rights to use, |
9 restriction, including without limitation the rights to use, |
44 classVariableNames:'' |
45 classVariableNames:'' |
45 poolDictionaries:'' |
46 poolDictionaries:'' |
46 privateIn:TestRunner2 |
47 privateIn:TestRunner2 |
47 ! |
48 ! |
48 |
49 |
49 ApplicationModel subclass:#ResultList |
50 AbstractTestRunner subclass:#ResultList |
50 instanceVariableNames:'results resultsHolder selectiomHolder listHolder timestampFormat |
51 instanceVariableNames:'results resultsHolder selectiomHolder listHolder timestampFormat |
51 selectionHolder' |
52 selectionHolder passedText failedText errorText' |
52 classVariableNames:'' |
53 classVariableNames:'' |
53 poolDictionaries:'' |
54 poolDictionaries:'' |
54 privateIn:TestRunner2 |
55 privateIn:TestRunner2 |
55 ! |
56 ! |
56 |
57 |
57 HierarchicalItem subclass:#ListEntry |
58 HierarchicalItem subclass:#ListEntry |
58 instanceVariableNames:'label realLabel test result' |
59 instanceVariableNames:'label realLabel test result' |
59 classVariableNames:'PassedText FailedText ErrorText' |
60 classVariableNames:'' |
60 poolDictionaries:'' |
61 poolDictionaries:'' |
61 privateIn:TestRunner2::ResultList |
62 privateIn:TestRunner2::ResultList |
62 ! |
63 ! |
63 |
64 |
64 !TestRunner2 class methodsFor:'documentation'! |
65 !TestRunner2 class methodsFor:'documentation'! |
65 |
66 |
66 copyright |
67 copyright |
67 " |
68 " |
68 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
69 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
69 Copyright (c) 2009-2010 eXept Software AG |
70 Copyright (c) 2009-2010 eXept Software AG |
|
71 Copyright (c) 2021 LabWare |
70 |
72 |
71 Permission is hereby granted, free of charge, to any person |
73 Permission is hereby granted, free of charge, to any person |
72 obtaining a copy of this software and associated documentation |
74 obtaining a copy of this software and associated documentation |
73 files (the 'Software'), to deal in the Software without |
75 files (the 'Software'), to deal in the Software without |
74 restriction, including without limitation the rights to use, |
76 restriction, including without limitation the rights to use, |
1800 "Modified: / 02-04-2000 / 14:21:42 / Sames" |
1787 "Modified: / 02-04-2000 / 14:21:42 / Sames" |
1801 "Created: / 18-01-2008 / 20:33:51 / janfrog" |
1788 "Created: / 18-01-2008 / 20:33:51 / janfrog" |
1802 ! |
1789 ! |
1803 |
1790 |
1804 displayFail:result |
1791 displayFail:result |
1805 self displayColor:self errorColor. |
1792 self displayColor:self errorBackgroundColor. |
1806 self displayMode:'Fail'. |
1793 self displayMode:'Fail'. |
1807 self displayDetails:result printString. |
1794 self displayDetails:result printString. |
1808 |
1795 |
1809 "Created: / 06-06-2008 / 08:49:25 / Jan Vrany <vranyj1@fel.cvut.cz>" |
1796 "Created: / 06-06-2008 / 08:49:25 / Jan Vrany <vranyj1@fel.cvut.cz>" |
1810 "Modified: / 07-02-2010 / 14:43:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1797 "Modified: / 07-02-2010 / 14:43:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1798 "Modified: / 17-09-2021 / 22:23:42 / Jan Vrany <jan.vrany@labware.com>" |
1811 ! |
1799 ! |
1812 |
1800 |
1813 displayMode: mode |
1801 displayMode: mode |
1814 |
1802 |
1815 self modeHolder value: mode |
1803 self modeHolder value: mode |
1817 "Modified: / 02-04-2000 / 14:21:42 / Sames" |
1805 "Modified: / 02-04-2000 / 14:21:42 / Sames" |
1818 "Created: / 18-01-2008 / 20:33:35 / janfrog" |
1806 "Created: / 18-01-2008 / 20:33:35 / janfrog" |
1819 ! |
1807 ! |
1820 |
1808 |
1821 displayPass:result |
1809 displayPass:result |
1822 self displayColor:self passedColor. |
1810 self displayColor:self passedBackgroundColor. |
1823 self displayMode:'Pass '. |
1811 self displayMode:'Pass '. |
1824 self |
1812 self |
1825 displayDetails:result printString , ' ' , (self timeSinceLastPassAsString) |
1813 displayDetails:result printString , ' ' , (self timeSinceLastPassAsString) |
|
1814 |
|
1815 "Modified: / 17-09-2021 / 22:23:51 / Jan Vrany <jan.vrany@labware.com>" |
1826 ! |
1816 ! |
1827 |
1817 |
1828 displayResult: aTestResult |
1818 displayResult: aTestResult |
1829 |
1819 |
1830 self displayResult: aTestResult keepFailures: false keepErrors: false. |
1820 self displayResult: aTestResult keepFailures: false keepErrors: false. |
1859 "Modified: / 19-03-2010 / 08:33:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1849 "Modified: / 19-03-2010 / 08:33:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1860 ! |
1850 ! |
1861 |
1851 |
1862 displayRunning: result test: test total: total |
1852 displayRunning: result test: test total: total |
1863 |
1853 |
1864 self displayColor: (result hasPassed ifTrue:[self class currentlyRunningColor] ifFalse:[Color orange]). |
1854 self displayColor: self runningBackgroundColor. |
1865 self displayMode: 'Running ' , test printString. |
1855 self displayMode: 'Running ' , test printString. |
1866 self displayDetails: total printString , ' total, ' , result printString |
1856 self displayDetails: total printString , ' total, ' , result printString |
1867 |
1857 |
1868 "Modified: / 21-06-2000 / 12:14:52 / Sames" |
1858 "Modified: / 21-06-2000 / 12:14:52 / Sames" |
1869 "Created: / 06-06-2008 / 19:38:48 / Jan Vrany <vranyj1@fel.cvut.cz>" |
1859 "Created: / 06-06-2008 / 19:38:48 / Jan Vrany <vranyj1@fel.cvut.cz>" |
1870 "Modified: / 05-07-2011 / 14:14:42 / cg" |
1860 "Modified: / 05-07-2011 / 14:14:42 / cg" |
|
1861 "Modified: / 17-09-2021 / 22:24:33 / Jan Vrany <jan.vrany@labware.com>" |
1871 ! ! |
1862 ! ! |
1872 |
1863 |
1873 !TestRunner2 methodsFor:'hooks'! |
1864 !TestRunner2 methodsFor:'hooks'! |
1874 |
1865 |
1875 commonPostOpen |
1866 commonPostOpen |
2127 |
2132 |
2128 updateList |
2133 updateList |
2129 |
2134 |
2130 | list | |
2135 | list | |
2131 list := HierarchicalList new. |
2136 list := HierarchicalList new. |
|
2137 list application: self. |
2132 list root: self makeRootEntry. |
2138 list root: self makeRootEntry. |
2133 list showRoot: false. |
2139 list showRoot: false. |
2134 self listHolder value: list. |
2140 self listHolder value: list. |
2135 |
2141 |
2136 "Created: / 07-02-2010 / 11:03:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2142 "Created: / 07-02-2010 / 11:03:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2137 "Modified: / 07-02-2010 / 13:41:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2143 "Modified: / 07-02-2010 / 13:41:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2144 "Modified: / 17-09-2021 / 22:50:17 / Jan Vrany <jan.vrany@labware.com>" |
2138 ! |
2145 ! |
2139 |
2146 |
2140 updateTimestampFormat |
2147 updateTimestampFormat |
2141 |
2148 |
2142 (results isEmptyOrNil or:[results size = 1]) |
2149 (results isEmptyOrNil or:[results size = 1]) |
2147 ifFalse:[timestampFormat := ' (%(month)-%(day) %h:%m)'] |
2154 ifFalse:[timestampFormat := ' (%(month)-%(day) %h:%m)'] |
2148 |
2155 |
2149 "Created: / 19-03-2010 / 08:50:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2156 "Created: / 19-03-2010 / 08:50:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2150 "Modified: / 12-09-2010 / 09:50:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2157 "Modified: / 12-09-2010 / 09:50:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 "Modified: / 04-08-2011 / 19:05:57 / cg" |
2158 "Modified: / 04-08-2011 / 19:05:57 / cg" |
|
2159 ! ! |
|
2160 |
|
2161 !TestRunner2::ResultList methodsFor:'initialization'! |
|
2162 |
|
2163 initialize |
|
2164 "Invoked when a new instance is created." |
|
2165 |
|
2166 super initialize. |
|
2167 |
|
2168 passedText := (' [', (self resources string:'passed') , ']') withColor: self passedBackgroundColor. |
|
2169 failedText := (' [', (self resources string:'failed') allBold , ']') withColor: self failedBackgroundColor. |
|
2170 errorText := (' [', (self resources string:'error') allBold , ']') withColor: self errorBackgroundColor. |
|
2171 |
|
2172 "/ super initialize. -- commented since inherited method does nothing |
2152 ! ! |
2173 ! ! |
2153 |
2174 |
2154 !TestRunner2::ResultList methodsFor:'private'! |
2175 !TestRunner2::ResultList methodsFor:'private'! |
2155 |
2176 |
2156 invalidate |
2177 invalidate |
2243 ^entry |
2264 ^entry |
2244 |
2265 |
2245 "Created: / 19-03-2010 / 08:41:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2266 "Created: / 19-03-2010 / 08:41:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2246 ! ! |
2267 ! ! |
2247 |
2268 |
2248 !TestRunner2::ResultList::ListEntry class methodsFor:'initialization'! |
|
2249 |
|
2250 errorText |
|
2251 ErrorText isNil ifTrue:[ |
|
2252 ErrorText := ' [','error' allBold,']' withColor: Tools::TestRunner2 errorColor "darker". |
|
2253 ]. |
|
2254 ^ ErrorText |
|
2255 |
|
2256 "Created: / 06-06-2016 / 14:41:59 / cg" |
|
2257 ! |
|
2258 |
|
2259 failedText |
|
2260 FailedText isNil ifTrue:[ |
|
2261 FailedText := ' [','failed' allBold,']' withColor: Tools::TestRunner2 failedColor "darker". |
|
2262 ]. |
|
2263 ^ FailedText |
|
2264 |
|
2265 "Created: / 06-06-2016 / 14:41:40 / cg" |
|
2266 ! |
|
2267 |
|
2268 passedText |
|
2269 PassedText isNil ifTrue:[ |
|
2270 PassedText := ' [passed]' withColor: Tools::TestRunner2 passedColor darker. |
|
2271 ]. |
|
2272 ^ PassedText |
|
2273 |
|
2274 "Created: / 06-06-2016 / 14:41:16 / cg" |
|
2275 ! ! |
|
2276 |
|
2277 !TestRunner2::ResultList::ListEntry class methodsFor:'instance creation'! |
2269 !TestRunner2::ResultList::ListEntry class methodsFor:'instance creation'! |
2278 |
2270 |
2279 labeled: aStringOrText |
2271 labeled: aStringOrText |
2280 |
2272 |
2281 ^self new label: aStringOrText |
2273 ^self new label: aStringOrText |
2293 |
2285 |
2294 "Created: / 07-02-2010 / 18:34:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2286 "Created: / 07-02-2010 / 18:34:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2295 ! |
2287 ! |
2296 |
2288 |
2297 label |
2289 label |
2298 | result | |
2290 |
2299 |
2291 self result. "/ to ensure result is computed |
2300 result := self result. |
|
2301 realLabel ifNil:[ |
2292 realLabel ifNil:[ |
2302 realLabel := label. |
2293 realLabel := label. |
2303 test ifNotNil:[ |
2294 test ifNotNil:[ |
2304 result == #passed ifTrue:[realLabel := realLabel , self class passedText]. |
2295 result == #passed ifTrue:[realLabel := realLabel , self application passedText]. |
2305 result == #error ifTrue:[realLabel := realLabel , self class errorText]. |
2296 result == #error ifTrue:[realLabel := realLabel , self application errorText]. |
2306 result == #failed ifTrue:[realLabel := realLabel , self class failedText]. |
2297 result == #failed ifTrue:[realLabel := realLabel , self application failedText]. |
2307 ] ifNil: [ |
2298 ] ifNil: [ |
2308 realLabel := realLabel , self summary. |
2299 realLabel := realLabel , self summary. |
2309 ] |
2300 ] |
2310 ]. |
2301 ]. |
2311 |
2302 |
2312 ^ realLabel |
2303 ^ realLabel |
2313 |
2304 |
2314 "Modified: / 07-02-2010 / 18:28:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2305 "Modified: / 07-02-2010 / 18:28:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2315 "Modified: / 08-02-2010 / 10:15:35 / Jan Vrany <jan,vrany@fit.cvut.cz>" |
2306 "Modified: / 08-02-2010 / 10:15:35 / Jan Vrany <jan,vrany@fit.cvut.cz>" |
2316 "Modified (format): / 06-06-2016 / 14:43:01 / cg" |
2307 "Modified (format): / 06-06-2016 / 14:43:01 / cg" |
|
2308 "Modified: / 17-09-2021 / 22:59:45 / Jan Vrany <jan.vrany@labware.com>" |
2317 ! |
2309 ! |
2318 |
2310 |
2319 label:aText |
2311 label:aText |
2320 label := aText. |
2312 label := aText. |
2321 realLabel := nil. |
2313 realLabel := nil. |