Examples

Using Git in Software Testing. Definition and Basic Set of Functions

Introduction
For the first time I faced such a phenomenon as a version control system during the process of creating my own website. New ideas appeared all the time during the development process, and each new version I had to hold in different folders on the hard disk that soon led me to utter confusion, especially when I had to come back to the code in 2-3 days. Enormous amount of time was spent on determining which version was the latest (active) and all the related minor, but important issues. This way search for a solution and familiarization with Git began.
A bit of theory before proceeding to the description of the product itself.

A brief official summary about the product
Git is a distributed version control system for files. It was created on the 7 of April, 2005 by Linus Torvalds for Linux cores development.
Version Control System or VCS is a software product that allows to store multiple versions of the same document, if necessary, go back to earlier versions, determine who and when made a particular change, and so on.
Git is a distributed version control system that enables its customers not just to unload the last versions of the files, but to copy the entire repository. Therefore, if the production server dies, any client-side repository can be copied back to the server to recover the database. Every time a customer picks up the latest versions of the files, he creates a complete copy of all the data. Git also allows to work with several remote repositories, so one can work simultaneously in different ways, with different teams within one project. This way one can simultaneously maintain several types of workflows in one project.

Installation and system requirements
Want to tell beforehand that I use Windows, and all the presented below material will be explained in the context of this operating system.

So, the installation:
  1. Go to the official site and click the Download for Windows

  1. Run the downloaded .exe file
  2. Then install Git following the installer prompts
  3. That is all
When Git is installed on the computer one can proceed to work, but before that, it is recommended to customize Git. One should begin from git config – Git utility function allowing to customize the parameters that control all aspects of Git. Run the Git Bash and start with entering your name and e-mail address.
$ git config –global user.name “Your Name”
$ git config –global user.email yourname@example.com

The function word “global” means that this setting is global, and Git will use these data for everything that you do in the system. If you want to specify other name or email for certain projects, you can run this command without global option in the catalog with the desired project.

The workflow is the following
Now let’s review all the basic commands needed for solving the vast majority of problems encountered when working with Git.
To start working with a repository on your PC you need to acquire it. There are two ways of doing that: to import an existing project in Git or to clone an existing project from a server.
We will work with an existing one. Open a folder with a project and click the right mouse button in its free area, then click the “Git Bash Here” section which opens the console. Here enter:

$ git init
This command creates a new subdirectory named .git in the existing directory. The new subdirectory contains all the needed repository files (the folder containing the directory is hidden).
To add files from a directory under version control they need to be indexed by running the command

$ git add
To simplify the explanation let’s do as follows: suppose you opened the folder and initialized it as a git repository by running $ git init. As long as the folder is empty, and the files are not indexed, the directory is considered empty. Now let’s create an empty text document “test.txt” in this folder; to make Git track the file, the file must be indexed. First of all, prompt for the status (probably this command runs more frequently than any other)

$ git status
The following answer will be received:
Initial commit
Untracked files:
(use “git add <file>…” to include in what will be committed)
test.txt
nothing added to commit but untracked files present (use “git add” to track)

That is how we execute what we discussed

$ git add
(if it is necessary to track a certain file – $ git add test)
Dot at the end of the command means that we want to keep track of all the files in the repository, and we will request the status, the response will be:
new file:   test.txt
Now test.txt is indexed, let’s make changes and add any text in it (E.g. Hello!) and request the status again. Git will inform that the file was modified:
modified:   test.txt
It’s time to add the first commit

Summary

Simple, convenient, easy-to-study tool. Software testing company can use Git for verifying quality at the each stage of the development process.

No related posts.

Discussion

No comments for “Using Git in Software Testing. Definition and Basic Set of Functions”

Post a comment