CS计算机代考程序代写 Java ER junit COMP2511

COMP2511

JUnit

Prepared by
Dr. Ashesh Mahidadia

Software Testing

v Different types of testing:
o Object Oriented Design document describes responsibilities of classes and methods (APIs) à Unit Testing
o System Design Document à Integration Testing
o Requirements Analysis Document à System Testing
o Client Expectation à Acceptance Testing

v Unit Testing is also useful for refactoring tasks.

v In this course, we will focus on Unit testing.

COMP2511: JUnit 2

JUnit

v JUnit is a popular unit testing (open source) framework for testing Java programs.

v Most popular IDEs facilitate easy integration of Junit.

v Basic Junit Terminology:

o Test Case – Java class containing test methods

o Test Method – a method that executes the test code, annotated with @Test, in a Test
Case

o Asserts – asserts or assert statements check an expected result versus the actual result

o Test Suites – collection of several Test Cases

COMP2511: JUnit 3

COMP2511: JUnit 4

JU
ni

t
Ex

am
pl

e:
a

ss
er

tE
qu

al
s,

a
ss

er
Tr

ue

COMP2511: JUnit 5

JU
ni

t
Ex

am
pl

e:
E

xc
ep

ti
on

Junit: Dynamic and parameterized tests

For information on Dynamic and parameterized tests,

v see the tutorial at https://www.vogella.com/tutorials/JUnit/article.html

For more information on JUnit, read the user guide at:

v https://junit.org/junit5/docs/current/user-guide/

COMP2511: JUnit 6

https://www.vogella.com/tutorials/JUnit/article.html
https://junit.org/junit5/docs/current/user-guide/

End

COMP2511: JUnit 7