Categories
Automated Testing Python Selenium

How to run parallel test with pytest

Parallel test execution involves running multiple tests simultaneously, significantly reducing the total testing duration.

This method spreads tests across various resources, like multiple CPU cores, threads, or different machines, to execute them simultaneously.

Categories
Excel Python

Working with Excel in Python

While Excel remains a critical tool for many business applications, Python provides the scalability, flexibility and advanced analytics capabilities needed to thrive in the era of big data.

Categories
Automated Testing Python Selenium

Folder Structure Python Selenium Framework with Pytest

Here’s a recommended project structure for end-to-end (E2E) testing with Python, Selenium, and pytest:

project_folder/
├── tests/
│   ├── e2e/
│   │   ├── test_suite_1/
│   │   │   ├── test_case_1.py
│   │   │   └── test_case_2.py
│   │   └── test_suite_2/
│   │       ├── test_case_3.py
│   │       └── test_case_4.py
├── pages/
│   ├── home_page.py
│   ├── login_page.py
│   └── registration_page.py
├── utils/
│   ├── test_data.py
│   ├── configuration.py
│   └── logger.py
├── reports/
│   ├── screenshots/
│   ├── videos/
│   └── test_results.html
├── drivers/
│   ├── chromedriver.exe
│   └── geckodriver.exe
├── conftest.py
├── pytest.ini
├── main.py
└── README.md
Categories
Python Selenium

Selenium & Python

Download and install python

Go to python.org official website and download the latest version.

download python 3.12
Categories
Automated Testing

Types of Testing in Software Development

Understanding the various types of testing is crucial for ensuring that a software product meets the desired standards and functions as expected. Here’s a detailed overview of the key testing methodologies:

Acceptance Testing

Acceptance testing determines whether a feature or system meets customer expectations and requirements. This validation activity answers the question: Are we building the right product? In web applications, this can be automated using Selenium to simulate user behavior, either through record/playback or supported programming languages.

Categories
Automated Testing JavaScript Mocha

Mocha

Mocha is a popular JavaScript testing framework that is widely used for automated testing with Selenium. It provides a structured way to write and organize test cases, making it easier to manage and execute automated tests for web applications.

Categories
Automated Testing

Limitation for Automated Testing

8 limitations to consider when testing web applications with Selenium and JavaScript:

  1. Limited to Web Applications: Selenium is primarily designed for testing web applications running in a browser. It cannot directly test desktop or mobile applications without additional tools or frameworks.
  2. Handling Dynamic Elements: Selenium can struggle with handling highly dynamic web elements, such as those with frequently changing IDs or elements generated through JavaScript. Additional coding techniques like dynamic XPath or CSS selectors may be required.
  3. Handling Pop-ups and Dialogs: Selenium has limited capabilities when it comes to handling browser pop-ups, alerts, and dialogs generated by the operating system. Third-party tools like AutoIT may be needed for such scenarios.
  4. Limited Reporting: Selenium does not provide built-in reporting mechanisms for test results. Integration with third-party reporting tools like TestNG or custom reporting solutions is often necessary.
  5. Image and Captcha Testing: Selenium cannot perform image-based testing or handle captchas out of the box. Additional tools like Sikuli or third-party captcha solving services may be required.
  6. Performance Limitations: For large-scale testing scenarios with numerous parallel executions, Selenium’s performance may be limited, and additional infrastructure or cloud-based solutions may be needed.
  7. Browser Compatibility Issues: While Selenium supports multiple browsers, there can be compatibility issues or differences in behavior across different browser versions, which may require additional handling.
  8. Steep Learning Curve: Selenium has a steep learning curve, especially for beginners, as it requires programming skills and understanding of various concepts like locators, waits, and synchronization.
Categories
Automated Testing JavaScript Selenium

Selenium & JavaScript

Selenium documentation

Initialize the project

npm init -y
// https://www.npmjs.com/package/selenium-webdriver?activeTab=readme
npm i selenium-webdriver
Categories
JavaScript

JavaScript ES6

ES6, also known as ECMAScript 2015, introduced several new features and syntax improvements to JavaScript. Here are some key aspects of ES6:

Categories
API Bizagi

Working with Bizagi APIs

Authentication

Go to OAuth2 Applications option under the Admin>Security and register a new application:

Create the Authorization Token

With the Client Id and Client Secret, go to base64encode.org and encode the following: ClientId:ClientSecret.

Set up Postman

POST: {{projectURL}}/oauth2/server/token

For the Authorization header parameter use the following structure: Basic {{the encode ClientId:ClientSecret from the above step}}

Body > raw > JSON: grant_type=client_credentials&scope=api

The result:

Endpoints

General use

GET odata/data/stakeholders
Lists the name of Stakeholders in your project.

GET /odata/data/userProfile
Obtains information regarding the authenticated user.

GET /odata/Image
Obtains detail of an image (base 64).

GET /odata/data/searchByCaseNumber(caseNumber='[id_case]’)
Obtains detail for a given case number.

GET /odata/data/queries
Lists all query forms in your project

GET /odata/data/entities
Lists all manageable entities (parameter entities and stakeholders)

My stuff

GET /odata/data/stuff
Lists all collections set as my stuff (applicable to a Stakeholder, starting from this resource).

GET /odata/data/stuff([id_stuff])
Obtains information of a given collection set of my stuff.

GET /odata/data/stuff([id_stuff])/actions
Lists all actions available for a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/actions([id_action])
Obtains specific information of a given action available for a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/values
Obtains all records of a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/values([id_value])
Obtains a given record of a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/values([id_value])/actions
Lists all actions available for a given record of a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/values([id_value])/actions([id_action])
Obtains specific information of a given action available for a record of a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/values([id_value])/actions([id_action])/relatedEntities
Lists all attributes which are related entities needed to fire an action (of a given record of a given collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/actions([id_action])/relatedEntities([id_related])
Obtains a given attribute which is a related entity needed to fire an action (of a given record of a given collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])
/actions([id_action])/relatedEntities([id_related])/values
Obtains all possible values of a given attribute which is a related entity, needed to fire an action (of a given record of a given collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/actions([id_action])/relatedEntities([id_related])/values([id_value])
Obtains a given value of a given attribute which is a related entity, needed to fire an action (of a given record of a given collection of my stuff).

POST /odata/data/stuff([id_stuff])/values([id_value])/actions([id_action])/execute
Executes an action available for a given record of a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations
Browses for other attributes whose information need to be drilled down for (for a given record of a given collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])
Browses for a given attribute whose information needs to be drilled down for (for a given record of a given collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values
Obtains all information about a given attribute in a related entity, for a given record of a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])
Obtains specific information about a given attribute in a related entity, for a given record of a given collection of my stuff.

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations
Browses for other attributes whose information need to be drilled down for (for a given related entity attribute of a given record from a collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])
Browses for a given attribute whose information needs to be drilled down for (for a given related entity attribute of a given record from a collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values
Obtains all information about a given attribute in a related entity (for a given related entity attribute of a given record from a collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])
Obtains specific information about a given attribute in a related entity (for a given related entity attribute of a given record from a collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations
Browses for other attributes whose information need to be drilled down for (for a given related entity attribute, 2 levels down, of a given record from a collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])
Browses for a given attribute whose information needs to be drilled down for (for a given related entity attribute, 2 levels down, of a given record from a collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values
Obtains all information about a given attribute in a related entity (for a given related entity attribute, 2 levels down, of a given record from a collection of my stuff).

GET /odata/data/stuff([id_stuff])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])
Obtains specific information about a given attribute in a related entity (for a given related entity attribute, 2 levels down, of a given record from a collection of my stuff).

Searches

GET /odata/data/searches
Lists all searches (applicable to a Stakeholder, starting from this resource).

GET /odata/data/searches([id_search])
Obtains information of a given search.

GET /odata/data/searches([id_search])/actions
Lists all actions available for a given search.

GET /odata/data/searches([id_search])/actions([id_action])
Obtains information of a given action available for a given search.

POST /odata/data/searches([id_search])/performSearch
Executes a given search.

GET /odata/data/searches([id_search])/relatedEntities
Obtains the set of entities that are specified as Entity parameter type required by the process to start a case.

GET /odata/data/searches([id_search])/relatedEntities([id_related])
Obtains additional information about a specific entity required by a given process as an Entity parameter to start a case.

GET /odata/data/searches([id_search])/relatedEntities([id_related])/values
Obtains the set of possible values of a given entity required by a specific process to star a case.

GET /odata/data/searches([id_search])/relatedEntities([id_related])/values([id_value])
Obtains additional information about a specific value of a given entity required by a specific process to start a case.

GET /odata/data/searches([id_search])/results
Obtains results of a given search, which is executed without sending parameters.

GET /odata/data/searches([id_search])/results([id_result])
Obtains a specific result of a given search, which is executed without sending parameters.

