.net barcode reader camera AUTOMATION WITH CONSOLE-BASED TESTWARE in Font

Encoder PDF 417 in Font AUTOMATION WITH CONSOLE-BASED TESTWARE

CHAPTER 7 AUTOMATION WITH CONSOLE-BASED TESTWARE
Paint PDF417 In None
Using Barcode creation for Font Control to generate, create PDF-417 2d barcode image in Font applications.
www.OnBarcode.com
Make Barcode In None
Using Barcode creation for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
Our goal is to create a web page that can be viewed by all the testers on the team. This way, anyone can see which installations have been completed and which have not. Since the report contains data on more then one installation, we create a new StreamWriter and open with the Append option set to True (again, see Listing 7-17). This will allow us to add more reports to the same file. We have included a picture of the web page in Figure 7-14 where you can see that the installations on two computers, Lab2 and Lab3, are done. The report also shows the information gathered from our InspectPC testware application.
UPC-A Supplement 2 Drawer In None
Using Barcode encoder for Font Control to generate, create UPC-A Supplement 5 image in Font applications.
www.OnBarcode.com
Code 3 Of 9 Maker In None
Using Barcode generator for Font Control to generate, create Code 39 Extended image in Font applications.
www.OnBarcode.com
Note On an actual project, you would want to add more formatting to make your report more professional
PDF 417 Maker In None
Using Barcode encoder for Font Control to generate, create PDF417 image in Font applications.
www.OnBarcode.com
Generate QR Code JIS X 0510 In None
Using Barcode printer for Font Control to generate, create QR Code image in Font applications.
www.OnBarcode.com
looking. We have chosen not to do too much because we wanted to simplify the code as much as possible.
EAN 13 Drawer In None
Using Barcode maker for Font Control to generate, create GS1 - 13 image in Font applications.
www.OnBarcode.com
Painting USPS Confirm Service Barcode In None
Using Barcode encoder for Font Control to generate, create Planet image in Font applications.
www.OnBarcode.com
Figure 7-14. A simple report
Create PDF-417 2d Barcode In None
Using Barcode maker for Font Control to generate, create PDF417 image in Font applications.
www.OnBarcode.com
Reading PDF 417 In Visual Studio .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Completing the Application
QR Code Decoder In Visual Studio .NET
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Recognizing Barcode In Visual C#.NET
Using Barcode decoder for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
With the ReportOnInstall() method created, you have most of the ingredients to complete your application. Now you just have to link them all together. To do this, you would create code in the Main() method that will call each of these methods in turn. It would need to get arguments from the user and feed them into the various methods when required. Table 7-1 displays a list of the arguments you will need.
Data Matrix 2d Barcode Drawer In None
Using Barcode encoder for Microsoft Word Control to generate, create DataMatrix image in Microsoft Word applications.
www.OnBarcode.com
UCC - 12 Drawer In VB.NET
Using Barcode generation for VS .NET Control to generate, create UPC A image in .NET framework applications.
www.OnBarcode.com
CHAPTER 7 AUTOMATION WITH CONSOLE-BASED TESTWARE
Print Code 3 Of 9 In .NET Framework
Using Barcode printer for .NET framework Control to generate, create Code 39 image in .NET applications.
www.OnBarcode.com
Encoding Code-128 In Visual Basic .NET
Using Barcode maker for .NET Control to generate, create Code 128A image in .NET applications.
www.OnBarcode.com
Table 7-1. Arguments for Your Application
Draw Barcode In .NET Framework
Using Barcode encoder for ASP.NET Control to generate, create Barcode image in ASP.NET applications.
www.OnBarcode.com
Barcode Reader In VS .NET
Using Barcode scanner for VS .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Argument
Barcode Printer In Java
Using Barcode drawer for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
Scanning Code 39 Full ASCII In None
Using Barcode reader for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
Application path and name Run report Check report Upload report
Value
Name and path of folder Yes/No Yes/No Yes/No
Required
Required Optional Optional Optional
With this many arguments, you really should add a way to let the users know what arguments to pass in. Listing 7-18 shows an additional method called ShowHelp() that outlines how to use your testware. Listing 7-18. The ShowHelp() Method VB .NET Public Shared Sub ShowHelp() Const TAB As String = ChrW(9) Console.WriteLine("Please Provide All Information") Console.WriteLine("In The Following Order...") Console.WriteLine(" Testware Name =" + TAB + "(Path and Name of Testware Folder)") Console.WriteLine(" Run PC Report =" + TAB + "[Yes/No]") Console.WriteLine(" Check Report =" + TAB + TAB + "[Yes/No]") Console.WriteLine(" Upload Report =" + TAB + "[Yes/No]") Console.WriteLine _ (" Example: " + TAB + TAB + "TestLabSetup.exe \\Server1\ShareWithApp yes yes yes") End Sub Remember, you are formatting your output so that it reads well in the Console environment. Notice that you are using square brackets, [], to indicate that the last three arguments are optional. This is a common convention that lets users learn how to use your application quickly. It is also a good idea to show an example, so this is done on the last line. Once this method is created, you would call the method when the user makes a mistake or requests help information. A common command for requesting help in Console applications is to type the name of the Console application and add a / or - argument. For example if you open up a Command Console window and type Time.exe / , you will see Microsoft s instructions on how to use this program. Since this is standard behavior, you would add code that checks to see if this argument was sent to your application. Listing 7-19 is an example in VB .NET. Again, we will show the C# version in Exercise 7-2. Listing 7-19. Checking If Help Was Asked For VB .NET If args(0) = "- " Or args(0) = "/ " Then Console.WriteLine("Test Lab Setup Application Help") ShowHelp() Return End If
CHAPTER 7 AUTOMATION WITH CONSOLE-BASED TESTWARE
As mentioned, you would also want to show the help message if there was some kind of error in the entry. Using the Try-Catch block again, your code would respond by showing the help when an error happened (see Listing 7-20). Listing 7-20. Evaluating the Arguments VB .NET 'Get Argument data Try 'Get required argument strAppPathAndName = args(0) 'Get optional arguments If args.Length = 2 Then strRunReport = args(1) ElseIf args.Length = 3 Then strRunReport = args(1) strCheckReport = args(2) ElseIf args.Length = 4 Then strRunReport = args(1) strCheckReport = args(2) strUploadReport = args(3) End If Catch ex As Exception Console.WriteLine("Please Check Your Arguments And Try Again") ShowHelp() Return End Try
Copyright © OnBarcode.com . All rights reserved.