Brief description of the project.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- JDK (Java Development Kit) installed
- IntelliJ IDEA or any preferred IDE
- Maven or Gradle (optional, if using for build management)
-
Clone the repository to your local machine:
git clone https://github.com/yourusername/your-repository.git
-
Open the project in IntelliJ IDEA.
-
Resolve dependencies using Maven or Gradle.
-
Ensure
config.propertiesexists:- The
config.propertiesfile should be located in thesrc/main/resources/directory. - If it doesn't exist, create a new file named
config.propertiesundersrc/main/resources/and add your configuration properties.
Example
config.properties:key1=value1 key2=value2
- The
-
Verify
PropertiesReader.kt:- Make sure
PropertiesReader.ktcorrectly loadsconfig.properties. - Adjust the file path in
PropertiesReader.ktif necessary to match your project structure.
Example
PropertiesReader.kt:object PropertiesReader { private val properties = Properties() init { val inputStream = PropertiesReader::class.java.classLoader.getResourceAsStream("config.properties") if (inputStream != null) { properties.load(inputStream) } else { throw FileNotFoundException("config.properties file not found") } } fun getProperty(key: String): String { return properties.getProperty(key) } // Add other methods as needed... }
- Make sure
-
TestNG Configuration:
- Ensure your
testng.xmlor annotations correctly specify the test suite and include necessary dependencies.
Example
testng.xml:<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="Test Suite"> <test name="Login Test"> <classes> <class name="com.cmccarthy.kotlin.test.LoginTest"/> </classes> </test> <!-- Include other tests as necessary --> </suite>
- Ensure your
-
Run the tests:
- Execute your TestNG tests from IntelliJ IDEA or from command line using Maven or Gradle.
-
If you encounter
FileNotFoundException: config.properties not found, double-check:- The location of
config.properties. - The file path specified in
PropertiesReader.kt.
- The location of
-
Kill the chrome processes -
taskkill /im chromedriver.exe /f
- Kotlin
- TestNG
- Selenium WebDriver