** Try the tips in the [[#Comments:|Comments section]] below if you get really stuck.

** Try the tips in the [[#Comments:|Comments section]] below if you get really stuck.

* Start a new Java Project and include your own name in the 'Project name' field.

* Start a new Java Project and include your own name in the 'Project name' field.

−

** Example Project Name: "NumberCounter-NYeates"

+

** Ex: "NumberCounter-NYeates"

Line 167:

Line 171:

The below appendix includes information found while researching and creating the above Learning Activity. Instructors may find it useful if they are wanting to create their own follow-on activities or want more info.

The below appendix includes information found while researching and creating the above Learning Activity. Instructors may find it useful if they are wanting to create their own follow-on activities or want more info.

−

=== Examples of OSS projects that use TDD ===

+

=== Examples of OSS projects that were implemented with TDD ===

==== Best examples ====

==== Best examples ====

* http://junit.org/

* http://junit.org/

Revision as of 10:20, 19 February 2016

Title

Test Driven Development (TDD) Introduction using Java in Eclipse/JUnit

Overview

Students will follow and implement a beginner level java-based Test Driven Development (TDD) approach with JUnit in the Eclipse IDE. First, they create a test case that fails, then they start creating mock code, and finally a simple piece of code that allows their test to pass.

Prerequisite Knowledge

Students should be familiar with:

Programming simple Java

Developing object-oriented software (classes, methods, instances)

Test Driven Development (TDD) workflow and theory

Learning Objectives

Upon completion, students should be able to:

Install and use Eclipse IDE and JUnit

Use JUnit in Eclipse to implement and run a failing TDD test

Use JUnit in Eclipse to implement code that passes a TDD test

Background:

Background reading

None of these are required by the student, but can be used in the learning of TDD that must precede this activity:

Rationale

The method of how developers go about implementing code is varied. Test driven development is one such method stemming in the 2000's that has gained momentum as an accepted and research-proven method for increasing software quality, readability, and reliability. Testing software to assure that it works within particular constraints is an extension of quality assurance (QA) efforts that most professional software products enact to increase their products value. With TDD, this testing is built-in even before students write their first line of code. This means that students will have a better grasp on what they are programming and why. It means that students will have code that not only works when they first implement it, but that will continue to work when others develop next to it and run the same tests.

Directions:

This activity follows a tutorial that steps you through the TDD development process in the Eclipse IDE using its integrated JUnit module. Follow the below tutorials while implementing the TDD test code in Eclipse on your own computer. Finally, you will create actual non-test code that gets the tests to succeed (green JUnit bar). You will hand in this code, the associated test, and two screenshots.

Suggestions for Open Source Community:

Suggestions for an open source community member who is working in conjunction with the instructor.

Show students any unit testing or TDD-based development you may already have in place. A real life example, with an explanation from a community developer would be a perfect way to solidify the understanding that testing is necessary for real world software.

Appendix

The below appendix includes information found while researching and creating the above Learning Activity. Instructors may find it useful if they are wanting to create their own follow-on activities or want more info.