There was a problem running a TestNG test case. A "NoSuchFieldError" exception arose in the main thread. This suggests that the code is trying to access a field named "port" that doesn't exist in the relevant class. This could be due to a class version mismatch or a typo in the field name.
In this video, I've shown how to resolve the following error encountered during execution of a TestNG class, whether using Selenium WebDriver or Rest Assured.
import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.response.Response;
public class FirstRestAssured {
@Test
public void test1()
{
Response response= RestAssured.get("reqres.in/api/...");
System.out.println(response.statusCode());
System.out.println(response.getTime());
}
}
Console Error:
[RemoteTestNG] detected TestNG version 7.10.2
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See www.slf4j.org/c... for further details.
Exception in thread "main" java.lang.NoSuchFieldError: port
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:69)
Playlists in this channel's are:
******************************************************************************************************
Selenium Cucumber BDD Framework development with Java and TestNG | Latest Features (2023-2024) Series
• Selenium Cucumber BDD ...
Playwright with Java script [2024 latest] - End to end - By SDET Adda for QA Automation:
• Playwright with Java s...
TestNG + Selenium 4 Tutorial -2024 Updated 🔥🔥🔥
• TestNG + Selenium 4 Tu...
Linux and Bash Scripting Tutorial [2024 Updated]
• Linux and Bash Scripti...
VirtualBox and Virtual Machine setup for Selenium Automation: • VirtualBox and Virtual...
Selenium Grid Tutorial For Beginners [2024 latest] - End to end - By SDET Adda for QA Automation: • Selenium Grid Tutorial...
Git & GitHub Tutorial for Beginners [2024 Updated]: • Git & GitHub Tutorial ...
Apache Maven Tutorial for Beginners | SDET ADDA: • Apache Maven Tutorial ...
Jenkins 2024 Tutorial For Beginners | DevOps CI/CD | SDET ADDA: • Jenkins 2024 Tutorial ...
Karate Framework Tutorial:
• Karate Framework Tutorial
Top 100 Java Programs for Programming/coding and QA interviews
• Top 100 Java programs ...
Facebook group: www.facebook.c...
Telegram channels:
t.me/sdetadda
t.me/+71BQkERk...
Негізгі бет How to fix "Exception in thread "main" java.lang.NoSuchFieldError: port" in TestNG| BDD| RestAssured
Пікірлер: 12