Day 12: Start automating - Selenium Java Maven with TestNG Project
Shree Krishna Priya J
Mom | When I am away AI and automation work for me | Accessibility tester/enabler | Created Test Case Generator | Entwinning AI and Automation at FEFundinfo | ISTQB AI Testing Certified |
To set up a Maven Selenium TestNG project in IntelliJ, you'll need to follow these steps:
Step 1: Install Maven
To add the Maven bin directory to your system's PATH variable, follow these steps:
export PATH="/usr/share/maven/bin:$PATH"
By adding the Maven bin directory to your system's PATH variable, you can run Maven commands from any directory in the command prompt or terminal without specifying the full path to the Maven executable.
Step 2: Create a Maven Project
Step 3: Configure Selenium and TestNG Dependencies:
领英推荐
<dependencies>
??<dependency>
????<groupId>org.seleniumhq.selenium</groupId>
????<artifactId>selenium-java</artifactId>
????<version>VERSION_NUMBER</version>
??</dependency>
??<dependency>
????<groupId>org.testng</groupId>
????<artifactId>testng</artifactId>
????<version>VERSION_NUMBER</version>
??</dependency>
</dependencies>
https://mvnrepository.com/ - search for required dependencies and add it to your pom.xml
Open the pom.xml file located in the root of your Maven project.Replace VERSION_NUMBER with the latest version of Selenium WebDriver and TestNG (e.g., 4.1.0 for Selenium and 7.4.0 for TestNG).
Step 4: Write Selenium TestNG Test
Step 5: Run TestNG Test
That's it! You've successfully set up a Maven Selenium TestNG project in IntelliJ. You can continue writing your Selenium tests using TestNG annotations and execute them using IntelliJ's TestNG integration.