RE: why we are using junit,ant,testng,maven etc with selenium ? what is the main purpose of using them? can’t we run our tests without using them?
JUnit/NUnit – Are the native test runners for Java & C# namely.
Ant / Maven – Build systems, if we have to efficiently manage the dependencies & later execute the tests on CI.
TestNG- Its an alternative to JUnit, which provides better reporting & Data provider capabilities + enhanced test annotations, better annotations & additional capabilities like- Event listeners etc..
If you look at Forumsqa’s parent site then you can find out loads of useful info on TestNG benefits:
> TestSuites , Suite of suite
> 2 types of Data providers
If you have to run tests without JUnit then you can do it using Cucumber-JVM in Java.
Theoretically you can create your own test methods & hook them using public static void main() & run your tests as runnable Jar file.