CSC/ECE 517 Fall 2009/wiki1a 1 JunitTest

From Expertiza_Wiki
Revision as of 16:17, 7 September 2009 by Wolverine (talk | contribs)
Jump to navigation Jump to search

Writing Effective JUnit Test Cases
----------------------------------------------------

JUnit is a testing framework aimed at making unit testing easy by simplifying the writing of test cases and by providing automated running of tests and test suites.

The main aim of this document is to provide a repository of rules that can be used in-order to write an effective Junit test. This doc also discusses various sites and suggest which are the best sites to read for an overview of the topic and to understand the different philosophies of test-case design.

Introduction

Unit Testing Overview

The primary goal of unit testing is to take the smallest piece of testable software in the application, isolate it from the remainder of the code, and determine whether it behaves exactly as you expect.

Test Case
It describes a scenario that can be exercised through the application.
Each test case is divided into two parts: input and expected output.
The input part lists all the test case statements that create variables or assign values to variables.
The expected output part indicates the expected results; it shows either assertions or the message 'no exception' (when no assertions exist).

Junit Overview

Websites to lookout

For Overview

For Ideas on test case design

How to get started

Setup

Simple testing example

Rules for writing effective Junit test cases

Conclusion

References