Buildbot is a continuous integration tool which is developed using Python. What is so unique about BuildBot CI when we already have Jenkins? In BuildBot, you can create and schedule tasks using Python code instead of setting up in UI. When you setup the tasks in code, you can extend and customize the CI features based on your project needs. As a leading QA company, we use a multitude of CI tools as per clients’ need. However, BuildBot CI has given us a whole new experience while exploring.
In this blog article, you will learn how to install BuildBot on Windows 10 and running Selenium Scripts successfully, Let’s start with installation.
Note: All the steps which are mentioned in this blog article are only applicable for Windows.
Create Virtual Environment
Open command prompt, go to any folder, and type the below command. Note: bbot is the virtual environment name. Once the environment is created, you can find ‘bbot’ folder.
python -m venv bbot
Activate Virtual Environment
Step 1: Open command prompt and go to the virtual environment folder. Ignore this step, if you are already inside the virtual environment folder.
Step 2: Go to ‘scripts’ folder which is available in bbot folder.
Step 3: Run activate command.
Twisted Binary Installation
Step 1: Download Twisted?20.3.0?cp38?cp38?win_amd64.whl
Step 2: Install the binary
pip install Twisted?20.3.0?cp38?cp38?win_amd64.whl
Install BuildBot CI
pip install buildbot[bundle] pip install buildbot-www
Create & Start Master
Step 1: Open command prompt and activate bbot environment which we created in step #1
Step 2: Create a folder where you want to setup master and its workers.
Step 3: Create master using the below command. You can find
buildbot create-master master
Step 4: Start master
buildbot start master
Step 5: Launch the following URL – http://localhost:8010/ and check if you can see the below page after starting the master.
Creating Master Configuration File
Open Python project in PyCharm IDE where the master is setup. Inside the master folder, you can find ‘master.cfg.sample’ file. Copy & paste the file in master folder. Rename the file as ‘master.cfg’.
Updating Configuration File
Now it is time to update build details in BuildBot Master configuration file. We have already created automated test scripts to configure in master.cfg. In the following sample Git repo, you can find a BDD feature and the required step definition. To run the feature file in the buildbot CI worker, you need to update the git repo URL in master.cfg. Please follow the below steps to update the Git URL and execution commands.
Step 1: Open the master.cfg
Step 2: Go to line number 34 and update the Git URL (git://github.com/codoid-repos/sample-selenium.git)
Step 3: Go to line number 61 and update the Git URL (git://github.com/codoid-repos/sample-selenium.git)
Step 4: Go to line number 63 & 64 and replace the below snippet.
factory.addStep(steps.ShellCommand(command=["pip","install","-r","requirements.txt"], env={"PYTHONPATH": "."})) factory.addStep(steps.ShellCommand(command=["behave","features"], env={"PYTHONPATH": "."}))
Step 5: Once the config file is updated, then master needs to be restarted. To restart master, you need to kill Python process in Task Manger and run ‘buildbot start master’ command again.
Start Worker
Run the below commands to install and start worker.
pip install buildbot-worker buildbot-worker create-worker worker localhost example-worker pass buildbot-worker start worker
Once the worker is started, you can see the created worker in Workers column as shown below.
Start build
Step 1: Click Builders menu
Step 2: Click runstests build
Step 3: Click Start Build
That’s it.
If the build is successful, you can see Green for all the tasks as shown below.
In Conclusion
We invariably use Jenkins and TeamCity in our test automation projects. However, exploring BuildBot CI gives us a different experience altogether. As a test automation company, we intend to publish more useful technical blog articles to share valuable insights to the software testing community. Even-though BuildBot CI setup is not straight forward. It provides some flexibility to manage & customize builds.
Comments(0)