GET /odata/data/searches([id_search])/results([id_result])/actions
Lists all actions available for a given result of a given search executed without sending parameters.

GET /odata/data/searches([id_search])/results([id_result])/actions([id_action])
Obtains a specific action available for a given result of a given search executed without sending parameters.

GET /odata/data/searches([id_search])/results([id_result])/actions([id_action])/relatedEntities
Obtains all possible values of a given attribute which is a related entity, needed to fire an action (available for a given result of a given search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/actions([id_action])/relatedEntities([id_related])
Obtains a given attribute which is a related entity needed to fire an action (available for a given result of a given search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/actions([id_action])/relatedEntities([id_related])/values
Obtains all possible values of a given attribute which is a related entity, needed to fire an action (available for a given result of a given search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/actions([id_action])/relatedEntities([id_related])/values([id_value])
Obtains a specific value of a given attribute which is a related entity, needed to fire an action (available for a given result of a given search executed without sending parameters).

POST /odata/data/searches([id_search])/results([id_result])/actions([id_action])/execute
Executes an action (available for a given result of a given search executed without sending parameters).

GET odata/data/searches([id_search])/results([id_result])/navigations
Browses for other attributes whose information need to be drilled down for a given result of a given search (which is executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])
Browses for a given attribute whose information needs to be drilled down for a given result of a given search (which is executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values
Obtains all information about a given attribute in a related entity, for a given result of a given search (which is executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])
Obtains specific information about a given attribute in a related entity, for a given result of a given search (which is executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])/navigations
Browses for other attributes whose information need to be drilled down (for a given related entity attribute of a given result coming from a search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])
Browses for a given attribute whose information needs to be drilled down (for a given related entity attribute of a given result coming from a search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values
Obtains all information about a given attribute in a related entity (for a given related entity attribute of a given result coming from a search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])
Obtains specific information about a given attribute in a related entity (for a given related entity attribute of a given result coming from a search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations
Browses for other attributes whose information needs to be drilled down (for a given related entity attribute, 2 levels down, of a given result coming from a search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])
Browses for a given attribute whose information needs to be drilled down (for a given related entity attribute, 2 levels down, of a given result coming from a search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values
Obtains all information about a given attribute in a related entity (for a given related entity attribute, 2 levels down, of a given result coming from a search executed without sending parameters).

GET /odata/data/searches([id_search])/results([id_result])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])/navigations([id_navigation])/values([id_value])
Obtains specific information about a given attribute in a related entity (for a given related entity attribute, 2 levels down, of a given result coming from a search executed without sending parameters).

Relevant processes

GET /odata/data/relevants
Lists all relevant processes.

GET /odata/data/relevants([id_relevant])
Obtains information about a given relevant process.

POST /odata/data/relevants([id_relevant])/start
Fires a new case for a relevant process.

GET /odata/data/relevants([id_relevant])/relatedEntities
Lists all attributes which are related entities needed to fire a new case (of a given relevant process).

GET /odata/data/relevants([id_relevant])/relatedEntities([id_related])
Obtains a given attribute which is a related entity needed to fire a new case (of a given relevant process).

GET /odata/data/relevants([id_relevant])/relatedEntities([id_related])/values
Obtains all possible values of a given attribute which is a related entity, needed to fire a new case (of a given relevant process).

GET /odata/data/relevants([id_relevant])/relatedEntities([id_related])/values([id_value])
Obtains a given value of a given attribute which is a related entity, needed to fire a new case (of a given relevant process).

GET /odata/data/relevants([id_relevant])/actions
Lists all actions available for a given relevant process.

GET /odata/data/relevants([id_relevant])/actions([id_action])
Obtains information of a given action available for a given relevant process.

GET /odata/data/relevants([id_relevant])/actions([id_action])/relatedEntities
Lists all attributes which are related entities needed to fire an action (of a given relevant process).

GET /odata/data/relevants([id_relevant])/actions([id_action])/relatedEntities([id_related])
Obtains a given attribute which is a related entity needed to fire an action (of a given relevant process).

GET /odata/data/relevants([id_relevant])/actions([id_action])/relatedEntities([id_related])/values
Obtains all possible values of a given attribute which is a related entity, needed to fire an action (of a given relevant process).

GET /odata/data/relevants([id_relevant])/actions([id_action])/relatedEntities([id_related])/values([id_value])
Obtains a given value of a given attribute which is a related entity, needed to fire an action (of a given relevant process).

Processes