Git for Testers – description of Testing Cup workshop
Within TestingCup 2016 more than 350 participants had a good time competing to be the best while... testing the ‘Mr Buggy’ application in version 4.2. During the second day of the event, our testing trio had pleasure to conduct a workshop "Git for testers".
The beginning of the workshop was devoted to the fundamental question „Why to use a version control system in the process of software development?”. Typical answers were as follows:
- Managing code.
- Tracking changes in source code.
- Recalling any previous versions of software.
- Facilitating error tracking.
The main tasks of a tester, that can be facilitated by the version control system, are:
- Testing new versions of software.
- Approving software version, e.g. before it is introduced to the production environment.
- Finding in which version an error occurred.
- Maintaining automated tests or documentation.
- Code review (reviewing documentation or test cases).
- Creating ‘Release notes’ which are short notes for users showing what changes have been introduced to the new version of software.
We discussed the long-standing problem; what to choose – SVN or git? It is difficult to determine the advantages and disadvantages of one system over another, because these are two different approaches to version control.
The main differences are as follows:
- Git is a distributed system, SVN is a centralized one.
- Git manages changes which will be applied to files, SVN manages entire files and directories.
- Approach to work in branches in Git is based only on changes, SVN physically copies everything to a new branch
- Git allows rewriting history, SVN has a consistent history.
Personally, we find speed (due to the fact of change management, and not the entire directories or files structures), and ability to work without access to a central repository (you can create your local history work, then rewrite it by pushing changes to remote repository) to be the main advantage of Git over SVN.
For many people (especially those who have worked with other version control systems) git seems to be difficult and incomprehensible. Working with a distributed repository, as well as the mechanism of handling changes requires change of thinking. During the workshop we wanted to direct the participants’ way of thinking onto other direction and thus befriend them with the tool.
Designing the workshop we chose elements of working with git we use during our daily testing duties. Practical tasks were based on a githug tool and adjusted to our needs. Githug allows to learn to work with the presented tool through an interactive game on the command line.
Other interesting tools, where you can also practice working with git, in an interactive way, are:
The last two visualize the result of operations of commands we have entered. Each command entered in the left-hand side panel, which expands the repository tree, is illustrated. In a very clear and transparent way we are able to see how our commands influence the shape of the repository.
In addition, during the workshop, we were able to answer the most problematic question about working with git that we heard at the beginning from the participants:
What is the difference between git revert, git reset and git checkout commands?
The result of executed command is a new commit, which reverses the changes in the previous state. The history of repository isn’t changed, it is expanded with a new commit.
If you want to get rid of changes that have not been squeezed out of the local repository, just use git reset. In this case, the repository history is changed.
This command allows us to change the work context, switch between single commits and branches. As in the previous case, the history of repository is not changed.
After solving aforementioned questions git as a tool seems to be really simple if you use it with understanding – and we especially encourage you to learn through practice! We hope that our examples and prepared interactive workshop will help you with that.