Skip to content

ArthurPinhas/services-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Certainly! Here's the updated section integrated into the existing README file:


Services Automation

Overview

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.

Features

  • Automated Checkup: Utilizes the NUnit framework and Selenium to automate the checkup process for container services.

Dependencies

Setup

To run the automated tests, follow these steps:

  1. Clone the repository:

    git clone https://github.com/your-username/services-automation.git
  2. Navigate to the project directory:

    cd services-automation
  3. Create your own appsettings.pageobjects.json file containing the URLs and credentials for your services.

  4. 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
  5. Run the NUnit tests:

    dotnet test

Automation with Cron

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).

Setting up a Cron Job

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:

  1. Open your terminal and run the following command to edit the crontab file:

    crontab -e
  2. 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 script script.sh at 6:45 PM every day and redirect the output to a log file.

  3. Save and exit the crontab file. The cron job is now scheduled, and your script will run automatically at the specified time.

Example Bash Script

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

Contributions are welcome! If you'd like to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/new-feature).
  3. Make your changes and commit them (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature/new-feature).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License.


About

An Automation Test repo to test various services

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages