AutomationTools 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package AutomationTools --version 1.0.5
NuGet\Install-Package AutomationTools -Version 1.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AutomationTools" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AutomationTools --version 1.0.5
#r "nuget: AutomationTools, 1.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AutomationTools as a Cake Addin
#addin nuget:?package=AutomationTools&version=1.0.5

// Install AutomationTools as a Cake Tool
#tool nuget:?package=AutomationTools&version=1.0.5

Alaska ITS QE Automation Tools

The information in this document is to provide an overview of the available functionality within this package. It was designed for Crew Tools API and UI Automation but can easily be applied to any automation portfolio.

<p align="center"> <img src="https://media.giphy.com/media/rVv0fvQuFn3QRZHgC5/giphy.gif"> </p>

What's New?

  1. Here you will find the latest updates.

Key Features

Below are the essential classes of the Framework, commonly used functions from those classes, and a brief explanation of their use cases. Please use these functions when ever possbile. It will save time in test writing.

  1. Automation Logger
    1. AddToLog()
      1. Add a message to the log. This can be any information that needs to be logged. An enum can be passed to make it a warning message or error message, though the two below functions are preferred.
    2. LogWarning()
      1. Log a warning, this should not be used for validation logging.
    3. LogError()
      1. Log an error. This should be used for any condition that would indicate a test/feature failure.
    4. GetPST()
      1. Returns the current time in PST timezone, most applications need PST time, all logs are in PST time.
    5. SetBaseURL()
      1. This is used in the construction of an API controller in order to set the base URL of an API in the logger.
    6. SetDBType()
      1. This is used in the construction of a DB controller in order to set the type of database that's being used.
    7. ConfigureLogger()
      1. This is a required setup function. Pass the name of the Application, the testing type (BVT, Smoke, etc.) and the environment (QA, Test, etc.).
    8. ReconfigureLogger()
      1. This is used when comparing two different APIs. Example: (QA and Production) This is for logging clarity only.
    9. LogTestResult()
      1. This is a required test completion function. Pass the name of the test function, true or false, and the Automation Core Driver object reference where appropriate (UI testing only).
    10. TestConditionsNotMet()
      1. This can be used to show that conditions for a test are not met. This should be used sparingly. An option message can be added to explain.
    11. NoErrorsPresent()
      1. This is an essential function. Most functions should return a boolean using this function.
    12. CatchException()
      1. This is an essential function. Will log any exception including an Inner Exception if one exists. Use with all test executions.
    13. LogDBQuery()
      1. Log a database query. This facilites manual verification.
    14. LogValueMismatch()
      1. This is an essential function. When two objects are not equal, pass the objects(two strings, two ints, a string and an int, etc.) and their sources (DB and API, QA and Production, etc.) and the column name to this for logging. This is a boiler plate function and will work with any object type.
  2. Randomizer Tool
    1. GetRandomDate()
      1. Gets a random date between the base date and today. Default base date is 1/1/2000.
    2. GetRandomFutureDate()
      1. Gets a random date in the future. Optional variables can be supplied to adjust the range.
    3. GetRandomDateInRange()
      1. Returns a random date between two DateTime objects, two strings, or one of each. If a non-datetime string is provided, returns DateTime.MinValue.
    4. GetRandomString()
      1. Creates a pseudo random string. Default length is 10 characters and numbers are inlcuded by default.
    5. GetRandomTime()
    6. GetRandomObjectFromCollection()
    7. GetRandomDoubleAsString()
  3. Automation Element Manager TODO: List functions
  4. Automation Page Manager TODO: List functions
  5. Automation Core Driver TODO: List functions
  6. Automation SQL Tools TODO: List functions
  7. Extensions
    1. IsNullOrEmpty()
      1. This function will return true if a string is empty, a collection is empty, or any object is null.
    2. DateFormat()
      1. This function takes in a string and will return a date string in the supplied format if the string is a valid DateTime string, otherwise, it returns an empty string or the original string.
    3. DatesMatch()
      1. This function has four variants:
        1. Compare two strings
        2. Compare a DateTime object and a string
        3. Compare a string and a DateTime object
        4. Compare two DateTime objects
      2. It will return true if both dates match, time is not checked by default but can be if desired.
    4. StringsMatch()
      1. This function will return true if two strings match. Case is not considered by default but can be if desired.
    5. StringifyDictionary()
      1. This function converts a Dictionary of type <string, string> into a JSON friendly string.
    6. CombineDictionaries()
      1. This combines two Dictionaries into one. This has only been tested with <string, string> dictionaries.
    7. DictionariesMatch()
      1. This returns true if two dictionaries match completely. This has only been tested with <string, string> dictionaries.
    8. CompareBools()
      1. Accepts any combination of booleans, ints, and string and returns true if they match.
  8. Encryption
  9. SQL Model Generator 2. The parameters are the model type and the SQL data reader. 3. Reader options: 1. SQLDataReader 2. DB2DataReader 3. OracleDataReader 4. Example usage:
     connection.Open();
    var reader = command.ExecuteReader();
    
    while (reader.Read())
    {
        getScheduledClassesDbData.Add(ModelGenerator.GenerateModel<ScheduledClassesDetailsDB>(reader));
    }
    
    reader.Close();
    
    1. This removes the need to set each variable within a model.
    2. Example of code being replaced:
     connection.Open();
    var reader = command.ExecuteReader();
    
    while (reader.Read())
    {
        getScheduledClassesDbData.Add(new ScheduledClassesDetailsDB()
        {
            TripIdentifier = reader["TripIdentifier"].ToString().Trim(),
            Code = reader["training_code"].ToString().Trim(),
            StartTime = reader["training_default_starttime"].ToString().Trim(),
            EndTime = reader["training_default_endtime"].ToString().Trim(),
            StartDate = reader["training_startDate"].ToString().Trim(),
            EndDate = reader["training_endDate"].ToString().Trim(),
            Size = reader["training_classsize"].ToString().Trim(),
            Base = reader["training_base"].ToString().Trim(),
            BidPeriod = reader["bid_period"].ToString().Trim(),
            TrainingType = reader["training_code_subtype"].ToString().Trim(),
            Description = reader["training_code_name"].ToString().Trim(),
            Location = reader["training_classloc"].ToString().Trim(),
        });
    }
    
    reader.Close();
    
    1. Note: This requires DB models to have string parameters only.

Tag Categories

  • Quick Links
  • Repo Tags are used to organize test execution. There are shared tags included in this package that should be included in all tests.

In the Visual Studio, tests are organized in a heirarchy. <p>{ApplicationName}.{API}.Tests</p> <p>  {ApplicationName}Tests.{Production, Migration, Smoke, Functional, or BVT}</p> <p>    {ApplicationName}Tests</p> <p>     {FunctionName}</p>

Example:

<p>Cream.API.Tests</p> <p>  CreamTests.BVT</p> <p>    CreamBVTTests</p> <p>     CreamGetPing()</p>

  1. Shared Tags:
public const string All_E2E = "All_E2E";
public const string All_BVT = "All_BVT";
public const string All_Smoke = "All_Smoke";
public const string All_Functional = "All_Functional";
public const string All_Production = "All_Production";
public const string All_Migration = "All_Migration";
public const string All_Regression = "All_Regression";
public const string Internal_Tools = "Internal_Tools";
  1. Project Specfic Example (All projects should have each of these tags for consistency):
namespace Cream.API.Framework.Helpers
{
    public class CreamCategory
    {
        public const string Cream_API_All = "Cream_API_All";
        public const string Cream_API_BVT = "Cream_API_BVT";
        public const string Cream_API_Smoke = "Cream_API_Smoke";
        public const string Cream_API_Functional = "Cream_API_Functional";
        public const string Cream_API_Production = "Cream_API_Production";
        public const string Cream_API_Migration = "Cream_API_Migration";
        public const string Cream_API_Regression = "Cream_API_Regression";
        public const string Cream_API_Internal = "Cream_API_Internal";
    }
}
  1. Usage examples:
/// <summary>
/// BVT Test: Validate 200 status code of GetPing API call.
/// </summary>
[Category(SharedCategory.All_BVT)]
[Category(CreamCategory.Cream_API_All)]
[Category(CreamCategory.Cream_API_BVT)]
[TestCase]
[Retry(2)]
[Repeat(1)]
public void CreamGetPing()
/// <summary>
/// Smoke Test: Validate 200 status code of GetAuthorizations API call.
/// </summary>
[Category(SharedCategory.All_Smoke)]
[Category(CreamCategory.Cream_API_All)]
[Category(CreamCategory.Cream_API_Smoke)]
[TestCase]
[Retry(2)]
[Repeat(1)]
public void GetAuthorizations()
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.7 144 8/17/2023
1.1.6 128 8/10/2023
1.1.5 148 8/4/2023
1.1.4 128 8/4/2023
1.1.3 125 8/3/2023
1.1.2 221 7/20/2023
1.1.1 119 7/20/2023
1.1.0 120 7/20/2023
1.0.9 174 5/27/2023
1.0.8 119 5/26/2023
1.0.7 111 5/26/2023
1.0.6 114 5/26/2023
1.0.5 124 5/26/2023
1.0.4 122 5/26/2023
1.0.3 122 5/26/2023
1.0.1 119 5/25/2023
1.0.0 119 5/25/2023

Requires Appium version 5 in beta NuGet\Install-Package Appium.WebDriver -Version 5.0.0-beta01