quickSelfTest/SelfTest.st
changeset 310 1fecaf68f3b4
parent 309 8061d7da3fc3
child 311 83f952e15a2c
--- a/quickSelfTest/SelfTest.st	Wed Mar 23 23:08:42 2016 +0100
+++ b/quickSelfTest/SelfTest.st	Thu Mar 24 00:15:05 2016 +0100
@@ -4,7 +4,10 @@
 "/
 "/ stx --noBanner -I --execute SelfTest.st
 "/
-"/   use --debug to debug failed test cases.
+"/   use
+"/      --debug to debug failed test cases.
+"/      --skipTests to skip tests
+"/      --skipMetrics to metric reports tests
 "/
 "/ To use with jenkins (+ jUnit plugin):
 "/ use the following buildscript (in jenkins):
@@ -76,53 +79,78 @@
     ]
 ].
 
-Stdout showCR:'Running suite...'.
-debugging := (Smalltalk commandLineArgumentNamed:'--debug') notNil.
-result := suite
-	    run:TestResultStX new beforeEachDo:[:test |
-		Stdout showCR:('- running ',test printString).
-	    ]
-	    afterEachDo:[:test|
-		Stdout showCR:('- done ',test printString).
-	    ]
-	    debug:debugging.
+"/
+"/ run the suite
+"/
+(Smalltalk commandLineArgumentNamed:'--skipTests') notNil ifTrue:[
+    Stdout showCR:'Skipping suite.'.
+] ifFalse:[
+    Stdout showCR:'Running suite...'.
+    debugging := (Smalltalk commandLineArgumentNamed:'--debug') notNil.
+    result := suite
+		run:TestResultStX new
+		beforeEachDo:[:test |
+		    Stdout showCR:('- running ',test printString).
+		]
+		afterEachDo:[:test|
+		    Stdout showCR:('- done ',test printString).
+		]
+		debug:debugging.
 
-Stdout showCR:'Generating report...'.
-TestResultReporter
-    report:result
-    format:#xml_jUnit
-    as:'testresult.xml'.
+    Stdout showCR:'Generating report...'.
+    TestResultReporter
+	report:result
+	format:#xml_jUnit
+	as:'testresult.xml'.
 
-Stdout showCR:'Summary:'.
-Stdout showCR:('  %1 tests;' bindWith:result runCount).
-Stdout show:('  %1 passed,' bindWith:result passedCount).
-Stdout show:(' %1 failed,' bindWith:result failureCount).
-Stdout showCR:(' %1 errors.' bindWith:result errorCount).
+    Stdout showCR:'Summary:'.
+    Stdout showCR:('  %1 tests;' bindWith:result runCount).
+    Stdout show:('  %1 passed,' bindWith:result passedCount).
+    Stdout show:(' %1 failed,' bindWith:result failureCount).
+    Stdout showCR:(' %1 errors.' bindWith:result errorCount).
+].
 
-'metrics.xml' asFilename writingFileDo:[:stream |
-    MetricsReporter new
-	stream: stream;
-	packages:{
-	    'stx:libbasic'       .
-	    'stx:libbasic2'      .
-	    'stx:libbasic3'      .
-	    'stx:libcomp'        .
-	    'stx:libview'        .
-	    'stx:libview2'       .
-	    'stx:libwidg'        .
-	    'stx:libwidg2'       .
-	    'stx:libtool'        .
-	    'stx:libtool2'       .
-	    'stx:libui'          .
-	    'stx:libhtml'        .
-	    'stx:goodies/xml/vw' .
-	    'stx:goodies/soap'   .
-	    'stx:libjavascript'  .
-	};
-	classMetricNames: #();
-	methodMetricNames: #();
-	packageMetricNames: #( 'LOC' 'NOM' 'NOC');
-	reportXml_metrics.
+"/
+"/ generate a metrics report
+"/
+#(
+	    'stx:libbasic'
+	    'stx:libbasic2'
+	    'stx:libbasic3'
+	    'stx:libcomp'
+	    'stx:libview'
+	    'stx:libview2'
+	    'stx:libwidg'
+	    'stx:libwidg2'
+	    'stx:libtool'
+	    'stx:libtool2'
+	    'stx:libui'
+	    'stx:libhtml'
+	    'stx:libjavascript'
+	    'stx:goodies/xml/stx'
+	    'stx:goodies/xml/yaxo'
+	    'stx:goodies/xml/xsl'
+	    'stx:goodies/xml/xpath'
+	    'stx:goodies/net'
+	    'stx:goodies/communication'
+	    'stx:goodies/webServer'
+	    'stx:goodies/soap'
+) do:[:p | Smalltalk loadPackage:p].
+
+(Smalltalk commandLineArgumentNamed:'--skipMetrics') notNil ifTrue:[
+    Stdout showCR:'Skipping metrics.'.
+] ifFalse:[
+    'metrics.xml' asFilename writingFileDo:[:stream |
+	MetricsReporter new
+	    stream: stream;
+	    packages:{
+		'stx:*'       .
+	    };
+	    classMetricNames: #();
+	    methodMetricNames: #();
+	    packageMetricNames: #( 'LOC' 'NOM' 'NOC');
+	    reportXml_metrics.
+    ].
 ].
 
 !