- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
AUTOMATION WITH CONSOLE-BASED TESTWARE in Font
CHAPTER 7 AUTOMATION WITH CONSOLE-BASED TESTWARE Create PDF417 In None Using Barcode maker for Font Control to generate, create PDF417 image in Font applications. www.OnBarcode.comPaint QR In None Using Barcode creation for Font Control to generate, create Denso QR Bar Code image in Font applications. www.OnBarcode.com// ---- Call The Verification Methods --// This demo inlcudes only one if (CheckForOS(strReportData) == true) { strStatus = "Completed"; } else { strStatus = "Failed"; } } catch (Exception ex) { Console.WriteLine(ex.ToString() + "\r\n" + "Press any key to continue..."); Console.ReadLine(); //Pauses console until someone hit Enter strStatus = "Failed"; } return strStatus; } 10. Add the following code to the CheckForOS() method to check that the OS is either Windows XP or 2003: VB .NET Private Shared Function CheckForOS(ByVal ReportData As String) As Boolean Dim r As Regex Dim m As Match r = New Regex("XP | 2003", RegexOptions.IgnoreCase Or RegexOptions.Compiled) m = r.Match(ReportData) If m.Success Then Return True Else Return False End If End Function C# private static bool CheckForOS(string ReportData) { Regex r; Match m; r = new Regex("XP | 2003", RegexOptions.IgnoreCase | RegexOptions.Compiled); m = r.Match(ReportData); if (m.Success) { return true; } Barcode Creator In None Using Barcode generation for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comPainting Code 128A In None Using Barcode drawer for Font Control to generate, create ANSI/AIM Code 128 image in Font applications. www.OnBarcode.comCHAPTER 7 AUTOMATION WITH CONSOLE-BASED TESTWARE
Make UPC-A In None Using Barcode generation for Font Control to generate, create GTIN - 12 image in Font applications. www.OnBarcode.comPaint Code39 In None Using Barcode generator for Font Control to generate, create Code 39 image in Font applications. www.OnBarcode.comelse { return false; } } 11. Add the following code to the DownloadAppFiles() method to XCOPY the files from the share: VB .NET Public Shared Function DownloadAppFiles(ByVal PathAndName As String) As String Dim strStatus As String = "" Dim strFileListing() As String Dim strFullFileName As String Dim strSimpleFileName As String Dim strAppName As String Dim intIndex As Int16 intIndex = PathAndName.LastIndexOf("\") strAppName = PathAndName.Substring(intIndex + 1) Draw EAN-13 Supplement 5 In None Using Barcode drawer for Font Control to generate, create GS1 - 13 image in Font applications. www.OnBarcode.comCreating EAN8 In None Using Barcode generation for Font Control to generate, create UPC - 8 image in Font applications. www.OnBarcode.comTry 'a) Create folder for your Testware Dim DI As New System.IO.DirectoryInfo("c:\" + strAppName) If Not DI.Exists Then DI.Create() End If 'b) Go to Network share and copy 'application folder to local drive, overwrite as needed strFileListing = System.IO.Directory.GetFiles(PathAndName) For Each strFullFileName In strFileListing intIndex = strFullFileName.LastIndexOf("\") strSimpleFileName = strFullFileName.Substring(intIndex + 1) System.IO.File.Copy _ (strFullFileName, "c:\" + strAppName + "\" + strSimpleFileName, True) Next strStatus = "Completed" Catch ex As Exception Console.WriteLine(ex.ToString + vbCrLf + "Press any key to continue...") Console.ReadLine() strStatus = "Failed" End Try Return strStatus End Function Draw PDF417 In Visual Basic .NET Using Barcode creation for .NET framework Control to generate, create PDF417 image in Visual Studio .NET applications. www.OnBarcode.comPDF-417 2d Barcode Generator In .NET Framework Using Barcode drawer for Reporting Service Control to generate, create PDF 417 image in Reporting Service applications. www.OnBarcode.comCHAPTER 7 AUTOMATION WITH CONSOLE-BASED TESTWARE
Create Barcode In None Using Barcode drawer for Word Control to generate, create Barcode image in Word applications. www.OnBarcode.comBarcode Creation In Visual Studio .NET Using Barcode encoder for VS .NET Control to generate, create Barcode image in VS .NET applications. www.OnBarcode.comC# public static string DownloadAppFiles(string PathAndName) { string strStatus = ""; string[] strFileListing; string strSimpleFileName; string strAppName; Int32 intIndex; intIndex = PathAndName.LastIndexOf("\\"); strAppName = PathAndName.Substring(intIndex + 1); try { //a) Create folder for your Testware System.IO.DirectoryInfo DI = new System.IO.DirectoryInfo("c:\\" + strAppName); if (!(DI.Exists)) { DI.Create(); } //b) Go to Network share and copy //application folder to local drive, overwrite as needed strFileListing = System.IO.Directory.GetFiles(PathAndName); foreach (string strFullFileName in strFileListing) { intIndex = strFullFileName.LastIndexOf("\\"); strSimpleFileName = strFullFileName.Substring(intIndex + 1); System.IO.File.Copy(strFullFileName, "c:\\" + strAppName + "\\" + strSimpleFileName, true); } strStatus = "Completed"; } catch (Exception ex) { Console.WriteLine(ex.ToString() + "\r\n" + "Press any key to continue..."); Console.ReadLine(); strStatus = "Failed"; } return strStatus; } 12. Add the following code to the ReportOnInstall() method to upload report data about the installation: Barcode Scanner In C#.NET Using Barcode Control SDK for Visual Studio .NET Control to generate, create, read, scan barcode image in Visual Studio .NET applications. www.OnBarcode.comGS1 - 13 Drawer In None Using Barcode creation for Microsoft Excel Control to generate, create EAN13 image in Excel applications. www.OnBarcode.comCHAPTER 7 AUTOMATION WITH CONSOLE-BASED TESTWARE
Code 3 Of 9 Generation In None Using Barcode encoder for Microsoft Word Control to generate, create Code-39 image in Microsoft Word applications. www.OnBarcode.comMaking Barcode In None Using Barcode generator for Software Control to generate, create Barcode image in Software applications. www.OnBarcode.comVB .NET Public Shared Function ReportOnInstall(ByVal ReportFileName) As String Dim strStatus As String = "" Dim objSR As System.IO.StreamReader Dim objSW As System.IO.StreamWriter Dim strReportData As String = "" Dim strComputer As String = My.Computer.Name Try 'Open PCInfo.csv and Append the install info objSR = New System.IO.StreamReader("c:\PCInfo\PCInfo.csv") strReportData = "<b>*** " + strComputer + " = Done ***</b><p> " strReportData += objSR.ReadToEnd strReportData += "***" + strComputer + "***" + "<hr>" objSR.Close() objSW = New System.IO.StreamWriter(ReportFileName, True) objSW.Write(strReportData) objSW.Close() strStatus = "Completed" Catch ex As Exception Console.WriteLine(ex.ToString + vbCrLf + "Press any key to continue...") Console.ReadLine() strStatus = "Failed" End Try Return strStatus End Function C# public static string ReportOnInstall(string ReportFileName) { string strStatus = ""; System.IO.StreamReader objSR; System.IO.StreamWriter objSW; string strReportData = ""; string strComputer = mc.Name; try { objSR = new System.IO.StreamReader("c:\\PCInfo\\PCInfo.csv"); strReportData = "<b>*** " + strComputer + " = Done ***</b><p> "; strReportData += objSR.ReadToEnd(); strReportData += "<hr>"; objSR.Close(); objSW = new System.IO.StreamWriter(ReportFileName, true); Print Barcode In .NET Using Barcode printer for Reporting Service Control to generate, create Barcode image in Reporting Service applications. www.OnBarcode.comRecognize Barcode In Java Using Barcode reader for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comCHAPTER 7 AUTOMATION WITH CONSOLE-BASED TESTWARE
Encode Barcode In .NET Framework Using Barcode creator for .NET Control to generate, create Barcode image in Visual Studio .NET applications. www.OnBarcode.comEAN13 Printer In C#.NET Using Barcode encoder for VS .NET Control to generate, create EAN-13 Supplement 5 image in VS .NET applications. www.OnBarcode.comobjSW.Write(strReportData); objSW.Close(); strStatus = "Completed"; } catch (Exception ex) { Console.WriteLine(ex.ToString() + "\r\n" + "Press any key to continue..."); Console.ReadLine(); strStatus = "Failed"; } return strStatus; } 13. Add the following code to the ReportToUser() method to display the status information: VB .NET Private Shared Sub ReportToUser _ ( _ ByVal Report As String, _ ByVal Requirements As String, _ ByVal Install As String, _ ByVal Uploaded As String _ ) Dim strStatusReport As String = "" strStatusReport = " *** Status Report ***" + vbCrLf strStatusReport += "Check Report: " + Report + vbCrLf strStatusReport += "Check Requirements: " + Requirements + vbCrLf strStatusReport += "Install Testware: " + Install + vbCrLf strStatusReport += "Install Report Uploaded: " + Uploaded + vbCrLf Console.WriteLine(strStatusReport) End Sub C# private static void ReportToUser (string Report, string Requirements, string Install, string Uploaded) { string strStatusReport = ""; strStatusReport = " *** Status Report ***" + "\r\n"; strStatusReport += "Check Report: " + Report + "\r\n"; strStatusReport += "Check Requirements: " + Requirements + "\r\n"; strStatusReport += "Install Testware: " + Install + "\r\n"; strStatusReport += "Install Report Uploaded: " + Uploaded + "\r\n"; Console.WriteLine(strStatusReport); }
|
|