Sie sind auf Seite 1von 20

JSPM’S

Bhivarabai Sawant Institute of Technology & Research

Pune-412207

Department Of Computer Engineering

Academic Year 2019-20

Mini Project Report


On
“Unit testing and
Integration testing”

Submitted by:
Kirti Reddy(BEA_39)
Charul Joshi(BEA_40)
Danesh Bastani(BEA_48)

Under the guidance of

Prof. Ankita Sharma

Subject : Laboratory Practice –II

pg. 1
DEPARTMENT OF COMPUTER ENGINEERING

BHIVARABAI SAWANT INSTITUTE OF TECHNOLOGY & RESEARCH

WAGHOLI, PUNE – 412 207

CERTIFICATE

This is to certify that the Kirti Reddy(BEA_39) ,Charul Joshi(BEA_40), Danesh


Bastani(BEA_48) have submitted their Project report on “ Unit testing and integration testing
”under my guidance and supervision. The work has been done to my satisfaction during the
academic year 2019-2020 under Savitribai Phule Pune University guidelines.

Date:

Place: BSIOTR, PUNE.

Prof.Ankita Sharma Dr. Prof. Gayatri Bhandari


Project Guide H.O. D.

pg. 2
ACKNOWLEDGEMENT

This is a great pleasure & immense satisfaction to express our deepest sense of
gratitude & thanks to everyone who has directly or indirectly helped us in
completing our Project work successfully.

We express our gratitude towards guide Prof.Ankita Sharma and Dr.Prof.


G.M.Bhandari Head of Department of Computer Engineering, Bhivarabai Sawant
Institute of Technology and Research, Wagholi, Pune who guided & encouraged us
in completing the Project work in scheduled time. We would like to thank our
Principal, for allowing us to pursue our Project in this institute.

Kirti Reddy (BEA_39)


Charul Joshi (BEA_40)
Danesh Bastani (BEA_48)

pg. 3
INDEX
Page
Sr. No. Chapters (14 points)
No

List of figures 2

1. Abstract 3

2. INTRODUCTION 6

3. MOTIVATION 7

4. OBJECTIVES AND SCOPE 8

PROPOSED SYSTEM 9
5.
METHODOLOGY

6. SYSTEM REQUIREMENTS 10

ADVANTAGES AND 11
7.
DISADVANTAGES

8. APPLICATIONS 11

9. CONCLUSION 13

10. REFERENCES 14

pg. 4
LIST OF FIGURES

Fig No. Name of the Figures Page No.


3.1 Junit Architecture 11
7.1 code of unit testing 16
7.2 Error free output 17

pg. 5
ABSTRACT

A unit test is a piece of code written by a developer that executes a specific functionality in the
code to be tested and asserts a certain behavior or state. The percentage of code which is tested
by unit tests is typically called test coverage. System Integration Test is done to test the
complete integrated system. Modules or components are tested individually before integrating
the components. Once all the modules are tested, system integration testing is done
by integrating all the modules and the system as a whole is tested.

pg. 6
CHAPTER 2

INTRODUCTION

JUnit

JUnit is a framework which supports several annotations to identify a


method which contains a test. JUnit provides an annotation called @Test, which
tells the JUnit that the public void method in which it is used can run as a test case.
A test fixture is a context where a test case runs.
JUnit is widely used testing framework along with Java Programming
Language. You can use this automation framework for both unit testing and UI
testing. it helps us define the flow of execution of our code with different
Annotations.

Integration test
Integration testing is the phase in software testing in which individual software
modules are combined and tested as a group. Integration testing is conducted to
evaluate the compliance of a system or component with specified functional
requirements. It occurs after unit testing and before validation testing.

Integration testing is a level of software testing where individual units are


combined and tested as a group. The purpose of this level of testing is to expose
faults in the interaction between integrated units. Test drivers and test stubs are
used to assist in Integration Testing. Definition by ISTQB.
Integration tests check that the whole system works as intended; therefore they are
reducing the need for intensive manual tests.

pg. 7
CHAPTER 3

