Certainly! Here's the updated section integrated into the existing README file:
The Services Automation project aims to automate the checkup and certain validations or functions of services using the NUnit framework along with Selenium. Each flow of test will be tailored for different services based on their specific requirements.
As an initial stage, this project automates an NUnit test that connects to a Portainer account and checks if the containers are up.
- Automated Checkup: Utilizes the NUnit framework and Selenium to automate the checkup process for container services.
- NUnit: A unit-testing framework for all .NET languages.
- Selenium WebDriver: A tool used for automating web applications for testing purposes.
- WebDriverManager: A .NET library for managing WebDriver binaries automatically.
- WebDriverManager Chrome Driver: WebDriverManager configuration for ChromeDriver.
- Selenium Support: Support classes and methods for Selenium WebDriver.
- Selenium Extras WaitHelpers: Additional wait helpers for Selenium WebDriver.
To run the automated tests, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/services-automation.git
-
Navigate to the project directory:
cd services-automation
-
Create your own
appsettings.pageobjects.json
file containing the URLs and credentials for your services. -
Install the necessary dependencies (ensure you have NUnit, Selenium WebDriver, WebDriverManager, Selenium Support, and Selenium Extras WaitHelpers installed):
# Replace with your package manager command dotnet add package NUnit dotnet add package Selenium.WebDriver dotnet add package WebDriverManager dotnet add package Selenium.Support dotnet add package SeleniumExtras.WaitHelpers
-
Run the NUnit tests:
dotnet test
To automate the runtime of the automation and schedule it to run at specific times, you can use cron jobs on Unix-like systems (including macOS and Linux).
A cron job allows you to schedule tasks to run periodically at specified times. You can add a cron job to execute your automation script at specific intervals. Here's an example of how to set up a cron job:
-
Open your terminal and run the following command to edit the crontab file:
crontab -e
-
Add a new line to the crontab file to specify when and how often the script should run. For example, to run the script every day at 6:45 PM, you can add the following line:
45 18 * * * /path/to/your/script.sh >> /path/to/log/file.log 2>&1
Replace
/path/to/your/script.sh
with the path to your bash script and/path/to/log/file.log
with the path to your log file. This line tells cron to execute the scriptscript.sh
at 6:45 PM every day and redirect the output to a log file. -
Save and exit the crontab file. The cron job is now scheduled, and your script will run automatically at the specified time.
Below is an example of a simple bash script that can be used with a cron job to automate the runtime of your automation:
#!/bin/bash
# Navigate to the project directory
cd /path/to/your/project/directory
# Run the automation script
dotnet test
Replace /path/to/your/project/directory
with the path to your project directory. This script navigates to the project directory and executes the automation script using the dotnet test
command.
By combining a cron job with a bash script, you can automate the execution of your automation script at specific intervals.
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/new-feature
). - Make your changes and commit them (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/new-feature
). - Create a new Pull Request.
This project is licensed under the MIT License.