You are on page 1of 7

HTTP stands for Hyper Text Transfer Protocol

WWW is about communication between web clientsand servers


Communication between client computers and web servers is done by
sending HTTP Requests and receiving HTTP Responses

Contributor(s): Jessica Scarpati


A host (also known as "network host") is a computer or other device that
communicates with other hosts on a network. Hosts on a network include
clients and servers -- that send or receive data, services or applications.

Hosts typically do not include intermediary network devices like switches and
routers, which are instead often categorized as nodes. A node is also a
broader term that includes anything connected to a network, while a host
requires an IP address. In other words, all hosts are nodes, but network
nodes are not hosts unless they require an IP address to function.

On a TCP/IP network, each host has a host number that, together with a
network identity, forms its own unique IP address. In the Open Systems
Interconnection (OSI) model, protocols in the transport layer, also known as
Layer 4, are responsible for communication between hosts. Hosts use various
protocols to communicate, including transmission control protocol (TCP) and
User Datagram Protocol (UDP).

(URL)A Uniform Resource Locator , colloquially termed a web address, is a


reference to a web resource that specifies its location on a computer network
and a mechanism for retrieving it. A URL is a specific type of Uniform
Resource Identifier(URI),although many people use the two terms
interchangeably.] URLs occur most commonly to reference web pages (http),
but are also used for file transfer (ftp), email (mailto), database access
(JDBC), and many other applications.
Most web browsers display the URL of a web page above the page in an
address bar. A typical URL could have the form
http://www.example.com/index.html, which indicates a protocol (http), a
hostname (www.example.com), and a file name (index.html).

JSON: JavaScript Object Notation.


JSON is a syntax for storing and exchanging data.
JSON is text, written with JavaScript object notation.
DOM XML Parser in Java

DOM parser is a tree-based API. A tree-based API is centered around a tree structure and therefore
provides interfaces on components of a tree (which is a DOM document) such as Document
interface,Node interface, NodeList interface, Element interface, Attr interface and so on.

A DOM parser creates a tree structure in memory from the input document and then waits for requests
from client. A DOM parser always serves the client application with the entire document no matter
how much is actually needed by the client. With DOM parser, method calls in client application have
to be explicit and forms a kind of chained method calls.

SAX XML Parser in Java

SAX parser is a event-based API. Usually an event-based API provides interfaces on handlers. There
are four handler interfaces, ContentHandlerinterface, DTDHandler interface, EntityResolver interface
and ErrorHandler interface.

SAX parser does not create any internal structure. Instead, it takes the occurrences of components of a
input document as events, and tells the client what it reads as it reads through the input document.
SAX parser serves the client application always only with pieces of the document at any given time.
With SAX parser, some custom methods are called [ “callback” methods ] when some certain events
occur during parsing on xml document. These methods do not have to be called explicitly by the
client, though we could call them explicitly.

Difference between DOM and SAX XML Parser in Java

Let’s list down an easy to remember short list of differences.

DOM (Document Object Model)

● Parses entire document


● Represents result as a tree
● Lets you search tree
● Lets you modify tree
● Good for reading data/configuration files

SAX

● Parses until you tell it to stop


● Fires event handlers for each:
1. Start tag
2. Tag body
3. End tag
● Low level APIs
● Good for very large documents, especially if you only care about very
small portions of the document.
Serialization refers to the translation of java object state into bytes to send it over the network or
store it in hard disk.

Why we need Serialization?


We need serialization because the hard disk or network infrastructure are hardware component and we
cannot send java objects because it understands just bytes and not java objects.

@Test ( expectedExceptions = { IOException.class, NullPointerException.class } )

verify that an exception is being thrown by the program during execution. TestNG provides a feature
to test such scenarios by allowing the user to specify the type of exceptions that are expected to be
thrown by a test method during execution. It supports multiple values being provided for verification.
If the exception thrown by the test is not part of the user entered list, the test method will be marked
as failed.

@Test(timeOut = 300)
We can specify a timeout for our TestNG tests. This can be done in the test class by setting
timeOutproperty of @Test annotation.

Sometimes we want our test cases to run in specific order

dependsOnMethods to tell TestNG which methods this test is dependent on, so those methods
should be executed before this method.

DependsOnGroup test depends on any other groups. This is helpful when we have multiple methods
and they are grouped together. So we can simply specify the group this test depends on, rather than
specifying the huge list of all the methods.

@Before Methods annotated with the annotation are executed before each test. This is useful when
we want to execute some common code before running a test.

@BeforeSuite @BeforeSuite

The annotated method will be run only once

before all tests in this suite have run.


2 @AfterSuite

The annotated method will be run only once

after all tests in this suite have run.

3 @BeforeClass

The annotated method will be run only once

before the first test method in the current class

is invoked.

4 @AfterClass

The annotated method will be run only once

after all the test methods in the current class

have run.

5 @BeforeTest

The annotated method will be run before any

test method belonging to the classes inside the

<test> tag is run.

6 @AfterTest

The annotated method will be run after all the

test methods belonging to the classes inside the

<test> tag have run.


7 @BeforeGroups

The list of groups that this configuration

method will run before. This method is

guaranteed to run shortly before the first test

method that belongs to any of these groups is

invoked.

8 @AfterGroups

The list of groups that this configuration

method will run after. This method is

guaranteed to run shortly after the last test

method that belongs to any of these groups is

invoked.

9 @BeforeMethod

The annotated method will be run before each

test method.

10 @AfterMethod

The annotated method will be run after each

test method.
11 @DataProvider

Marks a method as supplying data for a test

method. The annotated method must return an

Object[ ][ ], where each Object[ ] can be

assigned the parameter list of the test method.

The @Test method that wants to receive data

from this DataProvider needs to use a

dataProvider name equals to the name of this

annotation.

12 @Factory

Marks a method as a factory that returns

objects that will be used by TestNG as Test

classes. The method must return Object[ ].

13 @Listeners

Defines listeners on a test class.

14 @Parameters

Describes how to pass parameters to a @Test

method.
15 @Test Marks a class or a method as a part of

the test

You might also like