示例#1
0
        private List <String> GetBusinessFlow()
        {
            ExcelDataAccess businessFlowAccess =
                new ExcelDataAccess(_frameworkParameters.RelativePath +
                                    Util.GetFileSeparator() + "Datatables",
                                    testParameters.CurrentScenario);

            businessFlowAccess.DatasheetName = "Business_Flow";

            int rowNum = businessFlowAccess.GetRowNum(testParameters.CurrentTestcase, 0);

            if (rowNum == -1)
            {
                throw new FrameworkException("The test case \"" + testParameters.CurrentTestcase + "\" is not found in the Business Flow sheet!");
            }

            String        dataValue;
            List <String> businessFlowData = new List <String>();
            int           currentColumnNum = 1;

            while (true)
            {
                dataValue = businessFlowAccess.GetValue(rowNum, currentColumnNum);
                if (dataValue.Equals(""))
                {
                    break;
                }
                businessFlowData.Add(dataValue);
                currentColumnNum++;
            }

            if (businessFlowData.Count() == 0)
            {
                throw new FrameworkException("No business flow found against the test case \"" + testParameters.CurrentTestcase + "\"");
            }

            return(businessFlowData);
        }
示例#2
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;
            }
        }