RE: need of main() method in test automation framework

Why is there no need of writing a main() in a test automation framework class ? Be it a TestNG framework or a custom created framework using just java and Selenium Webdriver.


laxmi123 Default Asked on March 31, 2015 in Selenium WebDriver.
Add Comment
1 Answers

Hi Laxmi,

There is always a need to write a main method for a program. Without a main method in java programs interpreter will not know where to start from.

Now coming to your point
– In TestNg frameworks we dont need a main method because TestNG has that main method which loads you test classes.
– In custom frameworks you have to have a main method, you can compile without a main method but you cannot actually run it.

If you look at your custom framework you will find one main method which will load all your test classes. That why you might not need a main in the test classes.


Professor Answered on April 1, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.