MOTIVATION
JUnit is a framework for implementing testing in Java.
It provides a simple way to explicitly test specific areas of a Java program, it is
extensible and can be employed to test a hierarchy of program code either
singularly or as multiple units.
Using a testing framework is beneficial because it forces you to explicitly
declare the expected results of specific program execution routes. When debugging
it is possible to write a test which expresses the result you are trying to achieve and
then debug until the test comes out positive.
JUnit is an open source unit testing tool that helps to test units of code. It is mainly
used for unit testing Java project, however, it can be used with Selenium tool to
automate testing of Web applications. So you can even perform automation testing
of a web application with JUnit.

pg. 8
CHAPTER 4

OBJECTIVES AND SCOPE

 Creating the right test gives precise feedback loop mechanism between both
developers and test engineers.
 Tests run faster compared to end to end tests.

 Code Coverage is higher and easy to track.


 Integration tests catch system-level issues, such as a broken database schema,
mistaken cache integration, and so on

pg. 9
CHAPTER 5

PROPOSED SYSTEM METHODOLOGY

fig4.1. Architecture of junit


Its main responsibility is to launch the testing frameworks on the JVM. As you
see in the architecture diagram it is an interface between build tools, tests, IDE
and JUnit. It also defines Test Engine API to create a testing framework which
operates on JUnit platform and in this way we can use external libraries in JUnit
ecosystem by implementing custom engines.

pg. 10
CHAPTER 6
SYSTEM REQUIREMENTS

Software Requirement:

 Eclipse

 Jdk 8.0

pg. 11
CHAPTER 7

ADVANTAGES:

 Every time you make a small or a big modification in the code (in any function), you
can make sure that the function is performing well and has not broken any older
functionality by executing all JUnit test cases in one go written for that function.

 Easily create and most importantly manage a rich unit test case suite for the entire
software.

 JUnit has become a standard for testing in Java programming language and is
supported by almost all IDE’s e.g Netbeans, Eclipse etc. So, you work in any
standarized IDE environment, you would find the support of JUnit in it.

 You can also integrate Ant with JUnit to allow executing test suites (all unit test cases)
as part of the build process, capturing their output, and generating rich color enhanced
reports

 JUnit ensures that every single part or functioning in your software is tested even
before module or System level testing is performed.

pg. 12
DISADVANTAGES:

 There is a limit to the number of scenarios and test data that the developer can use to
verify the source code. So after he has exhausted all options there is no choice but to stop
unit testing and merge the code segment with other units

 It is impossible to evaluate every execution path in every software application. The


same is the case with unit testing.

pg. 13
CHAPTER 8

APPLICATIONS

 JUnit writing and running test cases for java programs.


 In the case of web applications JUnit is used to test the application with out server.
 This framework builds a relationship between development and testing process
 Unit testing of software applications is done during the development of application.
 The main application of unit teasting is to isolate selection of code and verify its
correctness.
 Integration testing is used to expose faults in the interaction between integrated units.

pg. 14
Code for Testing

Code :
TestJunit.java

public class TestJUnit


{
public int addNumber(int a, int b)
{
return a+b;
}
public int subNumber(int a, int b)
{
return a-b;
}
public int mulNumber(int a, int b)
{
return a*b;
}
}

pg. 15
junittest.java

import static org.junit.Assert.*;

import org.junit.Test;

public class junittest


{

@Test
public void test()
{
TestJUnit test = new TestJUnit();
int result = test.addNumber(5, 7);
assertEquals(12,result);
int result1 = test.subNumber(8, 7);
assertEquals(1,result1);
int result2 = test.mulNumber(5, 7);
assertEquals(35,result2);
}

pg. 16
Chapter 7

OUTPUT:

pg. 17
fig7.1 .Output of JUnit testing

This is the final output of junit testing. In this there are two files i.e
Testunit.java and junittest.java. Test class is used in junit.java and junit tool
class is used in junittool.java. We used two methods in junit.java and
junitool.java. This program is finally run without any error.

pg. 18
CHAPTER 9

CONCLUSION

In computer programming, unit testing is a software testing method by


which individual units of source code are tested to determine whether they are
fit for use. A unit is the smallest possible testable software component. Usually,
it performs a single cohesive function.

pg. 19
REFERENCES

1. https://www.google.com/search?q=junit+testing&rlz=1C1CHB
F_enIN865IN865&oq=junit&aqs=chrome.2.69i59j69i57j0l2j6
9i60l2.8251j0j7&sourceid=chrome&ie=UTF-8

2. http://softwaretestingfundamentals.com/integration-testing

pg. 20

Das könnte Ihnen auch gefallen