Repository: flex-tlf Updated Branches: refs/heads/develop 4a5d0338f -> a3dbb20c6
Change TestConfigurationLoader to handle loading files with TextFlow from configuration Add configuration loader to FactoryImportTest Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/a3dbb20c Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/a3dbb20c Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/a3dbb20c Branch: refs/heads/develop Commit: a3dbb20c6a6512c1fb0a03e6aac9e0ceee200ebb Parents: 4a5d033 Author: piotrz <[email protected]> Authored: Sat Mar 14 23:13:46 2015 +0100 Committer: piotrz <[email protected]> Committed: Sat Mar 14 23:13:46 2015 +0100 ---------------------------------------------------------------------- .../ExtendedClasses/TestConfigurationLoader.as | 9 +++++++++ .../src/UnitTest/Tests/AllEventTest.as | 10 ---------- .../src/UnitTest/Tests/FactoryImportTest.as | 18 +++++++++++++----- 3 files changed, 22 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/a3dbb20c/automation_core/src/UnitTest/ExtendedClasses/TestConfigurationLoader.as ---------------------------------------------------------------------- diff --git a/automation_core/src/UnitTest/ExtendedClasses/TestConfigurationLoader.as b/automation_core/src/UnitTest/ExtendedClasses/TestConfigurationLoader.as index f252ff9..f4c7db6 100644 --- a/automation_core/src/UnitTest/ExtendedClasses/TestConfigurationLoader.as +++ b/automation_core/src/UnitTest/ExtendedClasses/TestConfigurationLoader.as @@ -18,6 +18,7 @@ //////////////////////////////////////////////////////////////////////////////// package UnitTest.ExtendedClasses { + import UnitTest.Fixtures.FileRepository; import UnitTest.Fixtures.TestCaseVo; import UnitTest.Fixtures.TestConfig; @@ -31,6 +32,8 @@ package UnitTest.ExtendedClasses public class TestConfigurationLoader implements IExternalDependencyLoader, IResponder { + private const TEST_CONTENT_PATH:String = "../../test/testFiles/markup/tlf/"; + private var httpService:HTTPService; private var token:ExternalDependencyToken; private var testName:String; @@ -81,9 +84,15 @@ package UnitTest.ExtendedClasses { var testsData:XMLList = testCase.TestData; var testCaseVo:TestCaseVo = new TestCaseVo(testCase.@functionName); + var fileLoaded:Boolean = false; for each (var testData:XML in testsData) { testCaseVo[testData.@name] = testData.toString(); + if (testCaseVo.fileName && !fileLoaded) + { + FileRepository.readFile(TestConfig.getInstance().baseURL, TEST_CONTENT_PATH.concat(testCaseVo.fileName), null, fault); + fileLoaded = true; + } } testConfigData.push([testCaseVo]); } http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/a3dbb20c/automation_tests/src/UnitTest/Tests/AllEventTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/AllEventTest.as b/automation_tests/src/UnitTest/Tests/AllEventTest.as index a5f7418..b3c0f66 100644 --- a/automation_tests/src/UnitTest/Tests/AllEventTest.as +++ b/automation_tests/src/UnitTest/Tests/AllEventTest.as @@ -115,16 +115,6 @@ package UnitTest.Tests metaData.productArea = "Text Composition"; } - [BeforeClass] - public static function setUpClass():void - { - var testConfig:TestConfig = TestConfig.getInstance(); - FileRepository.readFile(testConfig.baseURL, "../../test/testFiles/markup/tlf/ShortTextMouseEventTBLTR.xml"); - FileRepository.readFile(testConfig.baseURL, "../../test/testFiles/markup/tlf/ShortTextMouseEventTBRTL.xml"); - FileRepository.readFile(testConfig.baseURL, "../../test/testFiles/markup/tlf/ShortTextMouseEventRLLTR.xml"); - FileRepository.readFile(testConfig.baseURL, "../../test/testFiles/markup/tlf/ShortTextMouseEventRLRTL.xml"); - } - [Before] override public function setUpTest():void { http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/a3dbb20c/automation_tests/src/UnitTest/Tests/FactoryImportTest.as ---------------------------------------------------------------------- diff --git a/automation_tests/src/UnitTest/Tests/FactoryImportTest.as b/automation_tests/src/UnitTest/Tests/FactoryImportTest.as index 04f6793..1bd55e2 100644 --- a/automation_tests/src/UnitTest/Tests/FactoryImportTest.as +++ b/automation_tests/src/UnitTest/Tests/FactoryImportTest.as @@ -18,8 +18,10 @@ //////////////////////////////////////////////////////////////////////////////// package UnitTest.Tests { + import UnitTest.ExtendedClasses.TestConfigurationLoader; import UnitTest.ExtendedClasses.VellumTestCase; import UnitTest.Fixtures.FileRepository; + import UnitTest.Fixtures.TestCaseVo; import UnitTest.Fixtures.TestConfig; import flash.display.*; @@ -38,8 +40,15 @@ package UnitTest.Tests import org.flexunit.asserts.fail; [TestCase(order=2)] + [RunWith("org.flexunit.runners.Parameterized")] public class FactoryImportTest extends VellumTestCase { + [DataPoints(loader="importTestLoader")] + [ArrayElementType("UnitTest.Fixtures.TestCaseVo")] + public static var importTestDp:Array; + + public static var importTestLoader:TestConfigurationLoader = new TestConfigurationLoader("../../test/testCases/FactoryImportTests.xml", "importTest"); + private var ItemsToRemove:Array; private var TestCanvas:Canvas = null; private var fileForFactory:String; @@ -50,8 +59,6 @@ package UnitTest.Tests super("", "EventOverrideTest", TestConfig.getInstance()); containerType = "custom"; - fileForFactory = "simple.xml"; - metaData = {}; // Note: These must correspond to a Watson product area (case-sensitive) metaData.productArea = "Import/Export"; @@ -79,15 +86,16 @@ package UnitTest.Tests super.tearDownTest(); } - [Test] - public function importTest():void + [Test(dataProvider=importTestDp)] + public function importTest(dpData:TestCaseVo):void { - var xmlRoot:XML = FileRepository.getFileAsXML(baseURL, "../../test/testFiles/markup/tlf/" + fileForFactory); + var xmlRoot:XML = FileRepository.getFileAsXML(baseURL, "../../test/testFiles/markup/tlf/" + dpData.fileName); if (!xmlRoot) { fail("File not loaded -- timeout?"); return; } + fileForFactory = dpData.fileName; var parser:ITextImporter = testDataImportParser; flowFromXML = parser.importToFlow(xmlRoot); processInlines(flowFromXML);
