Skip to main content

Posts

Showing posts from 2023

How to handle multiple environments in the Node.js framework?

There are multiple ways to achieve it but one of the simplest ways is to use the Dotenv module. Dotenv is a lightweight and zero-dependency module that automatically loads environment variables from a .env file into the process.env object. Handling multiple environments using dotenv involves creating separate .env files for each environment (e.g., dev, testing, staging, production) and dynamically loading the appropriate file based on the current environment. Here's a step-by-step guide to follow:          Step 1: Install dotenv Package (recommended- locally):           npm install dotenv --save          Step 2: Create separate .env files for each environment. For example:         .env.dev for development         .env.test for testing         .env.stage for staging         .env.prod for production   ...

Clipboardy: Node.js library

 Clipboardy is a popular Node.js library that provides a cross-platform solution for interacting with the system clipboard. It supports both synchronous and asynchronous operations, and it can be used to copy, paste, and read the clipboard contents. Features of Clipboardy: 1. Cross-platform compatibility: It works on macOS, Windows, Linux, OpenBSD, FreeBSD, Android with Termux, and modern browsers. 2. Synchronous and asynchronous operations: It provides both synchronous and asynchronous methods for clipboard operations, making it suitable for a variety of use cases. 3. Copy, paste, and read operations: It supports copying, pasting, and reading the clipboard contents, making it a versatile tool for interacting with the clipboard. 4. Promise-based API: It is an asynchronous method that returns promises, making it easy to handle asynchronous operations in a clean and concise way. 5. Easy to use: It has a simple and intuitive API that is easy to learn and use. How to Use Clipboardy: To...

Playwright: Locator vs ElementHandle

  In Playwright, both Locator and ElementHandle are important concepts used for interacting with elements on a web page, but they serve slightly different purposes. Locator : A Locator in Playwright is a way to find and interact with elements on a web page. It represents a selector that can be used to locate one or multiple elements. Once you have a Locator object, you can use it to perform actions like clicking, filling input fields, or getting the text of the element. Locators are typically used in Playwright’s page object model for cleaner and more maintainable tests. When you perform actions using a Locator, Playwright automatically waits for the element to be present in the DOM before interacting with it. This helps in handling asynchronous content loading. Example : ElementHandle : An ElementHandle in Playwright represents a handle to a DOM element on a web page. It is a reference to the actual element and provides methods to interact with the element, such as clicking, typin...

Winston- A logger for just about everything

       Winston   Winston is a popular logging library for Node.js applications. It is intended to be simple and adaptable, with support for a variety of transports, formats, and logging levels. As a result, it is a versatile tool for logging application events, failures, and other data.   Here are some of the key features of Winston: ·          >  Multiple transports: Winston can send logs to multiple destinations, such as the console, a file, or a remote server. This allows you to centralize your logs and make them easier to analyze.         >  Flexible formatting: Winston supports a variety of log formats, including JSON, plain text, and custom formats. This allows you to tailor your logs to your specific needs. ·          >  Logging levels: Winston supports multiple logging levels, such as error, warn, info, and debug. This allows you ...

Online Gherkin Editor

IDEs such as Eclipse, IntelliJ, VS Code, and similar IDEs, are ideal for SDETs but not for POs and BA Amigos who want to contribute. There are a few tools available like  https://cucumber.io/tools/cucumberstudio , etc. that provide Gherkin editors as well as a slew of other useful capabilities, but they are paid. If you are looking for something that is free, simple to use, and accessible to everyone, you can use: https://app.specflow.org/gherkin-editor/ The editor provides example scenarios for you to reference when you initially load the page. You can enter your own content into the text area, and the editor will highlight it. If you wish, you can even change the language via a dropdown menu.

What is the Pyramid of Test Automation?

  The Test Automation Pyramid is a framework and guiding principle, for organizing and structuring software testing efforts in terms of automation. It visually represents the types of tests that should be included in a test suite with the detailed tests at the bottom and broader tests at the top. According to the Test Automation Pyramid, a successful approach to test automation should be built upon three layers or levels of tests each serving a purpose and providing feedback; Unit Tests: These are the most detailed types of tests and should be automated for each individual section of code in the application. They are quick to execute and focus on testing units. Typically created and executed by developers, they aim to identify defects in the development process. Unit tests provide feedback. Help ensure that individual code units function correctly. Service Tests : These tests primarily focus on interactions and integration between various components or services within your applicat...

