Hello I am working on Automating a test using selenium webdriver & I am getting below issue when I try to implement the interface ITestListener.
When I implemented the methods using the RightClick -> Source-> Override/implement methods,
the methods are created automatically but without the annotation "@Override" indication. Also, each method has below error "method references to interface default methods are allowed only at source level 1.8 or above" (please see below image). When I try to add the @OverrideMethod annotation manually, it gives other error "The method onTestStart(ITestResult) of type Listeners must override a superclass method", asking to remove the annotation. Strangely this worked for other projects in the past & no configuration change has been since then. I tried to match everything with that working project and everything looks same.
I am not sure, what did I miss here. Can you please help me to resolve this issue ? Also, please note that, the listener tags are also added in testng xml.
<listeners>
<listener class-name="trouble.Listeners" />
</listeners>
CodePudding user response:
Your project execution environment is SE 1.5 now. You need to choose 1.8 or higher Right click on Java System library on your project folder ->Choose properties .Click on execution environment and select a version 1.8 or above and choose apply and close.