Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F266617A21 for ; Sun, 5 Oct 2014 09:05:13 +0000 (UTC) Received: (qmail 15758 invoked by uid 500); 5 Oct 2014 09:05:13 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 15688 invoked by uid 500); 5 Oct 2014 09:05:13 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 15351 invoked by uid 99); 5 Oct 2014 09:05:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Oct 2014 09:05:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 7EABC1BC7B; Sun, 5 Oct 2014 09:05:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: piotrz@apache.org To: commits@flex.apache.org Date: Sun, 05 Oct 2014 09:05:25 -0000 Message-Id: <8d7954e33966490d99a2575e87dfe435@git.apache.org> In-Reply-To: <5c131e985f2d494181717d05d3fa0446@git.apache.org> References: <5c131e985f2d494181717d05d3fa0446@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [14/30] Reorganized TLF test applications for using Apache Flex Unit 4.2.0 Changed first 8 tests for Apache Flex Unit Fixed ant build - no test automation yet http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/cad064e0/automation_apps/src/VellumUnit.mxml ---------------------------------------------------------------------- diff --git a/automation_apps/src/VellumUnit.mxml b/automation_apps/src/VellumUnit.mxml index ce40fd8..b23beb8 100644 --- a/automation_apps/src/VellumUnit.mxml +++ b/automation_apps/src/VellumUnit.mxml @@ -18,413 +18,316 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/cad064e0/automation_core/libs/flexunit.swc ---------------------------------------------------------------------- diff --git a/automation_core/libs/flexunit.swc b/automation_core/libs/flexunit.swc new file mode 100644 index 0000000..0722885 Binary files /dev/null and b/automation_core/libs/flexunit.swc differ http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/cad064e0/automation_core/src/AutomationCoreClasses.as ---------------------------------------------------------------------- diff --git a/automation_core/src/AutomationCoreClasses.as b/automation_core/src/AutomationCoreClasses.as index 5c5affd..f2da5aa 100644 --- a/automation_core/src/AutomationCoreClasses.as +++ b/automation_core/src/AutomationCoreClasses.as @@ -20,27 +20,31 @@ package { internal class AutomationCoreClasses { - import UnitTest.ExtendedClasses.TestDescriptor; TestDescriptor; + import UnitTest.ExtendedClasses.VellumTestCase; VellumTestCase; + import UnitTest.Validation.BoundsChecker; BoundsChecker; + import UnitTest.Validation.CompositionResults; CompositionResults; + import UnitTest.Validation.SelectionEventValidator; SelectionEventValidator; + import UnitTest.Validation.DamageEventValidator; DamageEventValidator; + import UnitTest.Validation.StatusChangeEventValidator; StatusChangeEventValidator; + import UnitTest.Validation.FlowOperationEventValidator; FlowOperationEventValidator; + import UnitTest.Validation.CompositionCompleteEventValidator; CompositionCompleteEventValidator; + import UnitTest.Validation.FlowElementMouseEventValidator; FlowElementMouseEventValidator; + import UnitTest.Validation.EventValidator; EventValidator; + import UnitTest.Validation.UpdateCompleteEventValidator; UpdateCompleteEventValidator; + + /*import UnitTest.ExtendedClasses.TestDescriptor; TestDescriptor; import UnitTest.ExtendedClasses.TestSuiteExtended; TestSuiteExtended; import UnitTest.ExtendedClasses.VellumPerformanceCase; VellumPerformanceCase; - import UnitTest.ExtendedClasses.VellumTestCase; VellumTestCase; + import UnitTest.Fixtures.FileRepository; FileRepository; import UnitTest.Fixtures.TestApp; TestApp; import UnitTest.Fixtures.TestConfig; TestConfig; import UnitTest.Fixtures.TestEditManager; TestEditManager; - import UnitTest.Validation.BoundsChecker; BoundsChecker; - import UnitTest.Validation.CompositionCompleteEventValidator; CompositionCompleteEventValidator; - import UnitTest.Validation.CompositionResults; CompositionResults; - import UnitTest.Validation.DamageEventValidator; DamageEventValidator; - import UnitTest.Validation.EventValidator; EventValidator; - import UnitTest.Validation.FlowElementMouseEventValidator; FlowElementMouseEventValidator; - import UnitTest.Validation.FlowOperationEventValidator; FlowOperationEventValidator; + import UnitTest.Validation.LineSnapshot; LineSnapshot; - import UnitTest.Validation.SelectionEventValidator; SelectionEventValidator; - import UnitTest.Validation.StatusChangeEventValidator; StatusChangeEventValidator; - import UnitTest.Validation.UpdateCompleteEventValidator; UpdateCompleteEventValidator; - import UnitTest.Validation.XMLSnapshot; XMLSnapshot; + + import UnitTest.Validation.XMLSnapshot; XMLSnapshot; */ // Alphabetical list of classes to be included as part of vellum.swc. // This should mirror what's in the .flexLibProperties } http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/cad064e0/automation_core/src/UnitTest/ExtendedClasses/TestCaseBase.as ---------------------------------------------------------------------- diff --git a/automation_core/src/UnitTest/ExtendedClasses/TestCaseBase.as b/automation_core/src/UnitTest/ExtendedClasses/TestCaseBase.as new file mode 100644 index 0000000..ff6ff8b --- /dev/null +++ b/automation_core/src/UnitTest/ExtendedClasses/TestCaseBase.as @@ -0,0 +1,35 @@ +/** + * Created with IntelliJ IDEA. + * User: piotr.zarzycki + * Date: 24.03.14 + * Time: 20:49 + * To change this template use File | Settings | File Templates. + */ +package UnitTest.ExtendedClasses +{ + public class TestCaseBase + { + public var setUpDuration:Number; + public var setUpMemInitial:Object; + public var setUpMemFinal:Object; + public var middleDuration:Number; + public var middleMemInitial:Object; + public var middleMemFinal:Object; + public var tearDownDuration:Number; + public var tearDownMemInitial:Object; + public var tearDownMemFinal:Object; + public var metaData:Object; + + public var methodName:String; + + public function TestCaseBase(methodName:String = null) + { + this.methodName = methodName; + } + + public function toString():String + { + return methodName; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/cad064e0/automation_core/src/UnitTest/ExtendedClasses/TestSuiteExtended.as ---------------------------------------------------------------------- diff --git a/automation_core/src/UnitTest/ExtendedClasses/TestSuiteExtended.as b/automation_core/src/UnitTest/ExtendedClasses/TestSuiteExtended.as index bc6e763..81137a3 100644 --- a/automation_core/src/UnitTest/ExtendedClasses/TestSuiteExtended.as +++ b/automation_core/src/UnitTest/ExtendedClasses/TestSuiteExtended.as @@ -16,131 +16,128 @@ // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// -package UnitTest.ExtendedClasses -{ - import flash.events.Event; - import flash.system.System; - import flash.utils.*; - - import flexunit.flexui.*; - import flexunit.framework.*; - import flexunit.runner.*; - import flexunit.textui.*; - import flexunit.utils.*; - - public class TestSuiteExtended extends TestSuite - { - public var _parent:Object; - public var currentTest:Test; - public var testDescArrayList : Collection; - private var runDescIter:Iterator; - private var listener : TestSuiteTestListener; - - public function TestSuiteExtended(parent:Object=null) - { - super(null); - testDescArrayList = Collection( new ArrayList()); - _parent = parent; - } - - override public function runWithResult( result:TestResult ):void - { - runDescIter = testDescArrayList.iterator(); - listener = new TestSuiteTestListener(this, result); - runNext(result); - } +package UnitTest.ExtendedClasses { + + import UnitTest.ExtendedClasses.*; + + import flash.events.Event; + + import flexunit.framework.*; + import flexunit.utils.*; - private static const _a:uint = 1664525; - private static const _c:uint = 1013904223; - private static var _rand:uint = 47; - - // random from 0 to 1 inclusive I think - private static function getRandom():Number - { - _rand = _a*_rand+_c; - return Number(_rand)/uint.MAX_VALUE; - } - - private function chooseRandomTest():Object - { - _rand = _a*_rand+_c; - var index:int = getRandom() * (testDescArrayList.length()+1) - if (index >= testDescArrayList.length()) - index = testDescArrayList.length()-1; - return testDescArrayList.getItemAt(index); - } - - private var __testCount:int = 0; - private var _maxDeltaMemory:int = -1; - private var _maxDeltaTest:int = -1; - - private var repeatForever:Boolean = false; - private var useRandomTest:Boolean = false; - - override public function runNext( result : TestResult) : void + public dynamic class TestSuiteExtended extends TestSuite { - currentTest = null; - if (!runDescIter.hasNext() && repeatForever) - runDescIter = testDescArrayList.iterator(); - if ( runDescIter.hasNext() ) + public var _parent:Object; + public var currentTest:Test; + public var testDescArrayList:Collection; + private var runDescIter:Iterator; + private var listener:TestSuiteTestListener; + + public function TestSuiteExtended(parent:Object = null) + { + super(null); + testDescArrayList = Collection(new ArrayList()); + _parent = parent; + } + + override public function runWithResult(result:TestResult):void + { + runDescIter = testDescArrayList.iterator(); + listener = new TestSuiteTestListener(this, result); + runNext(result); + } + + private static const _a:uint = 1664525; + private static const _c:uint = 1013904223; + private static var _rand:uint = 47; + + // random from 0 to 1 inclusive I think + private static function getRandom():Number + { + _rand = _a * _rand + _c; + return Number(_rand) / uint.MAX_VALUE; + } + + private function chooseRandomTest():Object + { + _rand = _a * _rand + _c; + var index:int = getRandom() * (testDescArrayList.length() + 1) + if (index >= testDescArrayList.length()) + index = testDescArrayList.length() - 1; + return testDescArrayList.getItemAt(index); + } + + private var __testCount:int = 0; + private var _maxDeltaMemory:int = -1; + private var _maxDeltaTest:int = -1; + + private var repeatForever:Boolean = false; + private var useRandomTest:Boolean = false; + + override public function runNext(result:TestResult):void { - if ( result.shouldStop() ) + currentTest = null; + if (!runDescIter.hasNext() && repeatForever) + runDescIter = testDescArrayList.iterator(); + if (runDescIter.hasNext()) { + if (result.shouldStop()) + { + listener.pop(); + return; + } + + currentTest = useRandomTest ? chooseRandomTest().makeTest() : runDescIter.next().makeTest(); + + /*var curMemory:int = System.totalMemory; + __testCount++; + trace(__testCount,_maxDeltaTest,_maxDeltaMemory,currentTest.toString());*/ + + runTest(currentTest, result); + + /*System.gc();System.gc(); + var aftMemory:int = System.totalMemory; + var deltaMemory:int = aftMemory-curMemory; + if (deltaMemory > _maxDeltaMemory) + { + _maxDeltaMemory = deltaMemory; + _maxDeltaTest = __testCount; + }*/ + } + else + { + if (_parent != null) + _parent.dispatchEvent(new Event("TestComplete")); listener.pop(); - return; } + } - currentTest = useRandomTest ? chooseRandomTest().makeTest() : runDescIter.next().makeTest(); + private function runTest(test:Test, result:TestResult):void + { + test.runWithResult(result); + } - /*var curMemory:int = System.totalMemory; - __testCount++; - trace(__testCount,_maxDeltaTest,_maxDeltaMemory,currentTest.toString());*/ + override public function testCount():Number + { + return testDescArrayList.length(); + } - runTest( currentTest, result ); + override public function getTests():Array + { + var tempArray:Array = testDescArrayList.toArray(); + return testDescArrayList.toArray(); + } - /*System.gc();System.gc(); - var aftMemory:int = System.totalMemory; - var deltaMemory:int = aftMemory-curMemory; - if (deltaMemory > _maxDeltaMemory) - { - _maxDeltaMemory = deltaMemory; - _maxDeltaTest = __testCount; - }*/ + public function addTestDescriptor(descriptor:TestDescriptor):void + { + testDescArrayList.addItem(descriptor); } - else + + override public function countTestCases():Number { - if (_parent != null) - _parent.dispatchEvent(new Event("TestComplete")); - listener.pop(); + return testCount(); // currently it's a flat list. } - } - private function runTest( test:Test, result:TestResult ):void - { - test.runWithResult( result ); - } - - override public function testCount() : Number - { - return testDescArrayList.length(); - } - - override public function getTests() : Array - { - var tempArray:Array = testDescArrayList.toArray(); - return testDescArrayList.toArray(); - } - - public function addTestDescriptor ( descriptor:TestDescriptor ) : void - { - testDescArrayList.addItem (descriptor); - } - - override public function countTestCases() : Number - { - return testCount(); // currently it's a flat list. - } - - } + } } http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/cad064e0/automation_core/src/UnitTest/ExtendedClasses/VellumPerformanceCase.as ---------------------------------------------------------------------- diff --git a/automation_core/src/UnitTest/ExtendedClasses/VellumPerformanceCase.as b/automation_core/src/UnitTest/ExtendedClasses/VellumPerformanceCase.as index 2f032c8..a914729 100644 --- a/automation_core/src/UnitTest/ExtendedClasses/VellumPerformanceCase.as +++ b/automation_core/src/UnitTest/ExtendedClasses/VellumPerformanceCase.as @@ -19,15 +19,16 @@ package UnitTest.ExtendedClasses { import flash.events.Event; + import flash.utils.getQualifiedClassName; - import flexunit.framework.TestCase; + import flexunit.framework.TestCase; import flexunit.framework.TestSuite; import mx.collections.ArrayCollection; import mx.controls.ComboBox; import mx.containers.Canvas; - public class VellumPerformanceCase extends TestCase + public class VellumPerformanceCase extends TestCaseBase { private static const standardTimeout:int = 1000000; public static var testApp:Canvas; @@ -48,7 +49,8 @@ package UnitTest.ExtendedClasses } // always add className to the TestID - TestID = className.substr(className.lastIndexOf(':')+1) + '.'; + var className:String = getQualifiedClassName(this); + TestID = className.substr(className.lastIndexOf(':')+1) + '.'; TestID = TestID + ((TestData.id) ? TestData.id : methodName); super(methodName); @@ -56,7 +58,7 @@ package UnitTest.ExtendedClasses override public function toString():String { - return TestID + " (" + className + ")"; + return TestID + " (" + getQualifiedClassName(this) + ")"; } public static function suiteFromXML(testCaseClass:Class, testListXML:XML):TestSuite @@ -69,14 +71,15 @@ package UnitTest.ExtendedClasses return ts; } - override public function tearDown() : void + public function tearDown() : void { TestData = null; } public function addAsyncForTestComplete (timeout:int = standardTimeout):void { - testApp.addEventListener(Event.COMPLETE, addAsync(testComplete, timeout, null)); + //TODO: Add Support for addSync PZ + //testApp.addEventListener(Event.COMPLETE, addAsync(testComplete, timeout, null)); } /** empty testComplete to call once the performance app sends