How to fix: Error message in TestNG java.lang.AbstractMethodError: org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z - maven

How to solve the following error message
java.lang.AbstractMethodError:
org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z in
automation project with Java, Selenium Server (having the
configuration : client-combined-3.7.1-sources, client-combined-3.7.1,
commo ns-lang-2.6, org.eclipse.jgit_4.5.0.201609210915-r,
selenium-firefox-driver-3.0.0-beta1, selenium-server-standalone-3.7.1
firefox v. 44)
I have tried many combinations of selenium server & selenium Firefox driver but I was receiving other errors
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.7.1</version>
</dependency>
</dependencies>
Only these lines of code I am using:
System.setProperty("webdriver.gecko.driver", "C:\\Users\\Aila\\Downloads\\geckodriver-v0.19.1-win32\\geck‌​odriver.exe");
driver = new FirefoxDriver();

There are two solution for this isssue:
Adding correct version in Selenium project coz different version don't have same solution for my issue selenium-server-standalone-2.42.2.jar is correct.
This one is optional just try, if any of solution of this issue is not resolve.
Open Windows Command Prompt and type the command below:
java -Dwebdriver.gecko.driver="C:\NewAutomationCICD\resource\chromedriver.exe" -jar C:\NewAutomationCICD\libs\selenium-server-standalone-2.42.2.jar

The error says it all:
java.lang.AbstractMethodError: org.openqa.selenium.MutableCapabilities.is(Ljava/lang/String;)Z in automation project with Java, Selenium Server (having the configuration : client-combined-3.7.1-sources, client-combined-3.7.1, commo ns-lang-2.6, org.eclipse.jgit_4.5.0.201609210915-r, selenium-firefox-driver-3.0.0-beta1, selenium-server-standalone-3.7.1
First of all ensure that you are using all the binaries and jars of latest version (Selenium, GeckoDriver, Firefox Browser).
If you want to use Maven :
Remove all the Selenium related jars which you have added manually from your project.
Use Selenium and TestNG related jars only through Maven Dependencies.
Clean the Project
Execute mvn clean install test
If you want to use Selenium and TestNG without Maven:
Remove all the Selenium related jars once and add only the selenium-server-standalone-3.7.1 within your project.
Clean the Project
Execute your #Test as TestNG Test or TestNG Suite

Related

Issue running Kogito DMN TrafficViolationTest in my junit

I imported dmn-quarkus-example project into eclipse. the project compiles and shows no errors. when I run mvn clean quarkus:dev, I was able to test the rest endpoint through postman and it works.
but my junit in my eclipse fails with 404.
I read few blogs and updated my application.properties file with the following, still no luck
quarkus.http.port=9090
%dev.quarkus.http.port=9191
quarkus.http.test-port=8181
the other thing I had to do to get my junit working is added the following dependencies in the pom.xml
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
it working still not able to understand why?
it started working after
mvn clean install and tried maven update on eclipse.....
it random....
This sounds like Eclipse is not configured properly, in general; based on the provided information not possible to even say if it's something related to Quarkus, or just a general Eclipse configuration issue.
Moreover, tested locally with Eclipse 2019-12 and no special configuration and no special plugin, running the JUnit test works out of the box correctly, in the example screenshot below running the unit test of the REST interface for Kogito on Quarkus example:
Please ensure you have no Maven exclusion in your Eclipse configuration, and that Eclipse is allowing to run the necessary Maven phases with M2Eclipse (like running any Maven project with Eclipse)

Springboot test with coverage in Intellij

I have a spring boot 2 project with maven pom in Intellij
I thought maven uses different internal coverage tools compared to jacoco or something similar
If I click on - Run All Feature in Test with coverage
I get
Error: Could not find or load main class cucumber.api.cli.Main
If I add cucumber dependency (I dont have cucumber based tests or want it)
Exception in thread "main" cucumber.runtime.CucumberException:
No backends were found. Please make sure you have a
backend module on your CLASSPATH.
I just want to run simple spring boot rest based tests with coverage
What setup do I need?
Edit:
I had
Caused by: java.lang.ClassNotFoundException: org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter
I needed this in the pom
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.2</version>
</dependency>
and needed cucumber for java plugin installed
Now everything runs, no errors
BUT no code coverage, it is blank
It's a known issue that JUnit is not suggested from contex menu of project root: https://youtrack.jetbrains.com/issue/IDEA-198762
It appears you have the Cucumber integration installed in IDEA. This adds the option to run all feature files in the root of your project. If you want to run JUnit tests you have to drill down to src/main/test/java and select "Run All Tests".

why cucumber test results don't display examples name or steps?

I've ran into some unexpected results running a project with cucumber 2.0+. I discovered when running my tests as Junit, the immediate output doesn't display the "Examples" names or steps, instead it repeats the "Scenario outline" name for each line of "Examples" table. As practice I tried running the demo project for Screenplay pattern "TODOMVC" from https://github.com/serenity-bdd/screenplay-pattern-todomvc, using the following dependencies for cucumber
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
I've tried executing the runner with (CucumberWithSerenity.class) as well as (Cucumber.class)
And this is how the JUNIT looks in my Ecplise.
Junit report in eclipse
Executing the runner using the old info.cukes dependencies (1.2.5) produce result with example names and steps as expected.
Just wondering if anyone else has ran into this issue, or if I'm missing something?
It looks like its intended behavior in the new cucumber version. Sort of a quick-fix solution is to add junit = "--step-notifications" in the cucumberoptions, which will display the steps, but still no luck with showing the example names.
In that case, you have add the below line of code
stepNotifications=true in your TestRunner file

what property to configure in serenity.properties file to Run chrome driver in maven project?

I am using selenium with serenity framework with maven.
Earlier i had placed my chrome driver in resources/Drivers and configured
webdriver.chrome.driver = .\resources\Drivers\chromedriver.exe.
It worked fine for me.
Now i have configured chrome dependency in pom.xml as below:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.36.0</version>
</dependency>
Now this dependency will be in .m2 repository.
I am not getting what should i configure "webdriver.chrome.driver" in serenity.properties.
If i remove this property and run my project i get:java.lang.NoClassDefFoundError: org/openqa/selenium/ContextAware
Put this in your property file webdriver.driver = chrome.
And you only have to declare your driver as following, serenity will initial it for you:
#Managed
WebDriver webdriver;

What is the dependency to be used in maven project using new version of Selenium 3.5

What is the dependency to be used in the pom.xml file related to maven project using new version of Selenium 3.5 that are launched in 10/08/2017?
Maven hasn't updated it's repo with this version of selenium webdriver. (I am assuming you are looking for jar from package org.seleniumhq.selenium ). It will be shorltly updated.
Or you can use this selenium from org.jbehave.web
<!-- https://mvnrepository.com/artifact/org.jbehave.web/jbehave-web-selenium -->
<dependency>
<groupId>org.jbehave.web</groupId>
<artifactId>jbehave-web-selenium</artifactId>
<version>3.5</version>
</dependency>

Resources