예제 #1
0
        private void InitializeTestIterations()
        {
            int nTestcaseRows  = 1;
            int nSubIterations = 1;

            switch (testParameters.IterationMode)
            {
            case IterationOptions.RunAllIterations:

                String datatablePath = _frameworkParameters.RelativePath +
                                       Util.GetFileSeparator() + "Datatables";
                ExcelDataAccess testDataAccess =
                    new ExcelDataAccess(datatablePath, testParameters.CurrentScenario);
                testDataAccess.DatasheetName = ConfigurationManager.AppSettings["DefaultDataSheet"];

                int startRowNum = testDataAccess.GetRowNum(testParameters.CurrentTestcase, 0);
                nTestcaseRows  = testDataAccess.GetRowCount(testParameters.CurrentTestcase, 0, startRowNum);
                nSubIterations = testDataAccess.GetRowCount("1", 1, startRowNum);       // Assumption: Every test case will have at least one iteration
                int nIterations = nTestcaseRows / nSubIterations;
                testParameters.EndIteration = nIterations;
                _currentIteration           = 1;
                break;


            case IterationOptions.RunOneIterationOnly:
                _currentIteration = 1;
                break;

            case IterationOptions.RunRangeOfIterations:
                if (testParameters.StartIteration > testParameters.EndIteration)
                {
                    throw new FrameworkException("Error", "StartIteration cannot be greater than EndIteration!");
                }
                _currentIteration = testParameters.StartIteration;
                break;
            }
        }