Run() public method

Runs the testcases against the endpoint.
public Run ( ConfiguredEndpoint endpoint, ServerTestConfiguration testConfiguration ) : void
endpoint ConfiguredEndpoint The endpoint to test.
testConfiguration ServerTestConfiguration
return void
Exemplo n.º 1
0
        /// <summary>
        /// Runs the tests.
        /// </summary>
        private void Run(object state)
        {
            if (state == null)
            {
                return;
            }

            try {
                m_testClient.Run((ConfiguredEndpoint)state, m_testConfiguration);
                RunCompleted(null);
            } catch (Exception e) {
                RunCompleted(e);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Runs the test in a console.
        /// </summary>
        private static void RunInConsole(string endpointUrl)
        {
            ApplicationConfiguration m_configuration = GuiUtils.DoStartupChecks("Opc.Ua.ServerTestTool", ApplicationType.Client, null, true);

            if (m_configuration == null)
            {
                return;
            }

            GuiUtils.OverrideUaTcpImplementation(m_configuration);

            m_configuration.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation);
            ServerTestConfiguration m_testConfiguration = ServerTestConfiguration.Load(m_configuration.Extensions);

            m_testConfiguration.Coverage              = 30;
            m_testConfiguration.EndpointSelection     = EndpointSelection.All;
            m_testConfiguration.ConnectToAllEndpoints = true;

            // initialize the log file.
            m_logFilePath = null;

            if (m_configuration.TraceConfiguration != null)
            {
                m_logFilePath = Utils.GetAbsoluteFilePath(m_configuration.TraceConfiguration.OutputFilePath, true, false, true);
                FileInfo file = new FileInfo(m_logFilePath);
                m_logFilePath  = file.DirectoryName;
                m_logFilePath += "\\Opc.Ua.ServerTestTool";
            }

            if (String.IsNullOrEmpty(m_logFilePath))
            {
                m_logFilePath = m_configuration.SourceFilePath;
            }

            if (!String.IsNullOrEmpty(m_logFilePath))
            {
                try
                {
                    m_logFilePath += ".";
                    m_logFilePath += Utils.GetAssemblyBuildNumber();
                    m_logFilePath += ".log.txt";

                    using (StreamWriter logWriter = new StreamWriter(File.Open(m_logFilePath, FileMode.Create)))
                    {
                        logWriter.WriteLine(Utils.Format("Logging Started at {0:hh:mm:ss}", DateTime.Now));
                    }
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }
            }

            // create the test client.
            ServerTestClient testClient = new ServerTestClient(m_configuration);

            ConfiguredEndpointCollection collection = new ConfiguredEndpointCollection();
            ConfiguredEndpoint           endpoint   = collection.Create(endpointUrl);

            testClient.ReportResult += new EventHandler <ServerTestClient.ReportResultEventArgs>(TestClient_ReportTestResult);
            testClient.Run(endpoint, m_testConfiguration);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Runs the test in a console.
        /// </summary>
        private static void RunInConsole(string endpointUrl)
        {
            ApplicationConfiguration m_configuration = GuiUtils.DoStartupChecks("Opc.Ua.ServerTestTool", ApplicationType.Client, null, true);

            if (m_configuration == null)
            {
                return;
            }

            GuiUtils.OverrideUaTcpImplementation(m_configuration);

            m_configuration.CertificateValidator.CertificateValidation += new CertificateValidationEventHandler(CertificateValidator_CertificateValidation);
            ServerTestConfiguration m_testConfiguration = ServerTestConfiguration.Load(m_configuration.Extensions);

            m_testConfiguration.Coverage = 30;
            m_testConfiguration.EndpointSelection = EndpointSelection.All;
            m_testConfiguration.ConnectToAllEndpoints = true;

            // initialize the log file.
            m_logFilePath = null;

            if (m_configuration.TraceConfiguration != null)
            {
                m_logFilePath = Utils.GetAbsoluteFilePath(m_configuration.TraceConfiguration.OutputFilePath, true, false, true);
                FileInfo file = new FileInfo(m_logFilePath);
                m_logFilePath = file.DirectoryName;
                m_logFilePath += "\\Opc.Ua.ServerTestTool";
            }

            if (String.IsNullOrEmpty(m_logFilePath))
            {
                m_logFilePath = m_configuration.SourceFilePath;
            }

            if (!String.IsNullOrEmpty(m_logFilePath))
            {
                try
                {
                    m_logFilePath += ".";
                    m_logFilePath += Utils.GetAssemblyBuildNumber();
                    m_logFilePath += ".log.txt";

                    using (StreamWriter logWriter = new StreamWriter(File.Open(m_logFilePath, FileMode.Create)))
                    {
                        logWriter.WriteLine(Utils.Format("Logging Started at {0:hh:mm:ss}", DateTime.Now));
                    }
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }
            }

            // create the test client.
            ServerTestClient testClient = new ServerTestClient(m_configuration);

            ConfiguredEndpointCollection collection = new ConfiguredEndpointCollection();
            ConfiguredEndpoint endpoint = collection.Create(endpointUrl);

            testClient.ReportResult += new EventHandler<ServerTestClient.ReportResultEventArgs>(TestClient_ReportTestResult);
            testClient.Run(endpoint, m_testConfiguration);
        }