Exemplo n.º 1
0
        /// <summary>
        /// This method loads the test configuration from the specified file path.
        /// </summary>
        /// <param name="testFilePath">Test case file path.</param>
        public void LoadTestConfiguration(string testFilePath)
        {
            // (re)load the test configuration file.
            TestConfiguration configuration = TestConfiguration.Load("Opc.Ua.StackTest");

            m_testFilePath = configuration.TestFilePath;

            if (!String.IsNullOrEmpty(testFilePath))
            {
                m_testFilePath = testFilePath;
            }

            // load sequence to execute.
            m_sequenceToExecute = TestSequence.Load(m_testFilePath);

            m_randomFilePath = configuration.RandomFilePath;

            // TODO: How to handle multiple channels. Where will all those channels write to same log.
            m_logFilePath = configuration.LogFilePath;
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method loads the test configuration.
        /// </summary>
        /// <param name="testFilePath">Test case file path.</param>
        private void LoadTestConfiguration(string testFilePath)
        {
            // (re)load the test configuration file.
            m_configuration = TestConfiguration.Load("Opc.Ua.StackTest");

            if (!String.IsNullOrEmpty(testFilePath))
            {
                m_configuration.TestFilePath = testFilePath;
            }

            // incorporate the server id into the log file path.
            int index = m_configuration.LogFilePath.LastIndexOf('.');

            if (index != -1)
            {
                string path = m_configuration.LogFilePath;

                int subindex = path.LastIndexOf('_');

                if (subindex < 0)
                {
                    subindex = index;
                }

                m_configuration.LogFilePath = Utils.Format(
                    "{0}_{1}{2}",
                    path.Substring(0, subindex),
                    m_serverId,
                    path.Substring(index));
            }

            // load sequence to execute.
            m_sequenceToExecute = TestSequence.Load(m_configuration.TestFilePath);

            // load random number file.
            m_random = new PseudoRandom(m_configuration.RandomFilePath);

            // open log file.
            m_logger = new Logger(m_configuration.LogFilePath, (TestLogDetailMasks)m_sequenceToExecute.LogDetailLevel);
        }