1) Are Selenium and TestNG the same?
TestNG is a framework that will help you organize your tests ex: prioritizing, retrying, reporting, etc. Selenium cannot do this.
Selenium gives you a WebDriver API through which you can identify and act on certain elements on your Web application. It cannot generate reports or tabulate and organize results, retry a test case, etc. So it has to use a framework and TestNG comes into the picture.
2)If they are different than how?
May be clear as defined above.
3)What are Selenium, Webdriver, and TestNG, and why are they used? I don't understand the difference between these tools
WebDriver is a web automation framework that uses Junit.
TestNG is an automation testing framework and uses annotations such as @BeforeTest, @AfterTest which makes it more comprehensible.
WebDriver does not have a native mechanism for generating reports.
Test Reports can be generated using TestNG
in WebDriver For running the failed test cases, we need to run the whole script again.
Failed test cases can be run separately using TestNG.