示例#1
0
        public Benchmark()
        {
            Loop = true; ;
            Interval = 10000;

            LogToCSV = true;
            LogFile = "Log.csv";

            LogToSQL = false;
            SQLServer = "SQL";
            SQLDatabase = "DBName";
            SQLTable = "TableName";

            PageLoadTests = new PageLoadTests()
            {
                Enabled = false,
                Iterations = 1
            };
            PageLoadTests.Tests.Add(new PageLoadTest("Test", "http://sharepoint.com"));

            DownloadTests = new DownloadTests()
            {
                Enabled = false,
                Iterations = 1
            };
            DownloadTests.Tests.Add(new DownloadTest("Test", "http://sharepoint.com"));

            UploadTests = new UploadTests()
            {
                Enabled = false,
                Iterations = 1,
                DeleteFiles = true
            };
            UploadTests.Tests.Add(new UploadTest("Test", "http://sharepoint.com", true));

            PingTests = new PingTests()
            {
                Enabled = false,
                Iterations = 1
            };
            PingTests.Tests.Add(new PingTest("Test", "google.com"));
        }
示例#2
0
        public void LoadDataandRun()
        {
            if (System.IO.File.Exists("Config.xml"))
            {
                Console.WriteLine("Config.xml Found.");
                System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(this.GetType());
                using (System.IO.StreamReader file = new System.IO.StreamReader("Config.xml"))
                {
                    var temp = (Benchmark)reader.Deserialize(file);
                    this.Loop = temp.Loop;
                    this.Interval = temp.Interval;
                    this.LogToCSV = temp.LogToCSV;
                    this.LogFile = temp.LogFile;
                    this.LogToSQL = temp.LogToSQL;
                    this.SQLServer = temp.SQLServer;
                    this.SQLDatabase = temp.SQLDatabase;
                    this.SQLTable = temp.SQLTable;
                    this.PageLoadTests = temp.PageLoadTests;
                    this.DownloadTests = temp.DownloadTests;
                    this.UploadTests = temp.UploadTests;
                    this.PingTests = temp.PingTests;
                }
                if (ValidateData())
                {
                    RunTests();
                }
            }
            else
            {
                // No config has been loaded, lets output the default
                System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(this.GetType());
                StreamWriter file = new StreamWriter("Config.xml");
                writer.Serialize(file, this);
                file.Close();

                Console.WriteLine("Config.xml was not found, a default version has been writen to Config.xml. Please modify the file and re-run SPBenchmark.");
                Console.ReadLine();
            }
        }