Example #1
0
        internal static Test[] getTests(string path)
        {
            ArrayList tests = new ArrayList();

            try
            {
                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                using (StreamReader sr = new StreamReader(path))
                {
                    String line;
                    // Read all lines from the file until the end of
                    // the file is reached.
                    while ((line = sr.ReadLine()) != null)
                    {
                        //skip comments
                        if (line.StartsWith("#"))
                        {
                            continue;
                        }
                        //TestsReader.copyDlls(TestsReader.getLocation(line));
                        tests.Add(TestsReader.generateTest(line));
                    }
                }

                //copy to Test[]
                Test[] results = new Test[tests.Count];
                for (int i = 0; i < tests.Count; i++)
                {
                    results[i] = (Test)tests[i];
                }
                return(results);
            }
            catch (Exception e)
            {
                string msg = "Specified file not found: " + path;
                DFunc.log(msg);
                DFunc.log(e.Message);
                Console.WriteLine(msg);
                return(null);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            string a = "setup -testset testset.txt -config config.txt";

            string[] bs = a.Split(' ');

            int i;

            //TODO:DFunc.Dir = System.Environment.CurrentDirectory;

            //load command
            if (!CommandReader.load(bs))
            {
                return;
            }
            CommandEngine.run(CommandReader.Command, CommandReader.Options);
            String testsetPath = "Testset.txt";

            Test[] tests = TestsReader.getTests(testsetPath);

            String testName = "DTest";



            //Get class type
            Type testType = typeof(Test1.DTest);

            //Get class instance
            object test = Activator.CreateInstance(testType);

            //Get case1 and exec
            i = 1;
            runTest(testType, test, i, testName);
            i = 2;
            runTest(testType, test, i, testName);


            Thread.Sleep(10000);
        }