About the Book
The main subject of this book is software testing. The main premise is that testing is a crucial part of software development. You need to make sure that the software you write behaves correctly. You can manually test your software. However, manual tests require lots of manual work and it is error-prone.
On the contrary, this book focuses on automated tests, which can be done at several levels. In the book, we will see a few types of tests, starting from those that test a single component in isolation to those that test the entire application. We will also deal with tests in the presence of a database and with tests that verify the correct behavior of the graphical user interface.
In particular, we will describe and apply the Test-Driven Development methodology, writing tests before the actual code.
Throughout the book, we will use Java as the main programming language. We use Eclipse as the IDE. Both Java and Eclipse have a huge ecosystem of "friends", that is, frameworks, tools, and plugins. Many of them are related to automated tests and perfectly fit the goals of the book. We will use JUnit throughout the book as the main Java testing framework.
it is also important to be able to completely automate the build process. In fact, another relevant subject of the book is Build Automation. We will use one of the mainstream tools for build automation in the Java world, Maven.
We will use Git as the Version Control System and GitHub as the hosting service for our Git repositories. We will then connect our code hosted on GitHub with a cloud platform for Continuous Integration. In particular, we will use GitHub Actions. With the Continuous Integration process, we will implement a workflow where each time we commit a change in our Git repository, the CI server will automatically run the automated build process, compiling all the code, running all the tests and possibly create additional reports concerning the quality of our code and of our tests.
The code quality of tests can be measured in terms of a few metrics using code coverage and mutation testing. Other metrics are based on static analysis mechanisms, inspecting the code in search of bugs, code smells, and vulnerabilities. For such a static analysis we will use SonarQube and its free cloud version SonarCloud.
When we need our application to connect to a service like a database, we will use Docker a virtualization program, based on containers, that is much more lightweight than standard virtual machines. Docker will allow us to configure the needed services in advance, once and for all, so that the services running in the containers will take part in the reproducibility of the whole build infrastructure. The same configuration of the services will be used in our development environment, during build automation, and in the CI server.
Most of the chapters have a "tutorial" nature. Besides a few general explanations of the main concepts, the chapters will show lots of code. It should be straightforward to follow the chapters and write the code to reproduce the examples. All the sources of the examples are available on GitHub.
The main goal of the book is to give the basic concepts of the techniques and tools for testing, build automation, and continuous integration. Of course, the descriptions of these concepts you find in this book are far from being exhaustive. However, you should get enough information to get started with all the presented techniques and tools.
About the Author
Lorenzo Bettini is an Associate Professor in Computer Science at the Dipartimento di Statistica, Informatica, Applicazioni "Giuseppe Parenti", Università di Firenze, Italy. Previously, he was a researcher in Computer Science at Dipartimento di Informatica, Università di Torino, Italy.
He has a Masters Degree summa cum laude in Computer Science (Università di Firenze) and a PhD in "Logics and Theoretical Computer Science" (Università di Siena).
His research interests cover design, theory, and the implementation of statically typed programming languages and Domain Specific Languages.
He is the project lead of the Eclipse projects EMF Parsley, https://www.eclipse.org/emf-parsley/, and Xsemantics, https://projects.eclipse.org/projects/modeling.xsemantics. He is also a committer of the Eclipse projects Xtext, https://www.eclipse.org/Xtext/, and SWTBot, https://www.eclipse.org/swtbot/.
He is the author of the two editions of the book "Implementing Domain-Specific Languages with Xtext and Xtend", published by Packt Publishing (2013 and 2016).
He is also the author of about 90 research papers published in international conferences and international journals.