Ejemplo n.º 1
0
        public void ExecuteScript(string xlPath, string sheetName, string childSheet)
        {
            using (var excelUtility = new ExcelUtilityHelper(xlPath))
            {
                var totalRow   = excelUtility.GetTotalRows(sheetName);
                var testCaseId = excelUtility.GetTestCaseRowNo(childSheet);
                for (var i = 2; i < totalRow; i++)
                {
                    try
                    {
                        if (excelUtility.GetCellValue(sheetName, i, 1).Equals(string.Empty))
                        {
                            break;
                        }

                        if (!"Yes".Equals(excelUtility.GetCellValue(sheetName, i, 4), StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        var tcIdCell  = excelUtility.GetCellValue(sheetName, i, 3);
                        var tcIdIndex = testCaseId[tcIdCell];
                        ExecuteScript(excelUtility, childSheet, tcIdCell, tcIdIndex);
                        excelUtility.WriteToCell(sheetName, i, 5, "Pass");
                    }
                    catch (Exception)
                    {
                        excelUtility.WriteToCell(sheetName, i, 5, "Fail");
                    }
                }
                excelUtility.SaveSheet();
            }
        }
Ejemplo n.º 2
0
        public void ExecuteScript(ExcelUtilityHelper excelUtility, string sheetName, string tcId, int tcIdIndex)
        {
            var i = tcIdIndex;

            while (excelUtility.GetCellValue(sheetName, i, 1).Contains(tcId))
            {
                try
                {
                    if (string.Empty.Equals(excelUtility.GetCellValue(sheetName, i, _keywordCol)))
                    {
                        break;
                    }

                    var lctType  = excelUtility.GetCellValue(sheetName, i, _locatorTypeCol);
                    var lctValue = excelUtility.GetCellValue(sheetName, i, _locatorValueCol);
                    var keyword  = excelUtility.GetCellValue(sheetName, i, _keywordCol);
                    var param    = excelUtility.GetCellValue(sheetName, i, _parameterCol);

                    PerformAction(keyword, lctType, lctValue, param);
                    excelUtility.WriteToCell(sheetName, i, _resultCol, "Pass");
                }
                catch (Exception ex)
                {
                    excelUtility.WriteToCell(sheetName, i, _resultCol, "Fail");
                    excelUtility.WriteToCell(sheetName, i, _exceptionCol, ex.Message);
                    throw;
                }
                i++;
            }
        }