Esempio n. 1
0
        /// <summary>
        /// Load test suite.
        /// </summary>
        /// <param name="filename">Filename of the profile</param>
        public void LoadTestSuite(string filename)
        {
            TestSuiteInfo tsinfo;

            using (ProfileUtil profile = ProfileUtil.LoadProfile(filename))
            {
                tsinfo = testSuites.Find(ts => ts.TestSuiteName == profile.Info.TestSuiteName);
                if (tsinfo == null)
                {
                    throw new ArgumentException(String.Format(StringResources.UnknownTestSuiteMessage, profile.Info.TestSuiteName));
                }
            }

            util.LoadTestSuiteConfig(tsinfo);
            util.LoadTestSuiteAssembly();

            string newProfile;

            if (util.TryUpgradeProfileSettings(filename, out newProfile))
            {
                Console.WriteLine(String.Format(StringResources.PtmProfileUpgraded, newProfile));
                filename = newProfile;
            }
            util.LoadProfileSettings(filename);
        }
        /// <summary>
        /// Load test suite.
        /// </summary>
        /// <param name="filename">Filename of the profile</param>
        /// <param name="testSuiteFolder">Path of the specified test suite</param>
        public void LoadTestSuite(string filename, string testSuiteFolder)
        {
            Logger.AddLog(LogLevel.Information, "Load Test Suite");

            TestSuiteInfo tsinfo;

            using (ProfileUtil profile = ProfileUtil.LoadProfile(filename))
            {
                tsinfo = testSuites.Find(ts => ts.TestSuiteName == profile.Info.TestSuiteName);
                if (tsinfo == null)
                {
                    throw new ArgumentException(String.Format(StringResources.UnknownTestSuiteMessage, profile.Info.TestSuiteName));
                }
                string testSuiteFolderBin = Path.Combine(testSuiteFolder, "Bin");
                tsinfo.TestSuiteFolder  = testSuiteFolder;
                tsinfo.TestSuiteVersion = LoadTestsuiteVersion(testSuiteFolderBin);
            }

            util.LoadTestSuiteConfig(tsinfo);
            util.LoadTestSuiteAssembly();

            string newProfile;

            if (util.TryUpgradeProfileSettings(filename, out newProfile))
            {
                Console.WriteLine(String.Format(StringResources.PtmProfileUpgraded, newProfile));
                filename = newProfile;
            }
            util.LoadProfileSettings(filename);
        }
        /// <summary>
        /// Load test suite.
        /// </summary>
        /// <param name="filename">Filename of the profile</param>
        public void LoadTestSuite(string filename)
        {
            ProfileUtil   profile = ProfileUtil.LoadProfile(filename);
            TestSuiteInfo tsinfo  = null;

            foreach (var g in testSuites)
            {
                foreach (var info in g)
                {
                    if (profile.VerifyVersion(info.TestSuiteName, info.TestSuiteVersion))
                    {
                        tsinfo = info;
                        goto FindTestSuite;
                    }
                }
            }
FindTestSuite:
            profile.Dispose();
            util.LoadTestSuiteConfig(tsinfo);
            util.LoadTestSuiteAssembly();
            util.LoadProfileSettings(filename);
        }