logo logo

TestProject OpenSDK with Cucumber, TestNG and ExtentReport

TestProject OpenSDK with Cucumber, TestNG and ExtentReport

In this post, we will discuss working with all new TestProject OpenSDK to write native Selenium code of an existing code which is powered by the following:


The native Selenium code which we will be using in this post is available in GitHub.

Native Selenium Code

The native Selenium code that we have as mentioned before is written in BDD format using Cucumber and running the test via the test runner of TestNG. The structure of the code looks pretty much like a regular test code, as below:

Native Selenium Code Structure

The code also uses Selenium Page Object Model, TestNG Listeners, and generates reports via Extent reporting. Well, this whole code uses Native Selenium Webdriver to perform UI testing and in fact, with this “usual” approach, we have the following things to be taken care of as a tester 🤯:

  • Maintain ChromeDriver/Gheckodriver/EdgeDriver, etc with latest versions.
  • Write your own code for reporting (like extent reporting in this case).
  • Maintain browser drivers in CI/CD deployment machines.

Using TestProject’s OpenSDK

Using TestProject‘s OpenSDK, now things are much simpler and it addresses the above pain points along with a lot of fascinating features! ✨

  • Automatic test reports in HTML/PDF format (including screenshots).
  • Collaborative reporting dashboards with execution history and RESTful API support.
  • Always up-to-date with the latest and stable Selenium driver version.
  • A simplified, familiar syntax for both web and mobile applications.
  • Complete test runner capabilities for both local and remote executions, anywhere.
  • Cross-platform support for Mac, Windows, Linux and Docker.
  • Ability to store and execute tests locally on any source control tool, such as Git.

Migrating Native code to TestProject OpenSDK

The first and foremost operation before beginning with our code migration is to get the OpenSDK itself. Since this is a Java Maven project, the reference we are going to set in the POM.xml file is going to look something like this:


Next, the only code change we need to make in our native selenium code to use TestProject’s OpenSDK is this:

Native code

//Chrome driver - Using Native Selenium WebDriver
System.setProperty("webdriver.chrome.driver", "/Users/ChromeDriver/chromedriver");
WebDriver driver = new ChromeDriver();

TestProject OpenSDK

WebDriver driver = new DriverBuilder<ChromeDriver>(new ChromeOptions())
        // Get Project Name from environment variable - CI/CD
        // Get Job Name as Release Name from environment variable - CI/CD
        // Get TestProject Auth Token from environment variable - CI/CD

As you can see from the above code, the DriverBuilder sets the following parameters to invoke TestProject agent running in the target machine:

  • Project Name – Which can be any name, but since TestProject’s OpenSDK is going to automatically create the reports, it’s better to set a unique name as the project name. In this case, we are using CI/CD environment variables to set the project name.
  • Job Name – Which can be any name as well, but we are setting the release number as job name from CI/CD environment variable.
  • Token – This is a super-secret token to authenticate our TestProject agent with the TestProject platform and MUST need to come from CI/CD environment variable.

With this, we can now run our test and get the automatic test report generated in the TestProject Platform as shown below

Here is the complete migrated project with TestProject’s OpenSDK in GitHub.

This entire tutorial is also available in a video tutorial format for you to enjoy 😉👇

Users interested to try TestProject’s new OpenSDK can follow these steps to get started:

  1. Create a free TestProject account
  2. Download and install the TestProject agent
  3. Install the SDK from your favorite package manager:
    1. Java – Maven
    2. C# – NuGet
    3. Python – PyPI
  4. Explore our SDK documentation to understand available functions:
  5. Create your automated tests! 🤩

Go ahead and share your feedback in the comments below – Have you tried TestProject’s OpenSDK yet? 

About the author

Karthik KK

I am Karthik K.K. I do consulting, blogging, and researching on various tools and technologies which inspire my interest. I have been into Software Automation Testing for over 14 years now and my interest in learning new stuff which enables automation has never been compromised.

Due to my passion in automation testing I got fully exposed to tools and languages like

Desktop & Web : QTP, Selenium, Specflow, VS Coded UI, Ranorex ,Test Complete and Cucumber
Mobile : Appium, Robotium,Calabash, Espresso, Selendroid
Languages : C#, Java, Ruby, Powershell, Javascript, VBScript
Cloud Tools : Azure, Dockers
Misc Tools: Mockito, Rest-assured, Bound-Box,FluentAutomation
Interested in: MVC, Entity framework, LINQ, Fakes, Distributed deployment, SAAS

Follow on YouTube – https://youtube.com/executeautomation
Follow on Twitter – https://twitter.com/executeauto
Follow on linkedIn – https://www.linkedin.com/company/executeautomation/
Follow on Facebook – https://www.facebook.com/executeautomation/



5 3 comments
  • sailaja banu April 13, 2021, 3:53 am

    Hi Karthik,

    Thanks much for this detailed article and video on setting up opensdk cucumber java automation framework. It worked like a champ. One thing where am stuck is the extent report doesnt show the failure as “fail” where as cucumber report and testproject report reports the failure correctly. Is there any correction needed in the code (am using the same code u shared in Github)

  • sailaja banu April 13, 2021, 4:00 am

    One more thing, i was using legacy testproject java sdk for my web automation and there was a requirement to capture the chrome browser console logs and network logs. This was not possible with the legacy sdk as there is no way to define capabilities. But when i checked with testproject guys they asked to try opensdk and i did with KarthikK’s blog and code.
    Thought of sharing that piece of code which i included

    Hook file was modified with :

    public void InitializeTest(Scenario scenario) {

    ChromeOptions options = new ChromeOptions();
    // DesiredCapabilities caps = DesiredCapabilities.chrome();
    LoggingPreferences logPrefs = new LoggingPreferences();
    logPrefs.enable(BROWSER, Level.ALL);
    logPrefs.enable(PERFORMANCE, Level.ALL);
    options.setCapability(“goog:loggingPrefs”, logPrefs);
    base.scenarioDef = base.features.createNode(scenario.getName());

    System.out.println(“Opening the browser : Chrome”);

    base.Driver = new DriverBuilder(options)

    base.Driver.manage().timeouts().implicitlyWait(15000, TimeUnit.MILLISECONDS);

    public void TearDownTest(Scenario scenario) {
    if (scenario.isFailed()) {
    for (LogEntry entry : base.Driver.manage().logs().get(LogType.BROWSER)) {
    for (LogEntry entry : base.Driver.manage().logs().get(LogType.PERFORMANCE)) {
    //Take screenshot logic goes here
    System.out.println(“Closing the browser : MOCK”);


    Both network and browser logs are captured when there is a failure and it is shown in testproject report and IDE as well.
    Hope this might be useful for someone like me 🙂
    Thanks TestProject team and Karthikk for continous support and contribution

  • vijay Kambham March 18, 2022, 7:25 pm

    Hi Karthik, Thank you such a nice blog. Did you try this on Serenity Cucumber. What configuration changes needed on the Serenity.Properties file?

Leave a Reply