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("https://reqres.in/api/users?page=2");
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 http://www.slf4j.org/codes.html#Stati... 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 Framework devel...
Playwright with Java script [2024 latest] - End to end - By SDET Adda for QA Automation:
• Playwright with Java script [2024 lat...
TestNG + Selenium 4 Tutorial -2024 Updated 🔥🔥🔥
• TestNG + Selenium 4 Tutorial -2025 Up...
Linux and Bash Scripting Tutorial [2024 Updated]
• Linux and Bash Scripting Tutorial [20...
VirtualBox and Virtual Machine setup for Selenium Automation: • VirtualBox and Virtual Machine setup ...
Selenium Grid Tutorial For Beginners [2024 latest] - End to end - By SDET Adda for QA Automation: • Selenium Grid Tutorial For Beginners ...
Git & GitHub Tutorial for Beginners [2024 Updated]: • Git & GitHub Tutorial for Beginners [...
Apache Maven Tutorial for Beginners | SDET ADDA: • Apache Maven Tutorial for Beginners |...
Jenkins 2024 Tutorial For Beginners | DevOps CI/CD | SDET ADDA: • Jenkins 2024 Tutorial For Beginners |...
Karate Framework Tutorial:
• Karate Framework Tutorial
Top 100 Java Programs for Programming/coding and QA interviews
• Top 100 Java programs for programming...
Facebook group: https://www.facebook.com/share/F7Dewp...
Telegram channels:
https://t.me/sdetadda
https://t.me/+71BQkERkJJJiM2Q1
Watch video How to fix "Exception in thread "main" java.lang.NoSuchFieldError: port" in TestNG| BDD| RestAssured online without registration, duration hours minute second in high quality. This video was added by user SDET Adda For QA Automation 23 July 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,648 once and liked it 46 people.