Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

MAVEN

Maven is a powerful project management


tool that is based on POM (project object
model). It is used for projects build,
dependency and documentation.

What is It simplifies the build process like ANT.


But it is too much advanced than ANT.

Maven
Current version of Maven is 3.
Problem without Maven
There are many problems that we face during the project
development. They are discussed below:

1) Adding set of Jars in each project: In case of struts, spring,


hibernate frameworks, we need to add set of jar files in each
project. It must include all the dependencies of jars also.

2) Creating the right project structure: We must create the right


project structure in servlet, struts etc, otherwise it will not be
executed.

3) Building and Deploying the project: We must have to build


and deploy the project so that it may work.
It makes a project easy to build

It provides uniform build process (maven project


What can be shared by all the maven projects)

Maven It provides project information (log document,


cross referenced sources, mailing list,
dependency list, unit test reports etc.)
does?
It is easy to migrate for new features of Maven
Builds

Apache Documentation

Maven Reporing

helps to SCMs

manage Releases

Distribution
A build tool takes care of everything for building a process.

It does following:

Generates source code (if auto-generated code is used)

What is Generates documentation from source code

Build Compiles source code

Tool Packages compiled code into JAR of ZIP file

Installs the packaged code in local repository, server repository, or


central repository
Difference between Ant and Maven
Ant Maven

Ant doesn't has formal conventions, so we need to provide Maven has a convention to place source code, compiled code
information of the project structure in build.xml file. etc. So we don't need to provide information about the project
structure in pom.xml file.

Ant is procedural, you need to provide information about what Maven is declarative, everything you define in the pom.xml
to do and when to do through code. You need to provide order. file.

There is no life cycle in Ant. There is life cycle in Maven.

It is a tool box. It is a framework.

It is mainly a build tool. It is mainly a project management tool.

The ant scripts are not reusable. The maven plugins are reusable.

It is less preferred than Maven. It is more preferred than Ant.


How to install Maven on windows
Download Download maven and extract it

Add Add JAVA_HOME and MAVEN_HOME in environment variable

Add Add maven path in environment variable

Verify Verify Maven


JUNIT
It is an open-source testing framework for
java programmers. The java programmer
can create test cases and test his/her own
code.

What is It is one of the unit testing framework.


Current version is junit 4.
Junit
To perform unit testing, we need to create
test cases. The unit test case is a code
which ensures that the program logic works
as expected.
Types of Testing

01 02
1) Manual Testing -If you 2) Automated Testing- If
execute the test cases you execute the test cases
manually without any tool by tool support, it is known
support, it is known as as automated testing. It is
manual testing. It is time fast and more reliable.
consuming and less
reliable.
JUnit is an open source framework, which is used
for writing and running tests.

Provides annotations to identify test methods.

Features Provides assertions for testing expected results.

of JUnit Provides test runners for running tests.

JUnit tests allow you to write codes faster, which


increases quality.
JUnit is elegantly simple. It is less complex and
takes less time.

JUnit tests can be run automatically and they check


their own results and provide immediate feedback.
There's no need to manually comb through a report
of test results.

Features
of JUnit JUnit tests can be organized into test suites
containing test cases and even other test suites.

JUnit shows test progress in a bar that is green if the


test is running smoothly, and it turns red when a test
fails.
A Unit Test Case is a part of code, which
ensures that another part of code
(method) works as expected. To achieve
What is the desired results quickly, a test
framework is required. JUnit is a perfect
unit test framework for Java programming
a Unit language.

Test A formal written unit test case is


characterized by a known input and an
expected output, which is worked out
Case ? before the test is executed. The known
input should test a precondition and the
expected output should test a post-
condition.
Annotations for Junit testing
The Junit 4.x framework is annotation based, so let's see the annotations that
can be used while writing the test cases.

@Test annotation specifies that method is the test method.

@Test(timeout=1000) annotation specifies that method will be failed if it


takes longer than 1000 milliseconds (1 second).

@BeforeClass annotation specifies that method will be invoked only once,


before starting all the tests.
Annotations for Junit testing cont..

@Before annotation specifies that method will be invoked


before each test.

@After annotation specifies that method will be invoked after


each test.

@AfterClass annotation specifies that method will be invoked


only once, after finishing all the tests.

You might also like