GIT & Jmeter
Apache JMeter itself does not have a version control component. However, it is still beneficial to name and version control our test plans. This is the very minimum standard of control.
Since Apache JMeter uses flat files such as the JMX, CSV and JTL files. we can look to utilise version control software such as GIT. By storing our Apache JMeter files in git we can ensure that we keep a history of any changes.
First of all create the file structure and JMX, CSV and JTL files under the specified directories below:-
Example File Structure
Project Directory
Jmeter
Test_Plan
Test.jmx
Test_Data
Test.csv
Test_Results
Test.jtl
Initiate GIT
Based on the above example file structure to create a git instance run the following commands:-
Navigate to directory
cd Project Directory
Configure GIT by setting your name and email.
git config --global user.name "Your Name Comes Here" git config --global user.email you@yourdomain.example.com
Initiate local git repository
git init
Add all current changes to next commit.
git add .
Commit the changes with commit message.
git commit -a -m “Initial Commit”
How to exclude files using .gitignore. In this example we decide that we want to exclude the test data from the GIT repository. To do this we simply create a text file called .gitignore under the project directory. Then inside the file we list the directory/file that we wish to exclude.
—— .gitignore —-
jmeter/test_data/*
Create a Project Branch
So far we have made all of our changes and commits to GIT master.
On occasions where you need to change files within the project but wish to not impact master, you can create a branch. Branches allows you to make a copy of master and then amend this copy before introducing it back to master.
First check out the master branch
git checkout <branch>
Next create a new-branch
git branch <new-branch>
GIT has a plethora of commands to manage how you handle your files. This blog just shows you how you can quickly wrap version control around your test assets.