Change TestConfigurationLoader to handle loading files with TextFlow from configuration
Add configuration loader to FactoryImportTest
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 @@
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 @@
{
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]);
}
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 @@
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
{
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 @@
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 @@
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 @@
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);