diff bindings/as3/ext/asunit/framework/TestMethod.as @ 732:3a0b9700b3d2

* Initial AS3 commit
author mas01mj
date Tue, 14 Sep 2010 16:47:10 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/as3/ext/asunit/framework/TestMethod.as	Tue Sep 14 16:47:10 2010 +0000
@@ -0,0 +1,38 @@
+package asunit.framework {
+    
+    import flash.utils.getTimer;
+    
+    /**
+     * A <code>TestFailure</code> collects a failed test together with
+     * the caught exception.
+     * @see TestResult
+     */
+    public class TestMethod {
+        protected var test:Test;
+        protected var method:String;
+        
+        private var _duration:Number;
+        private var start:Number;
+        
+        /**
+         * Constructs a TestMethod with a given Test and method name.
+         */
+        public function TestMethod(test:Test, method:String) {
+            this.test = test;
+            this.method = method;
+            start = getTimer();
+        }
+        
+        public function getName():String {
+            return method;
+        }
+        
+        public function endTest(test:Test):void {
+            _duration = (getTimer() - start) * .001;
+        }
+        
+        public function duration():Number {
+            return _duration;
+        }
+    }
+}
\ No newline at end of file