MAVEN and TestNG-1

Maven is a java build and management tool. Maven helps us to create java projects too easily. Gradle and Ant are other tools which are java build and management tools in the market, but maven is the most popular tool. We can create our java project or test project with maven easily.

TestNG is a test tool for testers. TestNG is newer and more powerful than JUnit.It contains extra annotation and we can use TestNG for “priority” ,parallel testing,Data Driven Testing with excel and data provider also it contains HTML or XML reports. TestNG has @AfterMethod,@BeforeMethod instead of @After and @Before.Also we can use soft assertion in TestNG. Soft Assertion means when a code failed on the test case, it can continue.İf we use hard assertion (that means normally assertion) when a code failed all tests stop.

In the pom.xml we use WebdriverManager,Selenium Java and TestNG dependenciesLet’s get started creating a maven project on Intellij İDE.

Step-1: Open Intellij IDE — -File — -NewProjet — -Maven

You should choose maven and click on the next button.

Step-2:Choose a name to your project and click on finish button

Step-3: Your project file structure should be like that. On this project we have a utilities package. We will create a java file under the utilities package and we will write code which is used in every test case, for example open browser and close browser etc.

Step-4: We created java files under tests package and utilities package. After that we inherited the TestBase class.

Step-5:We are creating our test project. In this project we want to go to web page and choose option from dropdown menu and write all options on the console

Step-6: This is project screenshot

You can got all code from github repository



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store