/// <summary> /// For development and testing purposes this Method can either execute actions that /// are set up by the program 'PetraMultiStart' (indicated by 'RunAutoTests=true' on /// the command line) OR open a screen with parameters that /// come either from the .config file or Command Line (indicated by 'TestAction="xxx"'). /// The 'Test Action' will not be run if the Control Key is pressed. /// </summary> /// <remarks> /// sample action: TestAction="Namespace=Ict.Petra.Client.MPartner.Gui,ActionOpenScreen=TFrmPartnerEdit2,PartnerKey=0043005002,InitiallySelectedTabPage=petpDetails" ///</remarks> private void RunTestAction() { string DisconnectTimeFromCommandLine = TAppSettingsManager.GetValue("DisconnectTime"); #if TODORemoting if (TAppSettingsManager.GetBoolean("RunAutoTests", false) == true) { // We need to manually 'fix up' the value of DisconnectTime that we get from .NET when we request // the commandline parameters as an array because .NET removes quotation marks in two places where // they were present on the command line. Those two quotation marks need to be there as the call to // TVariant.DecodeFromString() will not succeed if they aren't there in their proper places! DisconnectTimeFromCommandLine = DisconnectTimeFromCommandLine.Substring( 0, DisconnectTimeFromCommandLine.IndexOf(':') + 1) + "\"" + DisconnectTimeFromCommandLine.Substring( DisconnectTimeFromCommandLine.IndexOf(':') + 1) + "\""; TestRunner = new PetraClient_AutomatedAppTest.TAutomatedAppTest( TAppSettingsManager.GetValue("AutoTestConfigFile"), TAppSettingsManager.GetValue("AutoTestParameters"), TVariant.DecodeFromString(DisconnectTimeFromCommandLine).ToDate(), TConnectionManagementBase.GConnectionManagement.ClientName); TestRunner.TestForm = this; TestRunner.ClientID = TConnectionManagementBase.GConnectionManagement.ClientID; TestRunner.Start(this); } else #endif if (System.Windows.Forms.Form.ModifierKeys != Keys.Control) { string testAction = TAppSettingsManager.GetValue("TestAction", false); if (testAction != TAppSettingsManager.UNDEFINEDVALUE) { XmlDocument temp = new XmlDocument(); XmlNode testActionNode = temp.CreateElement("testAction"); temp.AppendChild(testActionNode); testAction = testAction.Trim(new char[] { '"' }); while (testAction.Length > 0) { string[] pair = StringHelper.GetNextCSV(ref testAction, ",").Split(new char[] { '=' }); XmlAttribute attr = temp.CreateAttribute(pair[0]); attr.Value = pair[1]; testActionNode.Attributes.Append(attr); } TLstTasks.ExecuteAction(testActionNode, null); } } }
/// <summary> /// For development and testing purposes this Method can either execute actions that /// are set up by the program 'PetraMultiStart' (indicated by 'RunAutoTests=true' on /// the command line) OR open a screen with parameters that /// come either from the .config file or Command Line (indicated by 'TestAction="xxx"'). /// The 'Test Action' will not be run if the Control Key is pressed. /// </summary> /// <remarks> /// sample action: TestAction="Namespace=Ict.Petra.Client.MPartner.Gui,ActionOpenScreen=TFrmPartnerEdit2,PartnerKey=0043005002,InitiallySelectedTabPage=petpDetails" ///</remarks> private void RunTestAction() { string DisconnectTimeFromCommandLine = TAppSettingsManager.GetValue("DisconnectTime"); #if TODORemoting if (TAppSettingsManager.GetBoolean("RunAutoTests", false) == true) { // We need to manually 'fix up' the value of DisconnectTime that we get from .NET when we request // the commandline parameters as an array because .NET removes quotation marks in two places where // they were present on the command line. Those two quotation marks need to be there as the call to // TVariant.DecodeFromString() will not succeed if they aren't there in their proper places! DisconnectTimeFromCommandLine = DisconnectTimeFromCommandLine.Substring( 0, DisconnectTimeFromCommandLine.IndexOf(':') + 1) + "\"" + DisconnectTimeFromCommandLine.Substring( DisconnectTimeFromCommandLine.IndexOf(':') + 1) + "\""; TestRunner = new PetraClient_AutomatedAppTest.TAutomatedAppTest( TAppSettingsManager.GetValue("AutoTestConfigFile"), TAppSettingsManager.GetValue("AutoTestParameters"), TVariant.DecodeFromString(DisconnectTimeFromCommandLine).ToDate(), TConnectionManagementBase.GConnectionManagement.ClientName); TestRunner.TestForm = this; TestRunner.ClientID = TConnectionManagementBase.GConnectionManagement.ClientID; TestRunner.Start(this); } else #endif if (System.Windows.Forms.Form.ModifierKeys != Keys.Control) { string testAction = TAppSettingsManager.GetValue("TestAction", false); if (testAction != TAppSettingsManager.UNDEFINEDVALUE) { XmlDocument temp = new XmlDocument(); XmlNode testActionNode = temp.CreateElement("testAction"); temp.AppendChild(testActionNode); testAction = testAction.Trim(new char[] { '"' }); while (testAction.Length > 0) { string[] pair = StringHelper.GetNextCSV(ref testAction, ",").Split(new char[] { '=' }); XmlAttribute attr = temp.CreateAttribute(pair[0]); attr.Value = pair[1]; testActionNode.Attributes.Append(attr); } TLstTasks.ExecuteAction(testActionNode, null); } } }