5apply Oop Programming121
5apply Oop Programming121
Database Administration
LEVEL -IV
Unit of Competence
Apply object oriented programming language
Go straight
Computer Programming
The act of writing computer programs is called computer programming. In other word it is the process of
developing and implementing various sets of instructions to enable a computer to do a certain task.
Programmers translate the solutions or tasks into a language that computer can understand. As we write
programs, we must keep in mind that the computer will only do what we instruct it to do. Because of this, we
must be very careful and systematic with our instructions.
Even if some of them are known by only their developers; there more than 2500 programming languages in the
world which can be used to write computer programs and following are few of them:
Java C# J#
VB Python COBOL
C PHP Agora
C++ J Delphi, etc
Programming languages allow programmers to code software. The three major families of languages are:
Machine languages
Assembly languages
High-Level languages
Machine Languages
It comprised of 1s and 0s. It is the unique language of a computer. It is difficult to program because one
misplaced 1 or 0 will cause the program to fail. Example: 00000101= 5 & 00001001=9
Assembly Languages
Assembly languages are a step towards easier programming. It comprised of a set of elemental commands
which are tied to a specific processor. Assembly language code needs to be translated to machine language
before the computer processes it. Example: ADD 1001010, 1011010
High-Level Languages
The syntax of HL languages is similar to English. Historically, we divide HL languages into two groups:
Procedural languages
Object-Oriented languages (OOP)
Procedural Languages
Early high-level languages are typically called procedural languages. They are characterized by sequential sets
of linear commands. The focus of such languages is on structure.
Examples include C, COBOL, FORTRAN, LISP, Perl, HTML, and VBScript
Object Oriented Programming
Object-oriented programming began development in the 1960’s. Originally it coined/created by Xerox PARC to
designate a computer application that describes the methodology of using objects as the foundation for
computation. By the 1980’s, OOP rose to prominence as the programming language of choice, exemplified by
the success of C++. Object oriented programming was created because of the need to overcome the problems
that were found with using structured programming techniques. While structured programming uses an
approach which is top down, OOP uses an approach which is bottom up. First programming language to use
objects was Simula67. It was designed for the purpose of creating simulations.
Currently, OOPs such as Java, J2EE, C++, C#, Visual Basic.NET, Python and JavaScript are popular OOP
programming languages.
Some key features of the Object Oriented programming are:
Emphasis on data rather than procedure
Programs are divided into entities known as objects
Attributes/ properties
Some of the types of information kept in objects may be thought of as attributes of the object. Properties tell
something about or control the behavior of an object, such as its name, color, size, or location. When you refer
to a property, you first name the object, add a period, and then name the property.
It describes an object; or the “adjectives” of objects. In code, usually can be identified by a “descriptive” word –
Enabled, BackColor Each attribute typically has a value from a set associated with the attribute.
Methods
Actions associated with objects are called methods. Or it is a things which an object can do; the “verbs” of
objects. In code, usually can be identified by an “action” word -- Hide, Show and Clear. Each of the predefined
objects has a set of methods that you can use.
Events
Forces external to an object to which that object can react. An event occurs when the user takes an action, such
as clicking a button, pressing a key, scrolling, or closing a window. Events also can be triggered by actions of
other objects, such as repainting a form or a timer reaching a preset point.
VB.Net Overview
Visual Basic .NET (VB.NET) is an object-oriented computer programming language which implemented on the
.NET Framework. In Object-Oriented Programming methodology, a program consists of various objects that
interact with each other by means of actions. The actions that an object may take are called methods. Objects of
the same kind are said to have the same type or, more often, are said to be in the same class. When we consider
a VB.Net program, it can be defined as a collection of objects that communicate via invoking each other's
methods. It is an evolution of classic Visual Basic language, it is not backwards-compatible with VB6, and any
code written in the old version does not compile under VB.NET. Like all other .NET languages, VB.NET has
complete support for object-oriented concepts. Everything in VB.NET is an object, including all of the primitive
types (Short, Integer, Long, String, Boolean, etc.) and user-defined types, events, and even assemblies. Some of
the reasons that make VB.Net a widely used language are that; it is:
Modern, general purpose.
Object oriented.
Component oriented.
Easy to learn.
Structured language.
It produces efficient programs.
It can be compiled on a variety of computer platforms.
Part of .Net Framework.
Source Files
Visual Basic .NET source code is saved in files with a .vb extension. But when Visual Basic .NET code is
embedded in ASP.NET web page files such files have an .aspx extension.
Source files are plain-text files that can be created and edited with any text editor, such as WordPad and
Notepad. When you use Visual Studio .NET, source files are listed in the Solution Explorer window, and all
source is included from these files when the solution is built. When you are compiling from the command line,
all source files must appear as command-line arguments to the compile command.
Identifiers
An identifier is a name used to identify a class, variable, function, or any other user-defined item. The basic
rules for naming classes in VB.Net are as follows:
A name must begin with a letter that could be followed by a sequence of letters, digits 0 − 9 or
underscore.
It must not contain any embedded space or symbol like ? - +! @ # % ^ & * [ ] { } . ; : " ' / and \.
However, an underscore _ can be used.
VB.Net Keywords
Keyword is a word that is reserved by a program because the word has a special meaning. Keywords can be
commands or parameters. Every programming language has a set of keywords that cannot be used as variable
You can add comments to your code using the apostrophe (‘) character. Everything to the right of an apostrophe
is ignored by the VB.NET compiler:
x = y + 5 ‘Add 5 to the value of y
'Today's date
'Illustrates displaying information to read-only
NB: VB.NET does not support multiline comments like some other languages.
DATA TYPES
Datatype in a programming language describes that what type of data a variable can hold. When we declare a
variable, we have to tell the compiler about what type of the data the variable can hold or which data type the
variable belongs to.
Data types refer to an extensive system used for declaring variables or functions of different types. The type of
avariable determines how much space it occupies in storage and how the bit pattern stored is interpreted.
VB.Net provides a wide range of data types.
Apply object oriented programming language Page | 8
Information Sheet DBA
The following table shows all the data types available in VB.Net
Data Type Storage Allocation Value Range
Depends on
Boolean True or False
implementing platform
Byte 1 byte 0 through 255 (unsigned)
Char 2 bytes 0 through 65535 (unsigned)
0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on
Date 8 bytes
December 31, 9999
0 through +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9...E+28)
with no decimal point; 0 through +/-
Decimal 16 bytes
7.9228162514264337593543950335 with 28 places to the right of the
decimal
-1.79769313486231570E+308 through -4.94065645841246544E-324,
Double 8 bytes for negative values 4.94065645841246544E-324 through
1.79769313486231570E+308, for positive values
Depends on
String 0 to approximately 2 billion Unicode characters
implementing platform
UInteger 4 bytes 0 through 4,294,967,295 (unsigned)
ULong 8 bytes 0 through 18,446,744,073,709,551,615 (unsigned)
Depends on Each member of the structure has a range determined by its data type
User-Defined
implementing platform and independent of the ranges of the other members
UShort 2 bytes 0 through 65,535 (unsigned)
OPERATORS
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
Control Structures
These control structures are categorized as: Mathematicians proved that any program, no matter how
complicated, can be written using only 3 basic control structures.
Sequence
Selection
Iteration also called repetition
1. Sequence Control Structure
The sequence structure indicates instructions are to be executed one statement at a time in the
order they occur from top to bottom unless a different control structure dictates otherwise.
Use when want to execute code line by line.
Does not use the decision symbol.
Execute statement one by one in linear or consecutive order
2. Selection structure
The selection structure tests a condition, and then executes one sequence of statements instead of another,
depending on whether the condition is true or false. A condition is any variable or expression that returns a
Boolean value (TRUE or FALSE). A selection structure, also called an "If-Then-Else" structure.
IF ELSE
The conditional statement IF ELSE , is use for examining the conditions that we provided, and making decision
based on that condition. The conditional statement examining the data using comparison operators as well as
logical operators.
If the condition is TRUE then the control goes to between IF and Else block, that is the program will execute
the code between IF and ELSE statements.
If the conditions is FLASE then the control goes to between ELSE and END IF block , that is the program will
execute the code between ELSE and END IF statements.
If you want o check more than one condition at the same time , you can use ElseIf .
If [condition]
code
ElseIf [condition]
code
ElseIf [condition]
code
Else
code
End If
Example - When we want to analyze a mark lists we have to apply some conditions for grading students
depends on the marks. Following are the grading rule of the mark list:
If the marks is greater than 80 then the student get higher first class, If the marks less than 80 and greater than 60 then
the student get first class, If the marks less than 60 and greater than 40 then the student get second class, if the marks
less than 40 then the student fail. These conditions in a VB.NET looks;
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs) Handles Button1.Click
Dim totalMarks As Integer
totalMarks = Val(TextBox1.Text)
If totalMarks >= 80 Then
MsgBox("Got Higher First Class ")
ElseIf totalMarks >= 60 Then
MsgBox("Got First Class ")
ElseIf totalMarks >= 40 Then
MsgBox("Just pass only")
Else
MsgBox("Failed")
End If
End Sub
End Class
Repetition statements are called loops, and are used to repeat the same code mulitple times in succession. The
number of repetitions is based on criteria defined in the loop structure, usually a true/false expression.
Apply object oriented programming language Page | 12
Information Sheet DBA
End Sub
End Class
Modular programming
Modular programming is the process of subdividing a computer program into separate sub-programs. A module
is a separate software component. It can often be used in a variety of applications and functions with other
components of the system.
Apply object oriented programming language Page | 15
Information Sheet DBA
In other word, it is the act of designing and writing programs as interactions among functions that each
performs a single well-defined function, and which have minimal side-effect interaction between them. Put
differently, the content of each function is cohesive, and there is low coupling between functions.
Modular Programming discourages the use of control variables and flags in parameters; their presence tends to
indicate that the caller needs to know too much about how the function is implemented.
ObjectOriented programs are usually modular. ModularProgramming does not have to be ObjectOriented.
Modular Programming is heavily procedural: The focus is entirely on writing code (functions). Data is passive.
Array
In programming, a series of objects all of which are the same size and type. Each object in an array is called an
array element. For example, you could have an array of integers or an array of characters or an array of
anything that has a defined data type. The important characteristics of an array are:
Each element has the same data type (although they may have different values).
The entire array is stored contiguously in memory (that is, there are no gaps between elements).
Arrays can have more than one dimension. A one-dimensional array is called a vector ; a two-dimensional array
is called a matrix.
ArrayList is flexible because we can add items without any size information.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim i As Integer
Dim ItemList As New ArrayList()
ItemList.Add("Item4")
ItemList.Add("Item5")
ItemList.Add("Item2")
ItemList.Add("Item1")
ItemList.Add("Item3")
MsgBox("Shows Added Items")
For i = 0 To ItemList.Count - 1
MsgBox(ItemList.Item(i))
Next
'insert an item
ItemList.Insert(3, "Item6")
'sort itemms in an arraylist
ItemList.Sort()
'remove an item
ItemList.Remove("Item1")
'remove item from a specified index
ItemList.RemoveAt(3)
MsgBox("Shows final Items the ArrayList")
For i = 0 To ItemList.Count - 1
MsgBox(ItemList.Item(i))
Next
End Sub
End Class
The first step is to start a new project and build a form.
Open your Visual Studio and select File
New Project and select Visual Basic from the New project dialog box and
Select Windows From Application.
Enter your project name instead of WindowsApplication1 in the bottom of dialogue box and click OK
button. The following picture shows how to crate a new Form in Visual Studio.
The following picture shows how is the default Form look like.
At the top of the form there is a title bar which displays the forms title. Form1 is the default name; you can
change the name to your convenience. The title bar also includes the control box, which holds the minimize,
maximize, and close buttons.
If you want to set any properties of the Form, you can use Visual Studio Property window to change it.
Windows Forms
Toolbox
Apply object oriented programming language Page | 22
Information Sheet DBA
Toolbox contains controls that are used to build forms. Used to add controls (tools) to a form by either double-
clicking or dragging/dropping (your option on which to use).
Double-clicking the Button control causes VB to generate an event sub procedure named Button#_Click to
handle the Click event of the Button# control.
The Handles clause indicates that this sub procedure handles the Click event of the button named Button#.
The sub procedure ends with the line of code End Sub.
Each sub procedure must have a unique name – VB generates a name by combining the name of the control +
an underscore + the name of the event, e.g., Button#_Click.
Each sub procedure has two parameters inside of the parentheses that accompany the event name – these are
named sender and e.
e.g The form named Student Info is created as an instance of the general Form object defined in the .NET
Framework class library.
It is declared by the Public Class Student Info statement.
The End Class statement marks the end of the form's class definition.
Switching Between the View Designer and View Code Windows
Often you will need to switch between the View Designer and View Code windows. The different ways to do
this are:
Click one of the tabs to display either the View Designer or View Code windows.
Click the View Code icon in the Solution Explorer to open the coding window.
Click the View Designer icon in the Solution Explorer to display the form for additional design layout.
Click the View menu and select either the Code or Designer submenu options.
Accessing Intellisense
VB's Intellisense feature makes it easier for you to type programming statements. To access Intellisense simply
begin to type the name of an object such as the NameTextBox control shown in this figure – VB will pop up a
window that displays possible selections – this makes it easier for you to type code and leads to fewer typing
errors.
Apply object oriented programming language Page | 25
Information Sheet DBA
With the Intellisense focus on the NameTextBox, just type a dot (period) and the Intellisense will next display
all of the properties of the NameTextBox – type the letters "Te" (see the figure below) and Intellisense will
search and find the Text property and set the focus to that property for this text box control.
Now type an equal sign (=) followed by your name inside double-quotes, e.g., "Douglas Bock".
* The statement you've typed should look like this inside the sub procedure – VB will provide the
necessary spacing automatically.
* This is called an Assignment Statement
The Assignment Statement
The Assignment Statement is used to assign values to a property of an object such as a control. The value on
the right side of the equal sign is assigned to the property of the object on the left side of the equal sign.
Object.Property = Value
Assign a student name to the Text property of the TextBox control named. The assignment statements to do
this are:
Private Sub Display1Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Display1Button.Click
'Display information for the first student
NameTextBox.Text = "Douglas Bock"
End Sub
The value is enclosed within double-quote marks which indicate the value is a string of characters and only
string data is stored to the Text property of a TextBox control.
Run a project
There are several ways to run a project to test it.
Use the Debug menu, Start Debugging option, or
Press the F5 function key to run the project, or
Click the shortcut green arrow on the shortcut toolbar.
Error handling and debugging
Program debugging
Debugging is a multistep process that involves identifying a problem, isolating the source of the problem, and
then either correcting the problem or determining a way to work around it. The final step of debugging is to test
the correction or workaround and make sure it works.
Debugging is part of the software testing process and is an integral part of the entire software development
lifecycle. The debugging process starts as soon as code is written and continues in successive stages as code is
combined with other units of programming to form a software product. In a large program that has thousands
and thousands of lines of code, the debugging process can be made easier by using strategies such as unit tests,
code reviews and pair programming.
Once an error has been identified, it is necessary to actually find the error in the code. At this point, it can be
useful to look at the code's logging and use a stand-alone debugger tool or the debugging component of an
integrated development environment (IDE). Invariably, the bugs in the functions that get most use are found and
fixed first. In some cases, the module that presents the problem is obvious, while the line of code itself is not. In
that case, unit tests -- such as JUnit and xUnit, which allow the programmer to run a specific function with
specific inputs -- can be helpful in debugging.
Error handling
An act, assertion, or belief that unintentionally deviates from what is correct, right, or true. Errors in
programming can lead to a program not to run at all or run in unintended behavior. Errors can be grouped into
three categories:
1. Syntax errors
Syntax errors occur when you mistype a command or leave out an expected phrase or argument. Visual Basic
detects these errors as they occur and even provides help in correcting them. You cannot run a Visual Basic
program until all syntax errors have been corrected. A syntax error (compiler error) is a programming mistake
that violates the rules of Visual Basic, such as a misspelled property or keyword.
2. Run-time errors
Run-time errors are usually beyond your programs control. Visual Basic allows you to trap such errors and
make attempts to correct them. Run-time errors are trappable. That is, Visual Basic recognizes an error has
occurred and enables you to trap it and take corrective action.• Error trapping is enabled with the On Error
statement: On Error GoTo, On Error Resume Next.
Issuing warning whether or not to continue to run the program with the syntax error (continue or break)
The user can take corrective action based on the these information
Runtime Errors
Occurs when conditions arise during runtime that the compiler does not know how to handle
They are also called exceptions
They are identified through a diagnostic message box:
i. that displays the error type
On Error GoTo
On Error GoTo statements is an example of Vb.Net's Unstructured Exception Handling . VB.NET has two
types of Exception handling . Structured Error Handling and Unstructured Error handling . VB.NET using
Try..Catch statement for Structured Error handling and On Error GoTo statement is using for Unstructured
Error handling.
Error GoTo redirect the flow of the program in a given location.
On Error Resume Next - whenever an error occurred in runtime , skip the statement and continue execution on
following statements.
3. Logic errors
Logic errors are the most difficult to find. With logic errors, the program will usually run, but will produce
incorrect or unexpected results. A logic error is a human error a programming mistake that makes the program
code produces the wrong results. The Visual Basic debugger is an aid in detecting logic errors.
Exceptions
Exceptions are the occurrence of some condition that changes the normal flow of execution . For ex: you
programme run out of memory , file does not exist in the given path , network connections are dropped etc.
More specifically for better understanding , we can say it as Runtime Errors .
In .NET languages , Structured Exceptions handling is a fundamental part of Common Language Runtime .
It has a number of advantages over the On Error statements provided in previous versions of Visual Basic . All
exceptions in the Common Language Runtime are derived from a single base class , also you can create your
own custom Exception classes. You can create an Exception class that inherits from Exception class .
You can handle Exceptions using Try..Catch statement .
Try
code
exit from Try
Catch [Exception [As Type]]
code - if the exception occurred this code will execute
exit from Catch
example; Here we are going to divide a number by zero .
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim i As Integer
Dim resultValue As Integer
i = 100
resultValue = i / 0
MsgBox("The result is " & resultValue)
Catch ex As Exception
Thus, if you want to know what a program is meant to do and how it has to be executed, you should refer to the
program documentation. The most common examples would be the instruction manuals for a software product,
which is given to the end-user.
The document is dynamic and is maintained by the system development team and should he constantly updated
as the system’s development progresses. The software development folder should include the following
information for each unit:
The application developer assigned the primary responsibility for the module or unit creates a file folder
for the unit, labels it according to the name of the unit, and places it in the appropriate place in the project
team file cabinet.
The application developer(s) add copies of the indicated documentation to the folder as they are created.
The project QA representative reviews the contents of the folder for completeness, and points out
discrepancies to the developer assigned primary responsibility for tile module or unit.
The developer assigned primary responsibility for the module or unit completes the Software
Development Document Check-Off sheet and arranges for the System Technical Lead review and
approval when needed.
The folder is available to all project team member for review, but if removed from the file cabinet, it must
be replaced with a cheek-out card indicating who checked it out, when, and where it will he located.
For developing a perfect software following documents are mandatory in series:
1. URS ( User Requirements Specification): The URS point wise describes all the requirements of the
software.
2. UI: Depending on the URS certain pages of the software are designed. This also includes error messages,
pop up messages etc.
3. SRS (System Requirements Specification): The SRS point wise defines system requirements depending on
the URS.
4. STC (System Test Cases): After the software is developed system testing is done with and recorded in STC
5. UAT (User Acceptance Testing): After all system test cases are successful user acceptance testing in
conducted to check if the software covers all points as mentioned in the URS and is prepared as expected
6. DTL (Defect Track Log): All bugs/defects recorded during UAT/STC are mentioned in DTL so that they
can be fixed
Importance of Documentation
For a programmer reliable documentation is always a must. The presence of documentation helps keep track of
all aspects of an application and it improves on the quality of a software product. Its main focuses
are development, maintenance and knowledge transfer to other developers. Successful documentation
will make information easily accessible, provide a limited number of user entry points, help new users
learn quickly, simplify the product and help cut support costs. Documentation is usually focused on the
following components that make up an application: server environments, business rules, databases/files,
troubleshooting, application installation and code deployment.
1. Clarify your business goals, requirements and activities:With a proper documentation, you can share the
business goals and requirement with your managers and team mates so that they have a clear vision and
goals and the activity they perform will be more towards the success.
2. Design and Specify your product: This comes in Architectural/Design documents and it gives you
complete overview of how your products look like.
3. Everything is clearly explained: When you makes End User documentation of the product of software, you
have to explain each and everything about its working.It describes each feature of the program, and assists
the user in realizing these features.
4. Any body can work on other's code: If you are a developer, it is not sufficient to write good codes only
but you also need to take cares about the documentation part, which can be helpful to other developers while
working in a team.
5. Helpful in proper communication: A good software documentation is helpful in proper communication.
The written procedure helps you to make interaction within several departments.
Types of Software Documentation
Testing allows developers to deliver software that meets expectations, prevents unexpected results, and
improves the long term maintenance of the application. Depending upon the purpose of testing and the software
requirements, the appropriate methodologies are applied.
Software testing contributes to improving the quality of the product. While finding defects / bugs is one of the
purposes of software testing, it is not the sole purpose. It also Verify and validate that the product meets the
stated requirements / specifications. Software testing is performed to verify that the completed software package
functions according to the expectations defined by the requirements.
The overall objective to not to find every software bug that exists, but to uncover situations that could
negatively impact the customer, usability and/or maintainability.
From the module level to the application level, this article defines the different types of testing. Depending upon
the purpose for testing and the software requirements/specs, a combination of testing methodologies is applied.
There are different types of tests that inspect the different areas of your application:
Regression Tests: This is the process of running unit tests again after fixing any integration tests to make sure
your fixes haven't caused your unit tests to break. Regression testing is necessary because many times
modifications in one part of the code cause unexpected problems in a "totally unrelated" area of the code.
Functional testing: This type of testing ignores the internal parts and focus on the output is as per requirement
or not. Black-box type testing geared to functional requirements of an application.
Sanity testing: Testing to determine if a new software version is performing well enough to accept it for a
major testing effort. If application is crashing for initial use then system is not stable enough for further testing
and build or application is assigned to fix.
Load testing: Its a performance testing to check system behavior under load. Testing an application under
heavy loads, such as testing of a web site under a range of loads to determine at what point the system’s
response time degrades or fails.
Stress testing: System is stressed beyond its specifications to check how and when it fails. Performed under
heavy load like putting large number beyond storage capacity, complex database queries, continuous input to
system or database load.
Performance testing : Term often used interchangeably with ‘stress’ and ‘load’ testing. To check whether
system meets performance requirements. Used different performance and load tools to do this.
Apply object oriented programming language Page | 34
Information Sheet DBA
Usability testing: User-friendliness check. Application flow is tested, Can new user understand the application
easily, Proper help documented whenever user stuck at any point. Basically system navigation is checked in this
testing.
Install/uninstall testing: Tested for full, partial, or upgrade install/uninstall processes on different operating
systems under different hardware, software environment.
Recovery testing: Testing how well a system recovers from crashes, hardware failures, or other catastrophic
problems.
Security testing: Can system be penetrated by any hacking way. Testing how well the system protects against
unauthorized internal or external access. Checked if system, database is safe from external attacks.
Comparison testing: Comparison of product strengths and weaknesses with previous versions or other similar
products.
Alpha testing: In house virtual user environment can be created for this type of testing. Testing is done at the
end of development. Still minor design changes may be made as a result of such testing.
Beta testing – Testing typically done by end-users or others. Final testing before releasing application for
commercial purpose.
Fault Tolerant Testing: Module testing verifies that individual software unit does not perform in a detrimental
or unexpected manner for illegal or out-of-range input parameters. At the application level, testing verifies that
the entire application functions together in a graceful manner according to the requirements when presented
with unexpected and/or out-of-range values.
Before Segue releases an application, it undergoes a thorough testing process to ensure that the app is working
in the manner in which it was intended. There are four main stages of testing that need to be completed before a
program can be cleared for use:
1. Unit Testing
It’s quite common for software developers to perform unit tests before delivering software to testers for formal
testing (done by the programmer and not by testers, as it requires detailed knowledge of the internal program
design and code)
White box testing – This testing is based on knowledge of the internal logic of an application’s code. Also
known as Glass box Testing. Internal software and code working should be known for this type of testing. Tests
are based on coverage of code statements, branches, paths, conditions.
Black box testing – Internal system design is not considered in this type of testing. Tests are based on
requirements and functionality.
2. Integration Testing
Integration testing allows individuals the opportunity to combine all of the units within a program and test them
as a group. This testing level is designed to find interface defects between the modules/functions. This is
particularly beneficial because it determines how efficiently the units are running together. Keep in mind that no
matter how efficiently each unit is running, if they aren’t properly integrated, it will affect the functionality of
the software program. In order to run these types of tests, individuals can make use of various testing methods,
but the specific method that will be used to get the job done will depend greatly on the way in which the units
are defined.
3. System Testing
System testing is the first level in which the complete application is tested as a whole. The goal at this level is
to evaluate whether the system has complied with all of the outlined requirements and to see that it meets
Quality Standards. System testing is undertaken by independent testers who haven’t played a role in developing
the program. This testing is performed in an environment that closely mirrors production. System Testing is
very important because it verifies that the application meets the technical, functional, and business requirements
that were set by the customer.
4. Acceptance Testing
The final level, Acceptance testing (or User Acceptance Testing), is conducted to determine whether the
system is ready for release. During the Software development life cycle, requirements changes can sometimes
be misinterpreted in a fashion that does not meet the intended needs of the users. During this final phase, the
user will test the system to find out whether the application meets their business’ needs. Once this process has
been completed and the software has passed, the program will then be delivered to production. Normally this
type of testing is done to verify if system meets the customer specified requirements. User or customer do this
testing to determine whether to accept application.
A testing unit should focus on one tiny bit of functionality and prove it correct.
Each test unit must be fully independent. Each test must be able to run alone, and also within the test suite,
regardless of the order that they are called. The implication of this rule is that each test must be loaded with
a fresh dataset and may have to do some cleanup afterwards.
Try hard to make tests that run fast. If one single test needs more than a few milliseconds to run,
development will be slowed down or the tests will not be run as often as is desirable. In some cases, tests
can’t be fast because they need a complex data structure to work on, and this data structure must be loaded
Learn your tools and learn how to run a single test or a test case. Then, when developing a function inside a
module, run this function’s tests frequently, ideally automatically when you save the code.
Always run the full test suite before a coding session, and run it again after. This will give you more
confidence that you did not break anything in the rest of the code.
It is a good idea to implement a hook that runs all tests before pushing code to a shared repository.
If you are in the middle of a development session and have to interrupt your work, it is a good idea to write
a broken unit test about what you want to develop next. When coming back to work, you will have a pointer
to where you were and get back on track faster.
The first step when you are debugging your code is to write a new test pinpointing the bug. While it is not
always possible to do, those bug catching tests are among the most valuable pieces of code in your project.
When something goes wrong or has to be changed, and if your code has a good set of tests, you or other
maintainers will rely largely on the testing suite to fix the problem or modify a given behavior. Therefore
the testing code will be read as much as or even more than the running code. A unit test whose purpose is
unclear is not very helpful in this case.
Another use of the testing code is as an introduction to new developers. When someone will have to work
on the code base, running and reading the related testing code is often the best thing that they can do to start.
They will or should discover the hot spots, where most difficulties arise, and the corner cases. If they have
to add some functionality, the first step should be to add a test to ensure that the new functionality is not
already a working path that has not been plugged into the interface.