Git Tip 💡

> Git aliases: Making aliases for popular commands to save time in the terminal is one of the most effective ways to enhance your everyday workflow. The most used Git commands like checkout, commit, etc. can be made into aliases using the following commands: -> git config --global alias.co checkout -> git config --global alias.ct commit Now, we only need to type "git co main" rather than "git checkout main". Likewise, type "git ct main" rather than "git commit main". We can also edit directly the .gitconfig file for the same purpose: [alias]     co = checkout     ct = commit

Sensitive Data in Azure Pipelines - Azure Variable Groups (Benefits and Real-World Examples)

  Secret variables are variables that are encrypted and can be used in pipelines without having their value revealed. You can use secret variables to store confidential information like passwords, identification numbers, and other identifying information that you wouldn't want to be exposed in a pipeline. Secret variables are accessible to tasks and scripts on the agent and are encrypted at rest with a 2048-bit RSA key. Secret variables specified in a pipeline's pipeline settings UI are only applicable to that pipeline. To share confidential variables between pipelines, utilize variable groups. What are Azure Variable Groups? Key-value pairs, or variables, can be used in many pipelines and stages of an Azure DevOps project and are managed centrally by Azure Variable Groups. These variables can be used to store configuration values that may change depending on the environment (such as development, staging, or production), as well as private data like connection strings or...

How to pass a variable value between Azure Pipeline jobs (within the same stage)?

Since the jobs operate in different namespaces, passing variable values between them is unlike passing a variable value from one function to another. In the example below, $app_Token is the variable name that needs to be sent from one job to another job but within the same stage. This issue can be resolved by dynamically storing the variable in the variable library and retrieving its value from there. The task.setvariable command, which is illustrated below, is required to store variables using PowerShell in the Azure Pipeline library. Full example:  # Maven # Build your Java project and run tests with Apache Maven. # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/java trigger: - master stages: - stage: VariableUpdateAutomation jobs: - job: Set_AppTokenValue pool: vmImage: ubuntu-latest steps: - task: PowerShell@2 name: Set_AppTokenValue i...

Top Five Trends in Software Testing

Software testing is a crucial step in the #SDLC and is necessary to produce high-quality goods.  Have examined the top five software testing trends that will become more popular in the future - read here: https://www.tavant.com/blog/top-5-software-testing-trends-to-follow

single-branch parameter in the git clone

Despite having a small amount of storage on your local, do you need to do a task in a specific branch of git? Or, for a variety of reasons, you might only wish to clone a certain branch's files? Git, fortunately, allows the flexibility to accomplish this with single-branch parameter. What is the single-branch parameter in the git clone? It allows you to only fetch files from the specified branch and only tracks that branch without fetching other branches. git clone -b <branchname> — single-branch <remote-repo-url> Or git clone — branch <branchname> — single-branch <remote-repo-url>  

Postman CLI Vs Newman

The Postman v10 release in Q3 of 2022 introduced the Postman CLI. If you are interested to know whether you should move from Newman to Postman CLI, please go through this: https://learning.postman.com/docs/postman-cli/postman-cli-overview Here is a direct comparison table: Postman CLI Vs Newman: https://learning.postman.com/docs/postman-cli/postman-cli-overview/#comparing-the-postman-cli-and-newman This should help to decide which command-line companion to use: https://learning.postman.com/docs/postman-cli/postman-cli-overview/#deciding-which-command-line-companion-to-use My 2 cents: Of course, Newman is not deprecated ( yet ) but I think it can be the case that the Postman team will work more actively on Postman CLI than Newman. If you are an existing Newman user, there is no push right now to move to Postman CLI. However, if you are just getting started with grokking backend automation with Postman then give it a shot to Postman CLI.

Code-based versus Low-Code/No-Code test automation solutions: Which one to Choose?

In today's world, where new automation test solutions are being released monthly, enterprises are looking for ways to expand and accelerate their software delivery processes. The key to success is choosing the right solution that balances your team’s skill sets and expertise and simultaneously meets your organization’s objectives. This blog details out the pros and cons of code-based vs. low-code/no-code test automation solutions. Author: Dheeraj Gambhir Blog Link Enjoyed reading this article? Please share the knowledge with your friends and colleagues.