DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • COM Design Pattern for Automation With Selenium and Cucumber
  • 7 Easy and Effective Tips for Learning a New Programming Language
  • Selenium Test Automation Challenges: Common Pain Points and How to Solve Them
  • Developer Tools That Actually Matter in 2026

Trending

  • Architecting Autonomous Agents: A Deep Dive into Azure AI Foundry Agent Service
  • Security Readiness Checklist: From AI Threats to Software Supply Chain Defense
  • How AI Is Rewriting the Rules of Software Security: Machine-Speed Delivery, Shifting Risk, and New Control Points
  • The "Zombie API" Attack: Why Your Old Integrations Are Your Biggest Security Risk
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Testing, Tools, and Frameworks
  4. Spice Up Your 'CI/CD Process' With Automation Using Cucumber, Selenium, and Kotlin

Spice Up Your 'CI/CD Process' With Automation Using Cucumber, Selenium, and Kotlin

This article shows how to use Cucumber, Selenium, and Kotlin in your CI/CD process in four easy steps.

By 
Ashok Gudise user avatar
Ashok Gudise
·
Sep. 26, 22 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
3.8K Views

Join the DZone community and get the full member experience.

Join For Free

Continuous Integration & Continuous Deployment

Imagine you are working on a two weeks sprint, and your agile teams have different assignments that can only be tested through Integration Tests, which may take numerous builds in shorter periods. I still remember that a Build Engineer yelled at me for asking for three builds within an hour. With the power of CI/CD, 60% of this problem is solved with Rapid releases with just a click of the mouse or build hooks.

Problem Statement

Your PL/SQL Developer has optimized an SQL Query which works like a charm, now, he wanted to tweak the Stored Procedure furthermore, and he wanted a Quality Engineer to do the regression testing.

App Developer has fixed one issue that has something to do with user-login sessions or some complex logic that renders a huge list of items. It worked just fine in his local machine, but he wanted a Quality Engineer to do the regression testing.

Also, the Web Analytics team wanted to add tags and test the trends in a repeated manner, and they wanted a Quality Engineer to do the regression testing.

I hope you got my point now! These teams want to do these changes repeatedly (needless to mention the number of the builds), and they all want to perform regression tests on a Dev or SIT environment. I see this as almost a Six Months Project based on the team's availability and other dependencies.

And...

Adding Browser Automation to your CI/CD is the best complementing solution, but how you do that is something that really matters!

Technical Stack

I choose Cucumber, Gherkin, Kotlin, Selenium, JUnit 5, and Spring Boot framework. And IntelliJ Idea & Selenium IDE (Chrome Browser Add-On), and Chrome Webdriver (if you are running local) or Selenium Grid.

Gherkin + Cucumber

We do not go into detailed discussion about these topics as many blogs are available to explain what they are; I have added a couple of them at the end of this blog. On a high level, Gherkin is a plain English test, a well-known standard representation of Behavior Driven Development (BDD in short form) scripts. Cucumber is a testing tool that supports BDD frameworks to run your test cases written in Java, Ruby, Node, and many other languages. That association is represented as Glue in Cucumber.

You will bridge the ".feature" files written in the Gherkin language and associate them to the steps with the choice of your favorite programming language.

Cucumber + Selenium IDE

Browser Automation is often a tedious process if you do not use the correct tools. In the preliminary step to capture browser elements, if you right-click on your web browser and then select the web component by 'inspect element,' it takes forever to capture these elements in a complex flow. And the quickest possible way to capture these is by using Selenium IDE ( A Chrome Browser Add-On). Add the plugin, click the 'REC'ord button, and navigate to your complete flow. When you are done with the flow, Selenium will provide you with a wide variety of options for every single component that you interact with in your flow (CSS Selector, XPath, Relative XPath, Id and Name, XPath is always my safe bet if you ask me).

Kotlin + Cucumber

As I mentioned in my previous blog post, Kotlin eliminates most of the boilerplate code and gives you many powerful features like Null Safety, Safe Calls, Lazy Properties, Scope Functions, and last but not least, Coroutines.

If you are familiar with writing Cucumber test scripts, we often write these using the Page Object Model. It makes it much easier when using Kotlin to do this.

Now Let's Write Some Code (In Just Four Steps)

1. Write a Cucumber feature file as shown below. (Remember, the Gherkin language is just plain English.)

Write a Cucumber feature file as shown below. (Remember, the Gherkin language is just plain English.)


2. Write a Page Object file with web elements that you have captured with Selenium IDE.


 Write a Page Object file with web elements that you have captured with Selenium IDE.


3. Glue Your "search-my-name.feature" file with "SearchSteps.kt" using "SearchPage.kt" elements.


 Glue Your "search-my-name.feature" file with "SearchSteps.kt" using "SearchPage.kt" elements.


You are All Set!

4. You can do either of these to run this test.

Right click on Test Class and Run As JUnit Class

or

Right Click on the search_my_name.feature and run

or

Run the "mvn clean test" command

You can do either of these to run this test.

5. Now the Bonus Part!

Check project-root/target/cucumber-reports/cucumber.html and open it in any browser.

Check project-root/target/cucumber-reports/cucumber.html

That's all for now, Happy Learning!

Contextual design Google Chrome Integrated development environment Regression testing Ruby (programming language) Cucumber (software) Element Kotlin (programming language) Testing Selenium

Opinions expressed by DZone contributors are their own.

Related

  • COM Design Pattern for Automation With Selenium and Cucumber
  • 7 Easy and Effective Tips for Learning a New Programming Language
  • Selenium Test Automation Challenges: Common Pain Points and How to Solve Them
  • Developer Tools That Actually Matter in 2026

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook