Overview
This course is designed to bring about a fundamental change to the way developers go about their day-to-day business of writing software code. Instead of thinking about unit tests as at best an afterthought, having already written the application code, the course aims to turn this practice on its head, and get programmers to write tests before the code to be tested.
Originating in the Agile methodology of Extreme Programming, Test Driven Development (TDD) has become accepted as a mainstream best practice, and is being adopted by major organisations as means of improving code quality and developer productivity.
Because Test Driven Development involves such a major inversion of most developers' ways of thinking and working, the course is strongly exercise based - it is necessary to spend a large part of the two days of the workshop practicing test-first development.
Typically developers find TDD initially strange, but go on to find it quite liberating, and become 'test infected' (unable to write code without having first devised unit tests.)
The exercises are based on the Java programming language, and use the tools most central to TDD in Java, including Eclipse (students are free to use tools they are comfortable with), JUnit and some of its extensions, Hamcrest, mocking with jMock and developing system level TDD scripts using fitnesse.
Prerequisites
Competence in Java, or similar object-oriented programming language.
Learning Outcomes
At the end of this course you will have:
- The ability to take the TDD approach to software development
- An understanding of the key techniques and strategies of TDD, and principles of refactoring code
- The ability to write unit tests in JUnit versions 4 and 3
- The ability to use mock objects in unit tests
- Work with fitnesse to develop system level tests
- Track down bugs quickly using JUnit and fitnesse
Course Outline
Unit tests and the xUnit framework.
- JUnit overview
- The TestCase and Assert classes
- Developing a JUnit 4 test and test suite for a class
- Java 5 features used in JUnit 4
- JUnit 4 versions of tests and test suites
- JUnit and ant
Motivation for using Mock Objects.
- Stubs and Mocks
- Worked example
- EasyMock argument matchers
- Mocking and Static methods.
- When to use Mock Objects
- Drawbacks of Mock Objects
Test Driven Development.
- Test Driven Development
- Benefits of TDD
- TDD Strategies - with JUnit and with fitnesse
- TDD Process: Worked Examples with JUnit
- TDD Process: Worked Examples with fitnesse
- TDD Testing Best Practices
- Exception tests
- Performance tests
- Fixing broken code in a speedy manner, successfully tracking down bugs using a combination of unit tests and TDD scripts
'Code Smells'.
- Benefits of Refactoring Code.
- Important Refactorings
- Testing Patterns
- Testing Heuristics
- Coverage
Conclusion
- Pros and Cons of TDD
The workshop is strongly oriented towards lab work. In order to reverse deeply ingrained habits, of writing code first and tests only as a possible afterthought, it is essential to give developers as much time as possible working in a test-first manner.
Frequently asked questions
See all of our FAQsHow can I create an account on myQA.com?
There are a number of ways to create an account. If you are a self-funder, simply select the "Create account" option on the login page.
If you have been booked onto a course by your company, you will receive a confirmation email. From this email, select "Sign into myQA" and you will be taken to the "Create account" page. Complete all of the details and select "Create account".
If you have the booking number you can also go here and select the "I have a booking number" option. Enter the booking reference and your surname. If the details match, you will be taken to the "Create account" page from where you can enter your details and confirm your account.
Find more answers to frequently asked questions in our FAQs: Bookings & Cancellations page.
How do QA’s virtual classroom courses work?
Our virtual classroom courses allow you to access award-winning classroom training, without leaving your home or office. Our learning professionals are specially trained on how to interact with remote attendees and our remote labs ensure all participants can take part in hands-on exercises wherever they are.
We use the WebEx video conferencing platform by Cisco. Before you book, check that you meet the WebEx system requirements and run a test meeting (more details in the link below) to ensure the software is compatible with your firewall settings. If it doesn’t work, try adjusting your settings or contact your IT department about permitting the website.
Learn more about our Virtual Classrooms.
How do QA’s online courses work?
QA online courses, also commonly known as distance learning courses or elearning courses, take the form of interactive software designed for individual learning, but you will also have access to full support from our subject-matter experts for the duration of your course. When you book a QA online learning course you will receive immediate access to it through our e-learning platform and you can start to learn straight away, from any compatible device. Access to the online learning platform is valid for one year from the booking date.
All courses are built around case studies and presented in an engaging format, which includes storytelling elements, video, audio and humour. Every case study is supported by sample documents and a collection of Knowledge Nuggets that provide more in-depth detail on the wider processes.
Learn more about QA’s online courses.
When will I receive my joining instructions?
Joining instructions for QA courses are sent two weeks prior to the course start date, or immediately if the booking is confirmed within this timeframe. For course bookings made via QA but delivered by a third-party supplier, joining instructions are sent to attendees prior to the training course, but timescales vary depending on each supplier’s terms. Read more FAQs.
When will I receive my certificate?
Certificates of Achievement are issued at the end the course, either as a hard copy or via email. Read more here.