Java For Testers Learn Java Fundamentals Fast - Alan Richardson.pdf

(1724 KB) Pobierz
Java For Testers
Learn Java fundamentals fast
This version was published on 2015-02-27
The right of Alan Richardson to be identified as the author of this work has been asserted
by him in accordance with the Copyright, Design and Patents Act 1988.
The views expressed in this book are those of the author.
First published in Great Britain in 2015 by:
Compendium Developments
http://www.compendiumdev.co.uk
contact details:
alan@compendiumdev.co.uk
Related WebSites:
Java For Testers: javaForTesters.com
Author’s Software Testing Blog: eviltester.com
Compendium Developments: compendiumdev.co.uk
Author’s Selenium Blog: seleniumSimplified.com
Every effort has been made to ensure that the information contained in this book is
accurate at the time of going to press, and the publishers and author cannot accept any
responsibility for any errors or omissions, however caused. No responsibility for loss or
damage occasioned by any person acting, or refraining from action, as a result of the
material in this publication can be accepted by the editor, the publisher or the author.
Apart from any fair dealing for the purposes of research or private study, or criticism or
review, as permitted under the Copyright, Design and Patents Act 1988; this publication
may only be reproduced, stored or transmitted, in any form or by any means, with the
prior permission of the publishers, or in the case of reprographic reproduction in
accordance with the terms and licenses issued by the Copyright Licensing Agency, 90
Tottenham Court Road, London, W1T 4LP. Enquiries concerning reproduction outside
these terms should be sent to the publishers.
e-book ISBN : 978-0-9567332-4-5
© 2013 - 2015 Alan Richardson, Compendium Developments Ltd
As ever. This book is dedicated to Billie and Keeran.
Table of Contents
Introduction
Testers use Java differently
Exclusions
Supporting Source Code
About the Author
Acknowledgments
Chapter One - Basics of Java Revealed
Java Example Code
Chapter Two - Install the Necessary Software
Introduction
Do you already have JDK or Maven installed?
Install The Java JDK
Install Maven
Install The IDE
Create a Project using the IDE
About your new project
Add JUnit to the
pom.xml
file
Summary
Chapter Three - Writing Your First Java Code
My First JUnit Test
Prerequisites
Create A JUnit Test Class
Create a Method
Make the method a JUnit test
Calculate the sum
Assert the value
Run the
@Test
method
Summary
References and Recommended Reading
Chapter Four - Work with Other Classes
Use
@Test
methods to understand Java
Warnings about
Integer
Summary
References and Recommended Reading
Chapter Five - Working with Our Own Classes
Context
First create an
@Test
method
Write code that doesn’t exist
New Requirements
Now Refactor
Summary
Chapter Six - Java Classes Revisited: Constructors, Fields, Getter & Setter
Methods
Context
Constructor
Getters and Setters
Summary
References and Recommended Reading
Chapter Seven - Basics of Java Revisited
Comments
Statement
Packages
Java Classes
Importing Classes
Static Imports
Data Types
Operators
Strings
Summary
References and Recommended Reading
Chapter Eight - Selections and Decisions
Ternary Operators
if
statement
else
statement
Nested
if
else
switch
statement
Summary
References and Recommended Reading
Chapter Nine - Arrays and For Loop Iteration
Arrays
Exercises
Summary
References and Recommended Reading
Chapter Ten - Introducing Collections
A Simple Introduction
Iterating with
while
and
do…while
Interfaces
Summary
Zgłoś jeśli naruszono regulamin