[mapguide-commits] r7958 - in trunk/Tools/Maestro: MaestroAPITestRunner MaestroAPITests
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Dec 20 06:43:19 PST 2013
Author: jng
Date: 2013-12-20 06:43:19 -0800 (Fri, 20 Dec 2013)
New Revision: 7958
Added:
trunk/Tools/Maestro/MaestroAPITestRunner/TestMaestroAPI.xml
Modified:
trunk/Tools/Maestro/MaestroAPITestRunner/MaestroAPITestRunner.csproj
trunk/Tools/Maestro/MaestroAPITestRunner/Program.cs
trunk/Tools/Maestro/MaestroAPITests/CapabilityTests.cs
trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs
trunk/Tools/Maestro/MaestroAPITests/ExpressionTests.cs
trunk/Tools/Maestro/MaestroAPITests/FeatureReaderTests.cs
trunk/Tools/Maestro/MaestroAPITests/GeoRestTests.cs
trunk/Tools/Maestro/MaestroAPITests/HttpConnectionTests.cs
trunk/Tools/Maestro/MaestroAPITests/HttpSiteTests.cs
trunk/Tools/Maestro/MaestroAPITests/LocalConnectionTests.cs
trunk/Tools/Maestro/MaestroAPITests/LocalNativeFeatureTests.cs
trunk/Tools/Maestro/MaestroAPITests/LocalNativePerformanceTests.cs
trunk/Tools/Maestro/MaestroAPITests/MiscTests.cs
trunk/Tools/Maestro/MaestroAPITests/ObjectTests.cs
trunk/Tools/Maestro/MaestroAPITests/ResourceTests.cs
trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs
trunk/Tools/Maestro/MaestroAPITests/SerializationTests.cs
trunk/Tools/Maestro/MaestroAPITests/TestControl.cs
trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs
Log:
#2358: Rework the MaestroAPI test runner to allow for parameterization via an external configuration file.
Modified: trunk/Tools/Maestro/MaestroAPITestRunner/MaestroAPITestRunner.csproj
===================================================================
--- trunk/Tools/Maestro/MaestroAPITestRunner/MaestroAPITestRunner.csproj 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITestRunner/MaestroAPITestRunner.csproj 2013-12-20 14:43:19 UTC (rev 7958)
@@ -101,6 +101,9 @@
<Content Include="ConnectionProviders.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="TestMaestroAPI.xml">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
Modified: trunk/Tools/Maestro/MaestroAPITestRunner/Program.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITestRunner/Program.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITestRunner/Program.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -24,6 +24,7 @@
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
+using MaestroAPITests;
namespace MaestroAPITestRunner
{
@@ -63,7 +64,7 @@
runnerArgs[0] = args[0];
else
runnerArgs[0] = "MaestroAPITests.dll";
-
+
NUnit.ConsoleRunner.Runner.Main(runnerArgs);
}
}
Added: trunk/Tools/Maestro/MaestroAPITestRunner/TestMaestroAPI.xml
===================================================================
--- trunk/Tools/Maestro/MaestroAPITestRunner/TestMaestroAPI.xml (rev 0)
+++ trunk/Tools/Maestro/MaestroAPITestRunner/TestMaestroAPI.xml 2013-12-20 14:43:19 UTC (rev 7958)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<TestConfiguration>
+ <TestSettings>
+ <LocalNativeConfigFile>MGOS22\webconfig.ini</LocalNativeConfigFile>
+ <LocalNativeUsername>Administrator</LocalNativeUsername>
+ <LocalNativePassword>admin</LocalNativePassword>
+ <LocalConfigFile>Platform.ini</LocalConfigFile>
+ <HttpUrl>http://localhost/mapguide/mapagent/mapagent.fcgi</HttpUrl>
+ <HttpUsername>Administrator</HttpUsername>
+ <HttpPassword>admin</HttpPassword>
+ <GeoRestUrl>http://localhost:99/</GeoRestUrl>
+ <GeoRestConfig>UserTestData\GeoRestConfig.xml</GeoRestConfig>
+ </TestSettings>
+ <TestControl>
+ <IgnoreConfigurationTests>false</IgnoreConfigurationTests>
+ <IgnoreCapabilityTests>false</IgnoreCapabilityTests>
+ <IgnoreExpressionTests>false</IgnoreExpressionTests>
+ <IgnoreFeatureReaderTests>false</IgnoreFeatureReaderTests>
+ <IgnoreHttpConnectionTests>false</IgnoreHttpConnectionTests>
+ <IgnoreHttpSiteTests>false</IgnoreHttpSiteTests>
+ <IgnoreObjectTests>false</IgnoreObjectTests>
+ <IgnoreResourceTests>false</IgnoreResourceTests>
+ <IgnoreHttpRuntimeMapTests>false</IgnoreHttpRuntimeMapTests>
+ <IgnoreLocalRuntimeMapTests>false</IgnoreLocalRuntimeMapTests>
+ <IgnoreLocalNativeRuntimeMapTests>true</IgnoreLocalNativeRuntimeMapTests>
+ <IgnoreLocalNativePerformanceTests>true</IgnoreLocalNativePerformanceTests>
+ <IgnoreLocalNativeFeatureTests>true</IgnoreLocalNativeFeatureTests>
+ <IgnoreGeoRestTests>true</IgnoreGeoRestTests>
+ <IgnoreLocalFeatureTests>false</IgnoreLocalFeatureTests>
+ <IgnoreSchemaTests>false</IgnoreSchemaTests>
+ <IgnoreSerializationTests>false</IgnoreSerializationTests>
+ <IgnoreValidationTests>false</IgnoreValidationTests>
+ <IgnoreMiscTests>false</IgnoreMiscTests>
+ </TestControl>
+</TestConfiguration>
\ No newline at end of file
Modified: trunk/Tools/Maestro/MaestroAPITests/CapabilityTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/CapabilityTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/CapabilityTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -29,9 +29,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreCapabilityTests)]
+ [TestFixture]
public class CapabilityTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreCapabilityTests)
+ Assert.Ignore("Skipping CapabilityTests because TestControl.IgnoreCapabilityTests = true");
+ }
+
private Mockery _mocks;
[Test]
Modified: trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -29,9 +29,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreConfigurationTests)]
+ [TestFixture]
public class ConfigurationTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreConfigurationTests)
+ Assert.Ignore("Skipping ConfigurationTests because TestControl.IgnoreConfigurationTests = true");
+ }
+
[Test]
public void TestOdbcLoad()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/ExpressionTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ExpressionTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/ExpressionTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -39,9 +39,16 @@
// 2 | snafu | (null)
// 2 | (null) | (null)
- [TestFixture(Ignore = TestControl.IgnoreExpressionTests)]
+ [TestFixture]
public class ExpressionTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreExpressionTests)
+ Assert.Ignore("Skipping ExpressionTests because TestControl.IgnoreExpressionTests = true");
+ }
+
[Test]
public void TestMismatch()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/FeatureReaderTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/FeatureReaderTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/FeatureReaderTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -28,9 +28,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreFeatureReaderTests)]
+ [TestFixture]
public class FeatureReaderTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreFeatureReaderTests)
+ Assert.Ignore("Skipping FeatureReaderTests because TestControl.IgnoreFeatureReaderTests = true");
+ }
+
[Test]
public void TestXmlFeatureNullValues()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/GeoRestTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/GeoRestTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/GeoRestTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -28,9 +28,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreGeoRestTests)]
+ [TestFixture]
public class GeoRestTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreGeoRestTests)
+ Assert.Ignore("Skipping GeoRestTests because TestControl.IgnoreGeoRestTests = true");
+ }
+
[Test]
public void TestInsert()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/HttpConnectionTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/HttpConnectionTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/HttpConnectionTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -31,9 +31,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreHttpConnectionTests)]
+ [TestFixture]
public class HttpConnectionTests : ConnectionTestBase
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreHttpConnectionTests)
+ Assert.Ignore("Skipping HttpConnectionTests because TestControl.IgnoreHttpConnectionTests = true");
+ }
+
//[Test]
public override void TestEncryptedFeatureSourceCredentials()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/HttpSiteTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/HttpSiteTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/HttpSiteTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -29,9 +29,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreHttpSiteTests)]
+ [TestFixture]
public class HttpSiteTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreHttpSiteTests)
+ Assert.Ignore("Skipping HttpSiteTests because TestControl.IgnoreHttpSiteTests = true");
+ }
+
private IServerConnection CreateTestConnection()
{
return ConnectionUtil.CreateTestHttpConnection();
Modified: trunk/Tools/Maestro/MaestroAPITests/LocalConnectionTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/LocalConnectionTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/LocalConnectionTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -35,9 +35,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreLocalNativeFeatureTests)]
+ [TestFixture]
public class LocalConnectionTests : ConnectionTestBase
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreLocalFeatureTests)
+ Assert.Ignore("Skipping LocalConnectionTests because TestControl.IgnoreLocalFeatureTests = true");
+ }
+
protected override IServerConnection CreateTestConnection()
{
return ConnectionUtil.CreateTestLocalConnection();
Modified: trunk/Tools/Maestro/MaestroAPITests/LocalNativeFeatureTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/LocalNativeFeatureTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/LocalNativeFeatureTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -35,9 +35,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreLocalNativeFeatureTests)]
+ [TestFixture]
public class LocalNativeFeatureTests : ConnectionTestBase
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreLocalNativeFeatureTests)
+ Assert.Ignore("Skipping LocalNativeFeatureTests because TestControl.IgnoreLocalNativeFeatureTests = true");
+ }
+
protected override IServerConnection CreateTestConnection()
{
return ConnectionUtil.CreateTestLocalNativeConnection();
Modified: trunk/Tools/Maestro/MaestroAPITests/LocalNativePerformanceTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/LocalNativePerformanceTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/LocalNativePerformanceTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -25,9 +25,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreLocalNativePerformanceTests)]
+ [TestFixture]
public class LocalNativePerformanceTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreLocalNativePerformanceTests)
+ Assert.Ignore("Skipping LocalNativePerformanceTests because TestControl.IgnoreLocalNativePerformanceTests = true");
+ }
+
[Test]
public void TestCase1914()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/MiscTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/MiscTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/MiscTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -25,9 +25,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreMiscTests)]
+ [TestFixture]
public class MiscTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreMiscTests)
+ Assert.Ignore("Skipping MiscTests because TestControl.IgnoreMiscTests = true");
+ }
+
[Test]
public void TestParse3dWkt()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/ObjectTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ObjectTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/ObjectTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -32,9 +32,16 @@
///
/// Also tests for various classes (not belonging to any particular group) reside here
/// </summary>
- [TestFixture(Ignore = TestControl.IgnoreObjectTests)]
+ [TestFixture]
public class ObjectTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreObjectTests)
+ Assert.Ignore("Skipping ObjectTests because TestControl.IgnoreObjectTests = true");
+ }
+
[Test]
public void TestConnectionString()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/ResourceTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ResourceTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/ResourceTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -45,9 +45,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreResourceTests)]
+ [TestFixture]
public class ResourceTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreResourceTests)
+ Assert.Ignore("Skipping ResourceTests because TestControl.IgnoreResourceTests = true");
+ }
+
private Mockery _mocks;
[Test]
Modified: trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -54,6 +54,9 @@
{
if (!_registered)
{
+ TestEnvironment.Initialize("TestMaestroAPI.xml");
+ TestEnvironment.PrintSummary();
+
ResourceValidatorLoader.LoadStockValidators();
ModelSetup.Initialize();
_registered = true;
@@ -70,17 +73,31 @@
{
protected IServerConnection _conn;
+ protected virtual bool ShouldIgnore(out string reason)
+ {
+ reason = string.Empty;
+ return false;
+ }
+
[TestFixtureSetUp]
public void TestFixtureSetup()
{
- try
+ string reason;
+ if (this.ShouldIgnore(out reason))
{
- _conn = CreateTestConnection();
- SetupTestData();
+ Assert.Ignore(reason);
}
- catch (Exception)
+ else
{
- throw;
+ try
+ {
+ _conn = CreateTestConnection();
+ SetupTestData();
+ }
+ catch (Exception)
+ {
+ throw;
+ }
}
}
@@ -1180,9 +1197,18 @@
}
}
- [TestFixture(Ignore = TestControl.IgnoreHttpRuntimeMapTests)]
+ [TestFixture]
public class HttpRuntimeMapTests : RuntimeMapTests
{
+ protected override bool ShouldIgnore(out string reason)
+ {
+ reason = string.Empty;
+ if (TestControl.IgnoreHttpRuntimeMapTests)
+ reason = "Skipping HttpRuntimeMapTests because TestControl.IgnoreHttpRuntimeMapTests = true";
+
+ return TestControl.IgnoreHttpRuntimeMapTests;
+ }
+
protected override IServerConnection CreateTestConnection()
{
return ConnectionUtil.CreateTestHttpConnection();
@@ -1566,9 +1592,18 @@
}
}
- [TestFixture(Ignore = TestControl.IgnoreLocalNativeRuntimeMapTests)]
+ [TestFixture]
public class LocalNativeRuntimeMapTests : RuntimeMapTests
{
+ protected override bool ShouldIgnore(out string reason)
+ {
+ reason = string.Empty;
+ if (TestControl.IgnoreLocalNativeRuntimeMapTests)
+ reason = "Skipping LocalNativeRuntimeMapTests because TestControl.IgnoreLocalNativeRuntimeMapTests = true";
+
+ return TestControl.IgnoreLocalNativeRuntimeMapTests;
+ }
+
protected override IServerConnection CreateTestConnection()
{
return ConnectionUtil.CreateTestLocalNativeConnection();
@@ -1658,9 +1693,18 @@
}
}
- [TestFixture(Ignore = TestControl.IgnoreLocalRuntimeMapTests)]
+ [TestFixture]
public class LocalRuntimeMapTests : RuntimeMapTests
{
+ protected override bool ShouldIgnore(out string reason)
+ {
+ reason = string.Empty;
+ if (TestControl.IgnoreLocalRuntimeMapTests)
+ reason = "Skipping LocalRuntimeMapTests because TestControl.IgnoreLocalRuntimeMapTests = true";
+
+ return TestControl.IgnoreLocalRuntimeMapTests;
+ }
+
protected override IServerConnection CreateTestConnection()
{
return ConnectionUtil.CreateTestLocalConnection();
Modified: trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -28,9 +28,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreSchemaTests)]
+ [TestFixture]
public class SchemaTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreSchemaTests)
+ Assert.Ignore("Skipping SchemaTests because TestControl.IgnoreSchemaTests = true");
+ }
+
//These tests are to verify that we can read FDO XML configuration and schema documents without problems
[Test]
Modified: trunk/Tools/Maestro/MaestroAPITests/SerializationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/SerializationTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/SerializationTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -27,9 +27,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreSerializationTests)]
+ [TestFixture]
public class SerializationTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreSerializationTests)
+ Assert.Ignore("Skipping SerializationTests because TestControl.IgnoreSerializationTests = true");
+ }
+
[Test]
public void TestPreMg22FdoCapabilities()
{
Modified: trunk/Tools/Maestro/MaestroAPITests/TestControl.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/TestControl.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/TestControl.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -21,91 +21,189 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI;
+using System.IO;
+using System.Xml;
namespace MaestroAPITests
{
- //Use this to toggle individual test suites
- //
- //TODO: To support parameterization, these settings should all be read from a text file
+ public static class TestEnvironment
+ {
+ public static string LocalNativeConfigFile = "MGOS22\\webconfig.ini";
+ public static string LocalNativeUsername = "Administrator";
+ public static string LocalNativePassword = "admin";
- public class TestControl
+ public static string LocalConfigFile = "Platform.ini";
+
+ public static string HttpUrl = "http://localhost/mapguide/mapagent/mapagent.fcgi";
+ public static string HttpUsername = "Administrator";
+ public static string HttpPassword = "admin";
+
+ public static string GeoRestUrl = "http://localhost:99/";
+ public static string GeoRestConfig = "UserTestData\\GeoRestConfig.xml";
+
+ public static void Initialize(string initFile)
+ {
+ if (File.Exists(initFile))
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.Load(initFile);
+
+ var settings = doc.SelectSingleNode("//TestConfiguration/TestSettings");
+ if (settings != null)
+ {
+ if (settings["LocalNativeConfigFile"] != null)
+ TestEnvironment.LocalNativeConfigFile = settings["LocalNativeConfigFile"].InnerText;
+ if (settings["LocalNativeUsername"] != null)
+ TestEnvironment.LocalNativeUsername = settings["LocalNativeUsername"].InnerText;
+ if (settings["LocalNativePassword"] != null)
+ TestEnvironment.LocalNativePassword = settings["LocalNativePassword"].InnerText;
+ if (settings["LocalConfigFile"] != null)
+ TestEnvironment.LocalConfigFile = settings["LocalConfigFile"].InnerText;
+ if (settings["HttpUrl"] != null)
+ TestEnvironment.HttpUrl = settings["HttpUrl"].InnerText;
+ if (settings["HttpUsername"] != null)
+ TestEnvironment.HttpUsername = settings["HttpUsername"].InnerText;
+ if (settings["HttpPassword"] != null)
+ TestEnvironment.HttpPassword = settings["HttpPassword"].InnerText;
+ if (settings["GeoRestUrl"] != null)
+ TestEnvironment.GeoRestUrl = settings["GeoRestUrl"].InnerText;
+ if (settings["GeoRestConfig"] != null)
+ TestEnvironment.GeoRestConfig = settings["GeoRestConfig"].InnerText;
+ }
+ var control = doc.SelectSingleNode("//TestConfiguration/TestControl");
+ if (control != null)
+ {
+ if (control["IgnoreConfigurationTests"] != null)
+ TestControl.IgnoreConfigurationTests = control["IgnoreConfigurationTests"].InnerText == "true";
+ if (control["IgnoreCapabilityTests"] != null)
+ TestControl.IgnoreCapabilityTests = control["IgnoreCapabilityTests"].InnerText == "true";
+ if (control["IgnoreExpressionTests"] != null)
+ TestControl.IgnoreExpressionTests = control["IgnoreExpressionTests"].InnerText == "true";
+ if (control["IgnoreFeatureReaderTests"] != null)
+ TestControl.IgnoreFeatureReaderTests = control["IgnoreFeatureReaderTests"].InnerText == "true";
+ if (control["IgnoreHttpConnectionTests"] != null)
+ TestControl.IgnoreHttpConnectionTests = control["IgnoreHttpConnectionTests"].InnerText == "true";
+ if (control["IgnoreHttpSiteTests"] != null)
+ TestControl.IgnoreHttpSiteTests = control["IgnoreHttpSiteTests"].InnerText == "true";
+ if (control["IgnoreObjectTests"] != null)
+ TestControl.IgnoreObjectTests = control["IgnoreObjectTests"].InnerText == "true";
+ if (control["IgnoreResourceTests"] != null)
+ TestControl.IgnoreResourceTests = control["IgnoreResourceTests"].InnerText == "true";
+ if (control["IgnoreHttpRuntimeMapTests"] != null)
+ TestControl.IgnoreHttpRuntimeMapTests = control["IgnoreHttpRuntimeMapTests"].InnerText == "true";
+ if (control["IgnoreLocalRuntimeMapTests"] != null)
+ TestControl.IgnoreLocalRuntimeMapTests = control["IgnoreLocalRuntimeMapTests"].InnerText == "true";
+ if (control["IgnoreLocalNativeRuntimeMapTests"] != null)
+ TestControl.IgnoreLocalNativeRuntimeMapTests = control["IgnoreLocalNativeRuntimeMapTests"].InnerText == "true";
+ if (control["IgnoreLocalNativePerformanceTests"] != null)
+ TestControl.IgnoreLocalNativePerformanceTests = control["IgnoreLocalNativePerformanceTests"].InnerText == "true";
+ if (control["IgnoreLocalNativeFeatureTests"] != null)
+ TestControl.IgnoreLocalNativeFeatureTests = control["IgnoreLocalNativeFeatureTests"].InnerText == "true";
+ if (control["IgnoreGeoRestTests"] != null)
+ TestControl.IgnoreGeoRestTests = control["IgnoreGeoRestTests"].InnerText == "true";
+ if (control["IgnoreLocalFeatureTests"] != null)
+ TestControl.IgnoreLocalFeatureTests = control["IgnoreLocalFeatureTests"].InnerText == "true";
+ if (control["IgnoreSchemaTests"] != null)
+ TestControl.IgnoreSchemaTests = control["IgnoreSchemaTests"].InnerText == "true";
+ if (control["IgnoreSerializationTests"] != null)
+ TestControl.IgnoreSerializationTests = control["IgnoreSerializationTests"].InnerText == "true";
+ if (control["IgnoreValidationTests"] != null)
+ TestControl.IgnoreValidationTests = control["IgnoreValidationTests"].InnerText == "true";
+ if (control["IgnoreMiscTests"] != null)
+ TestControl.IgnoreMiscTests = control["IgnoreMiscTests"].InnerText == "true";
+ }
+ }
+ }
+
+ public static void PrintSummary()
+ {
+ Console.WriteLine("********************** Test Settings *************************");
+ Console.WriteLine("LocalNativeConfigFile = {0}", TestEnvironment.LocalNativeConfigFile);
+ Console.WriteLine("LocalNativeUsername = {0}", TestEnvironment.LocalNativeUsername);
+ Console.WriteLine("LocalNativePassword = {0}", TestEnvironment.LocalNativePassword);
+ Console.WriteLine("LocalConfigFile = {0}", TestEnvironment.LocalConfigFile);
+ Console.WriteLine("HttpUrl = {0}", TestEnvironment.HttpUrl);
+ Console.WriteLine("HttpUsername = {0}", TestEnvironment.HttpUsername);
+ Console.WriteLine("HttpPassword = {0}", TestEnvironment.HttpPassword);
+ Console.WriteLine("GeoRestUrl = {0}", TestEnvironment.GeoRestUrl);
+ Console.WriteLine("GeoRestConfig = {0}", TestEnvironment.GeoRestConfig);
+ Console.WriteLine("********************** Test Control **************************");
+ Console.WriteLine("IgnoreConfigurationTests = {0}", TestControl.IgnoreConfigurationTests);
+ Console.WriteLine("IgnoreCapabilityTests = {0}", TestControl.IgnoreCapabilityTests);
+ Console.WriteLine("IgnoreExpressionTests = {0}", TestControl.IgnoreExpressionTests);
+ Console.WriteLine("IgnoreFeatureReaderTests = {0}", TestControl.IgnoreFeatureReaderTests);
+ Console.WriteLine("IgnoreHttpConnectionTests = {0}", TestControl.IgnoreHttpConnectionTests);
+ Console.WriteLine("IgnoreHttpSiteTests = {0}", TestControl.IgnoreHttpSiteTests);
+ Console.WriteLine("IgnoreHttpRuntimeMapTests = {0}", TestControl.IgnoreHttpRuntimeMapTests);
+ Console.WriteLine("IgnoreObjectTests = {0}", TestControl.IgnoreObjectTests);
+ Console.WriteLine("IgnoreResourceTests = {0}", TestControl.IgnoreResourceTests);
+ Console.WriteLine("IgnoreLocalRuntimeMapTests = {0}", TestControl.IgnoreLocalRuntimeMapTests);
+ Console.WriteLine("IgnoreLocalNativeRuntimeMapTests = {0}", TestControl.IgnoreLocalNativeRuntimeMapTests);
+ Console.WriteLine("IgnoreLocalNativePerformanceTests = {0}", TestControl.IgnoreLocalNativePerformanceTests);
+ Console.WriteLine("IgnoreLocalNativeFeatureTests = {0}", TestControl.IgnoreLocalNativeFeatureTests);
+ Console.WriteLine("IgnoreGeoRestTests = {0}", TestControl.IgnoreGeoRestTests);
+ Console.WriteLine("IgnoreLocalFeatureTests = {0}", TestControl.IgnoreLocalFeatureTests);
+ Console.WriteLine("IgnoreSchemaTests = {0}", TestControl.IgnoreSchemaTests);
+ Console.WriteLine("IgnoreSerializationTests = {0}", TestControl.IgnoreSerializationTests);
+ Console.WriteLine("IgnoreValidationTests = {0}", TestControl.IgnoreValidationTests);
+ Console.WriteLine("IgnoreMiscTests = {0}", TestControl.IgnoreMiscTests);
+ }
+ }
+
+ internal class TestControl
{
- public const bool IgnoreConfigurationTests = false;
- public const bool IgnoreCapabilityTests = false;
- public const bool IgnoreExpressionTests = false;
- public const bool IgnoreFeatureReaderTests = false;
- public const bool IgnoreHttpConnectionTests = false;
- public const bool IgnoreHttpSiteTests = false;
- public const bool IgnoreObjectTests = false;
- public const bool IgnoreResourceTests = false;
- public const bool IgnoreHttpRuntimeMapTests = false;
- public const bool IgnoreLocalRuntimeMapTests = false;
- public const bool IgnoreLocalNativeRuntimeMapTests = true;
- public const bool IgnoreLocalNativePerformanceTests = true;
- public const bool IgnoreLocalNativeFeatureTests = true;
- public const bool IgnoreGeoRestTests = true;
- public const bool IgnoreLocalFeatureTests = false;
- public const bool IgnoreSchemaTests = false;
- public const bool IgnoreSerializationTests = false;
- public const bool IgnoreValidationTests = false;
- public const bool IgnoreMiscTests = false;
+ public static bool IgnoreConfigurationTests = false;
+ public static bool IgnoreCapabilityTests = false;
+ public static bool IgnoreExpressionTests = false;
+ public static bool IgnoreFeatureReaderTests = false;
+ public static bool IgnoreHttpConnectionTests = false;
+ public static bool IgnoreHttpSiteTests = false;
+ public static bool IgnoreObjectTests = false;
+ public static bool IgnoreResourceTests = false;
+ public static bool IgnoreHttpRuntimeMapTests = false;
+ public static bool IgnoreLocalRuntimeMapTests = false;
+ public static bool IgnoreLocalNativeRuntimeMapTests = true;
+ public static bool IgnoreLocalNativePerformanceTests = true;
+ public static bool IgnoreLocalNativeFeatureTests = true;
+ public static bool IgnoreGeoRestTests = true;
+ public static bool IgnoreLocalFeatureTests = false;
+ public static bool IgnoreSchemaTests = false;
+ public static bool IgnoreSerializationTests = false;
+ public static bool IgnoreValidationTests = false;
+ public static bool IgnoreMiscTests = false;
}
- public class ConnectionUtil
+ internal class ConnectionUtil
{
- public static string Port { get { return "80"; } }
-
public static IServerConnection CreateTestLocalNativeConnection()
{
return ConnectionProviderRegistry.CreateConnection("Maestro.LocalNative",
- "ConfigFile", "MGOS22\\webconfig.ini",
- "Username", "Administrator",
- "Password", "admin");
+ "ConfigFile", TestEnvironment.LocalNativeConfigFile,
+ "Username", TestEnvironment.LocalNativeUsername,
+ "Password", TestEnvironment.LocalNativePassword);
}
public static IServerConnection CreateTestLocalConnection()
{
- return ConnectionProviderRegistry.CreateConnection("Maestro.Local", "ConfigFile", "Platform.ini");
+ return ConnectionProviderRegistry.CreateConnection("Maestro.Local", "ConfigFile", TestEnvironment.LocalConfigFile);
}
public static IServerConnection CreateTestHttpConnectionWithGeoRest()
{
- if (!string.IsNullOrEmpty(Port))
- {
- return ConnectionProviderRegistry.CreateConnection("Maestro.Http",
- "Url", "http://" + Environment.MachineName + ":" + Port + "/mapguide/mapagent/mapagent.fcgi",
- "Username", "Administrator",
- "Password", "admin",
- "GeoRestUrl", "http://localhost:99/",
- "GeoRestConfigPath", "UserTestData\\GeoRestConfig.xml");
- }
- else
- {
- return ConnectionProviderRegistry.CreateConnection("Maestro.Http",
- "Url", "http://" + Environment.MachineName + "/mapguide/mapagent/mapagent.fcgi",
- "Username", "Administrator",
- "Password", "admin",
- "GeoRestUrl", "http://localhost:99/",
- "GeoRestConfigPath", "UserTestData\\GeoRestConfig.xml");
- }
+ return ConnectionProviderRegistry.CreateConnection("Maestro.Http",
+ "Url", TestEnvironment.HttpUrl,
+ "Username", TestEnvironment.HttpUsername,
+ "Password", TestEnvironment.HttpPassword,
+ "GeoRestUrl", TestEnvironment.GeoRestUrl,
+ "GeoRestConfigPath", TestEnvironment.GeoRestConfig);
}
public static IServerConnection CreateTestHttpConnection()
{
- if (!string.IsNullOrEmpty(Port))
- {
- return ConnectionProviderRegistry.CreateConnection("Maestro.Http",
- "Url", "http://" + Environment.MachineName + ":" + Port + "/mapguide/mapagent/mapagent.fcgi",
- "Username", "Administrator",
- "Password", "admin");
- }
- else
- {
- return ConnectionProviderRegistry.CreateConnection("Maestro.Http",
- "Url", "http://" + Environment.MachineName + "/mapguide/mapagent/mapagent.fcgi",
- "Username", "Administrator",
- "Password", "admin");
- }
+ return ConnectionProviderRegistry.CreateConnection("Maestro.Http",
+ "Url", TestEnvironment.HttpUrl,
+ "Username", TestEnvironment.HttpUsername,
+ "Password", TestEnvironment.HttpPassword);
}
}
}
Modified: trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs 2013-12-20 06:45:50 UTC (rev 7957)
+++ trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs 2013-12-20 14:43:19 UTC (rev 7958)
@@ -36,9 +36,16 @@
namespace MaestroAPITests
{
- [TestFixture(Ignore = TestControl.IgnoreValidationTests)]
+ [TestFixture]
public class ValidationTests
{
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ if (TestControl.IgnoreValidationTests)
+ Assert.Ignore("Skipping ValidationTests because TestControl.IgnoreValidationTests = true");
+ }
+
[Test]
public void TestUniqueIssues()
{
More information about the mapguide-commits
mailing list