TestProject Forum
Powered by leading experts in the test automation community

ImmutableList.toImmutableList() error while running tests - TP OpenSDK Java, Maven,TestNG, POM

Hello TP Community!

I have just started setting up my first project using TestProject OpenSDK for Java, Maven and TestNG. Before I start writing tests, I want to set a strong POM project structure. I’m looking at this example and I like it because it includes architecture for web, Android and iOS tests. However there are so many examples there and I feel confused.

I wanted to start with the POM structure I am familiar to, however when I run the LoginTest in Intellij, I am getting a WebDriver Exception: org.openqa.selenium.WebDriverException: Failed to create an instance of io.testproject.sdk.drivers.web.ChromeDriver.

This error is caused by: java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList().

I’m running tests locally on a Ubuntu 20.04.1. Does anybody know how to solve this? :thinking:

My POM project organization:

  • src
    • main
      • java
        • pageObjects
          • LoginPage (extends Page)
        • pomUtils
          • Page
    • test
      • java
        • authenticationTests
          • LoginTest (extends BaseTest)
        • testUtils
          • BaseTest

My page objects have constructors that inherit Page class constructor. @BeforeMethod annotation in “BaseTest” class is where I instantiate ChromeDriver (using DriverBuilder). Test class “LoginTest” inherits from “BaseTest” and it does not call driver instance directly.

I am getting this error (java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList()) even when I try to run the basic test example from this page.

If it helps, I’ll push my project to GitHub and share a link with anyone who’d like to take a look at it?

Also, is there a way to benefit from the Test Runs on the TP Platform for cross-browser testing when running coded tests? Or should I add a BrowserFactory class and code the cross-browser instructions to enable tests running on multiple browser?

Hello @nevena
For the issue, which version of the SDK you are using?

Also for running cross browsers, you can run the same time but just wrap the driver init in some loop that iterates on all the browsers you want to execute the test on.

1 Like

Hi @ran.tzur,

I am using the latest one, 0.64.0-RELEASE. I managed to resolve the issue yesterday.
It turned out that one of the dependencies being imported along with Java SDK has an outdated version: com.google.guava:guava:25.1-android

I removed it manually and imported the latest version as a dependency through pom.xml file: guava 29.0-jre (not android, but jre). The error is not showing up anymore.

Is it possible to update the guava version that comes with Java SDK, so I can eventually remove the guava dependency from my pom.xml? Or maybe this can be solved in another way?

Thanks @nevena
We will check.

1 Like

@nevena What is the JDK version you use? Is it OpenJDK or Oracle JDK?

Hi @marat,

I have openjdk version 13 installed on my machine.

Thanks @nevena
Can you please share here your pom.xml?

I’ve successfully reproduced it with Maven on my side.
We will release a fix with the next SDK version.

Thanks for letting us know, meanwhile please use the workaround of manually referencing the latest Guava library version - 29 as you’ve done.

1 Like

That’s great to hear, @marat! Thanks! I am grateful for all the help I received from TestProject Support so far and it makes me happy I could help with this one :slightly_smiling_face: