Creating a Test Harness

Team-Fly team-fly    

ADO.NET Programming in Visual Basic .NET
By Steve  Holzner, Bob  Howell

Table of Contents
Chapter 11.   Creating Your Own Data Control

Next we will create a test harness project to try out our control on. If you've never been part of an electrical engineering team, the term test harness might seem strange . In a prior life (so it seems) I once worked as a test technician in an electronics plant. We used test harnesses, which were specially designed pieces of equipment, to provide controlled input to a component. The output can be compared to a known set of expected parameters. This way we had a controlled way of determining whether a component was performing as expected. We will do the same thing with our test harness.

In our case, the harness will simply be a Windows Form. We will put controls on the form that test all of the functions of the Data Control. Let's add a new project to our solution. When prompted, choose Windows Application. The IDE creates a project and adds it to the solution. Change the name of the project to TestBed and the name of the form to frmCtlTest. Right-click on the References node in the Project Explorer. Select Add Reference. The References dialog opens. Choose the Project tab and select the DataControl project. This assumes that you have compiled the DataControl project. If not, compile it now. Now if you open the form designer for frmCtlTest, and then open the toolbox, you will see the ucDataNav listed under Windows Forms. Select this control and drop it on your form.

If you've done everything correctly up to this point, the control should paint itself on the form and resemble the old ADO Data Control as in Figure 11.2. Try resizing the control. See the buttons stretch and shrink. Of course it does absolutely nothing right now. Next we will add the functionality to the control. This is where we will really learn something.

Figure 11.2. The test harness with the cata control on it.


Team-Fly team-fly    

ADO. NET Programming in Visual Basic. NET
ADO.NET Programming in Visual Basic .NET (2nd Edition)
ISBN: 0131018817
EAN: 2147483647
Year: 2005
Pages: 123

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: