Robot Project Initiator
An npm CLI tool for initializing RobotFramework-based automation test projects swiftly and efficiently.
Installation
``
bash
npm i -g initiate-test
`
---
Quick Start
`
bash
initiate-test
`
- Replace with your preferred name.
- Replace with one of the following choices: [app, web, api]
---
Advanced Setup
`
bash
initiate-test
`
Answer a few questions:
- Project name
- Project type (app, web, or api)
- Author name
- Environments (e.g., env1 env2, env3, separated by spaces)
- Credentials needed? (yes/no)
---
Creating Test Suites
Post-initiation, generate multiple suite files within the tests directory effortlessly. Execute one of these commands:
`
bash
initiate-test --suite 01_users_test --suite 02_productions_test --suite 03_collections_test
`
or
`
bash
initiate-test --suite "01_users_test 02_productions_test 03_collections_test"
`
- -s
serves as a shorthand for --suite
.
The command generates suite files in the tests directory, each initialized with template content. README.md is updated to include these suites and their respective tags.
---
Automated Testing Plan Importer
Seamlessly import a testing plan, converting it into suites and test cases within each suite:
`
bash
initiate-test --plan path/of/plan/file.xlsx
`
- -p
is a shorthand for --plan
.
- Supported file formats: xlsx, csv, tsv.
$3
| ID | TEST CASE | SUITE |
| ----- | ------------------------------------------ | -------------- |
| TC-01 | Login With Invalid Username Should Fail | Invalid Login |
| TC-02 | Signup Without Username Should Fail | Invalid Signup |
| TC-03 | Login With Valid Credintial Should Success | Valid Login |
- Notice that header of table should be UPPERCASE.
- Suite values could be path like "./tests/login/invalid login". The path and file will be created togather.
---
Updating the README File
To incorporate new suites, tags, and additional elements manually, utilize the command initiate-test -u
or initiate-test --update`. This command efficiently updates the README, seamlessly adding all recently included directories, suites, and tags. It also integrates essential information such as author details, email, repository, and project name, ensuring a comprehensive update to the documentation.
---
Built Common Keywords
This section includes various keyword sets categorized by project type: API, App, and Web. Each set contains keywords performing specific actions or validations tailored for respective project types.
$3
The API project keywords cover a range of functionalities from making HTTP requests with various configurations to validating responses and text patterns.
| Keyword Name | Description |
| -------------------------------------- | -------------------------------------------------------------- |
| Create Headers | Creates headers for requests |
| Delete With Body | Performs a DELETE request with a body |
| Delete With Body And Invalid Token | Performs a DELETE request with a body and an invalid token |
| Delete With Body And No Headers | Performs a DELETE request with a body and no headers |
| Delete With Params | Performs a DELETE request with parameters |
| Delete With Params And Invalid Token | Performs a DELETE request with parameters and an invalid token |
| Delete With Params And No Headers | Performs a DELETE request with parameters and no headers |
| Delete Without Params | Performs a DELETE request without parameters |
| Expect 500 Exception Response | Validates a 500 status code exception response |
| Get Variable Type | Retrieves the type of a variable |
| Post Request With Invalid Token | Validates a POST request with an invalid token |
| Post Request Without Body | Validates a POST request without a body |
| Post Request Without Token | Validates a POST request without a token |
| Post With Body | Performs a POST request with a body |
| Post With Body And Invalid Token | Performs a POST request with a body and an invalid token |
| Post With Body And No Headers | Performs a POST request with a body and no headers |
| Post With Body Then Validate | Validates a POST request with a body |
| Post With Params | Performs a POST request with parameters |
| Post With Params Then Validate | Validates a POST request with parameters |
| Post Without Body | Performs a POST request without a body |
| Post Without Body And Invalid Token | Performs a POST request without a body and an invalid token |
| Post Without Body And No Headers | Performs a POST request without a body and no headers |
| Post Without Body Then Validate | Validates a POST request without a body |
| Put With Body | Performs a PUT request with a body |
| Put With Body And Invalid Token | Performs a PUT request with a body and an invalid token |
| Put With Body And No Headers | Performs a PUT request with a body and no headers |
| Query Data And Validate | Validates queried data |
| Query With Body | Performs a query with a body |
| Query With Body And Invalid Token | Performs a query with a body and an invalid token |
| Query With Body And No Headers | Performs a query with a body and no headers |
| Query With Body Then Validate | Validates a query with a body |
| Query With Params | Performs a query with parameters |
| Query With Params And Invalid Token | Performs a query with parameters and an invalid token |
| Query With Params And No Headers | Performs a query with parameters and no headers |
| Query With Params Then Validate | Validates a query with parameters |
| Query Without Params | Performs a query without parameters |
| Query Without Params And Invalid Token | Query without parameters with an invalid token |
| Query Without Params And No Headers | Query without parameters and no headers |
| Response Should Be 400 | Validates a response with a status code 400 |
| Response Should Be Success | Validates a successful response |
| Response Should Be Unauthorized 401 | Validates a response with a status code 401 |
| Startup The Automation Test | Initializes test automation |
| Text Should Be Arabic | Validates text to be in Arabic characters |
| Text Should Be English | Validates text to be in English characters |
$3
Keywords in the App project encompass interactions with mobile applications, such as swiping gestures, element verification, waiting for progress bars, and text validation.
| Keyword Name | Description |
| ----------------------------------- | ----------------------------------------------------- |
| Click Coordinates | Clicks on the specified coordinates within an element |
| Get Variable Type | Retrieves the type of a variable |
| Open The App | Opens the application with specified parameters |
| Pick Random Element | Selects a random element from a set of elements |
| Scroll Down Until Get Element | Scrolls down until a specified element is found |
| Scroll Up Until Get Element | Scrolls up until a specified element is found |
| Swipe Down | Performs a swipe gesture downwards |
| Swipe Left To Right | Performs a swipe gesture from left to right |
| Swipe Right To Left | Performs a swipe gesture from right to left |
| Swipe Up | Performs a swipe gesture upwards |
| Text Should Be Arabic | Validates text to be in Arabic characters |
| Text Should Be English | Validates text to be in English characters |
| Verify ${page_title} Page Is Loaded | Verifies if a specified page is loaded |
| Waiting For Progress Bar | Waits until the progress bar element is visible |
| Waiting For Progress Bar Disappear | Waits until the progress bar element disappears |
$3
Keywords for web projects facilitate actions like navigating to web pages, handling sessions, scrolling until specific elements become visible or invisible, verifying elements' classes, and more.
| Keyword Name | Description |
| ------------------------------------------- | ------------------------------------------------------------------ |
| Click Coordinates | Clicks on specific coordinates within an element |
| Convert Time to Seconds | Converts time format (HH:MM:SS) to total seconds |
| Create List of Text from Elements | Gathers text from elements and creates a list |
| Create Screenshots Directory | Creates a directory for storing screenshots |
| Element Should Be Invisible In The Viewport | Checks if an element is not visible in the viewport |
| Element Should Be Visible In The Viewport | Checks if an element is visible in the viewport |
| Ensure Element Does Not Have Class | Ensures that an element does not have a specified class |
| Ensure Element Has Class | Ensures that an element has a specified class |
| Get Child Webelements | Retrieves child elements of a specified element |
| Get Parent Webelement | Retrieves the parent element of a specified element |
| Get Variable Type | Retrieves the type of a variable |
| Go To Website URL | Navigates to a specified website URL |
| Log Warning If Test Failed | Logs a warning message if a test fails |
| Open a New Session Unless Found One | Opens a new session or proceeds if a session already exists |
| Open Browser To Login Page | Opens the browser and navigates to the login page |
| Pick Random Element | Selects a random element |
| Run Login Process | Executes the login process |
| Scroll Until Element Invisible | Scrolls until a specified element becomes invisible on the screen |
| Scroll Until Element Visible | Scrolls until a specified element becomes visible on the screen |
| Start Test Up | Initiates the test process, including login and verification steps |
| Start again from beginning | Restarts the process based on specific conditions |
| Text Should Be Arabic | Validates text to be in Arabic characters |
| Text Should Be English | Validates text to be in English characters |
| Wait Until Element Not Found on Screen | Waits until a specified element is not found on the screen |
---
These keywords are designed to streamline automation efforts across different project types and can be updated or enhanced to accommodate specific project requirements.
---
Future Release
Expect a feature to generate test cases, eliminating the need for manual creation. Stay tuned for updates and enhancements.