Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cmccarthyirl/kotlin-testng-selenium
This project executes Kotlin tests sequentially or in parallel using TestNG, to provide a basic test harness.
https://github.com/cmccarthyirl/kotlin-testng-selenium
chrome firefox kotlin retry selenium testing testng
Last synced: 2 days ago
JSON representation
This project executes Kotlin tests sequentially or in parallel using TestNG, to provide a basic test harness.
- Host: GitHub
- URL: https://github.com/cmccarthyirl/kotlin-testng-selenium
- Owner: cmccarthyIrl
- Created: 2024-06-15T08:19:51.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-16T04:35:02.000Z (7 months ago)
- Last Synced: 2024-06-16T14:33:05.944Z (7 months ago)
- Topics: chrome, firefox, kotlin, retry, selenium, testing, testng
- Language: Kotlin
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Kotlin TestNG Selenium - Demo
## Description
Brief description of the project.
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
### Prerequisites
- JDK (Java Development Kit) installed
- IntelliJ IDEA or any preferred IDE
- Maven or Gradle (optional, if using for build management)### Installing
1. Clone the repository to your local machine:
```bash
git clone https://github.com/yourusername/your-repository.git
```2. Open the project in IntelliJ IDEA.
3. Resolve dependencies using Maven or Gradle.
### Configuration
1. **Ensure `config.properties` exists:**
- The `config.properties` file should be located in the `src/main/resources/` directory.
- If it doesn't exist, create a new file named `config.properties` under `src/main/resources/` and add your configuration properties.Example `config.properties`:
```properties
key1=value1
key2=value2
```2. **Verify `PropertiesReader.kt`:**
- Make sure `PropertiesReader.kt` correctly loads `config.properties`.
- Adjust the file path in `PropertiesReader.kt` if necessary to match your project structure.Example `PropertiesReader.kt`:
```kotlin
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...
}
```### Running Tests
1. **TestNG Configuration:**
- Ensure your `testng.xml` or annotations correctly specify the test suite and include necessary dependencies.
Example `testng.xml`:
```xml
```2. **Run the tests:**
- Execute your TestNG tests from IntelliJ IDEA or from command line using Maven or Gradle.
### Troubleshooting
- If you encounter `FileNotFoundException: config.properties not found`, double-check:
- The location of `config.properties`.
- The file path specified in `PropertiesReader.kt`.- Kill the chrome processes
- `taskkill /im chromedriver.exe /f`
## Built With- Kotlin
- TestNG
- Selenium WebDriver---