<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Raghwendra Sonu</title>
    <description>The latest articles on DEV Community by Raghwendra Sonu (@raghwendrasonu).</description>
    <link>https://dev.to/raghwendrasonu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F225783%2F88511e03-a201-46f5-bbdf-0346687ca60a.jpeg</url>
      <title>DEV Community: Raghwendra Sonu</title>
      <link>https://dev.to/raghwendrasonu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raghwendrasonu"/>
    <language>en</language>
    <item>
      <title>Using Multiple Browser Contexts in Playwright (With Real-Life Examples 🚀)</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Tue, 19 Aug 2025 01:47:19 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/using-multiple-browser-contexts-in-playwright-with-real-life-examples--3mga</link>
      <guid>https://dev.to/raghwendrasonu/using-multiple-browser-contexts-in-playwright-with-real-life-examples--3mga</guid>
      <description>&lt;p&gt;When I first started using Playwright, one of the features that blew my mind was multiple browser contexts. It sounds fancy, but once you get it, you’ll realize how powerful it is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let’s break it down in simple words.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What is a Browser Context? 🤔&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Think of a browser context as a fresh user profile inside your browser.&lt;/p&gt;

&lt;p&gt;No saved cookies.&lt;br&gt;
No cache.&lt;br&gt;
No logged-in sessions.&lt;/p&gt;

&lt;p&gt;Basically, a clean slate.&lt;/p&gt;

&lt;p&gt;If you open Chrome in incognito mode, that’s very similar to a new browser context.&lt;/p&gt;

&lt;p&gt;Why Do We Need Multiple Contexts?&lt;br&gt;
Imagine you’re testing an e-commerce site.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;👉 Scenario:&lt;/strong&gt;&lt;br&gt;
One user (Alice) adds an item to the cart.&lt;br&gt;
Another user (Bob) logs in and checks out.&lt;/p&gt;

&lt;p&gt;If you try to test this in the same browser window, it gets messy because Alice and Bob share cookies and login sessions.&lt;/p&gt;

&lt;p&gt;But with multiple browser contexts, Alice and Bob can both use the same browser at the same time — and they’ll never know each other exists.&lt;/p&gt;

&lt;p&gt;💡 It’s like giving every user their own private “incognito window,” but all managed in one Playwright script.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Analogy 🏠&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of a browser like a house.&lt;/p&gt;

&lt;p&gt;A browser context is a separate apartment inside that house.&lt;br&gt;
Each apartment has its own kitchen, bathroom, and furniture.&lt;/p&gt;

&lt;p&gt;Just because you’re cooking in your apartment doesn’t mean your neighbor smells the food. Same for sessions in browser contexts!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Code 🧑‍💻&lt;/strong&gt;&lt;br&gt;
Here’s how you can do it in Playwright (JavaScript/TypeScript):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { chromium } = require('playwright');

(async () =&amp;gt; {
  const browser = await chromium.launch();

  // Create first context (Alice)
  const contextAlice = await browser.newContext();
  const pageAlice = await contextAlice.newPage();
  await pageAlice.goto('https://example.com');
  await pageAlice.fill('#username', 'Alice');
  await pageAlice.fill('#password', 'password123');
  await pageAlice.click('#login');

  // Create second context (Bob)
  const contextBob = await browser.newContext();
  const pageBob = await contextBob.newPage();
  await pageBob.goto('https://example.com');
  await pageBob.fill('#username', 'Bob');
  await pageBob.fill('#password', 'password456');
  await pageBob.click('#login');

  // Both users are logged in — in the SAME browser instance, but separate contexts!
  console.log('Alice and Bob are now logged in separately 🎉');

  await browser.close();
})();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why This Is Powerful 💪&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Parallel user flows → Test multiple users at once.&lt;br&gt;
No interference → Sessions, cookies, and local storage are isolated.&lt;br&gt;
Faster tests → Instead of launching a whole new browser, you just launch new contexts (lightweight and efficient).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Use Cases 📝&lt;/strong&gt;&lt;br&gt;
Testing chat apps (Alice messages Bob).&lt;br&gt;
Testing multi-role apps (Admin vs. Customer).&lt;br&gt;
Testing different geographies (set geolocation in each context).&lt;br&gt;
Verifying isolated sessions (like different users in incognito).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wrapping Up 🎬&lt;/strong&gt;&lt;br&gt;
Multiple browser contexts in Playwright are like having multiple incognito windows under one roof. They’re super handy for testing real-world user scenarios where different people interact with the same app.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;So next time you need to test Alice vs. Bob, or Admin vs. User, don’t open two browsers — just open two contexts!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>playwright</category>
      <category>testing</category>
      <category>typescript</category>
      <category>automation</category>
    </item>
    <item>
      <title>Real-life analogy to explain the concept of Spring.</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Fri, 19 Jan 2024 04:21:33 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/real-life-analogy-to-explain-the-concept-of-spring-3ej7</link>
      <guid>https://dev.to/raghwendrasonu/real-life-analogy-to-explain-the-concept-of-spring-3ej7</guid>
      <description>&lt;p&gt;Imagine you are building a kitchen for a restaurant. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools (Beans):&lt;/strong&gt;&lt;br&gt;
In this kitchen, various appliances and tools are needed, such as a refrigerator, an oven, and a blender. Each of these tools is like a "bean" in the Spring framework.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kitchen (Spring Context):&lt;/strong&gt;&lt;br&gt;
The entire kitchen, with all the tools arranged and ready to use are like Spring Context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cook (Developers):&lt;/strong&gt;&lt;br&gt;
The cook in the Kitchen are like developers. They are skilled individuals who use the tools (beans) to make food.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting the Right Tools for the Job (Dependency Injection):&lt;/strong&gt;&lt;br&gt;
When a Cook needs a tool e.g. Fridge or Knife (which is Beans), they don't build it from scratch; they take it from the Kitchen rack. Similarly, in Spring, you don't create objects from scratch; the Spring container provides the necessary beans to your application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Arranging Tools (Configuration Metadata):&lt;/strong&gt;&lt;br&gt;
Just as you organize your kitchen by placing tools in specific locations for easy access, in Spring, you configure your beans using metadata (XML, annotations, or Java code). This metadata tells the Spring container how to create and manage the beans.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tool Usage (Bean Lifecycle):&lt;/strong&gt;&lt;br&gt;
Just as you use tools in the kitchen when needed, Spring beans have a lifecycle. They are created, configured, and sometimes destroyed by the Spring container. It's like taking tools out when you start cooking and putting them back when you're done.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Special Tools for Specific Purposes (Scopes):&lt;/strong&gt;&lt;br&gt;
Some tools, like knives or cutting boards, are used throughout the cooking process (singleton scope). Others, like disposable plates, are used for a specific task and then discarded (prototype scope). Similarly, Spring beans can have different scopes based on their usage patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automatic Kitchen Setup (Annotation-Based Configuration):&lt;/strong&gt;&lt;br&gt;
Imagine if, as you buy new tools for your kitchen, they automatically find their place without you having to rearrange everything. In Spring, you can use annotations like @Component to automatically register beans without manual configuration.&lt;/p&gt;

&lt;p&gt;Just as a well-organized kitchen makes cooking more efficient, Spring's organization of beans simplifies the development of Java applications.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Streams in Java?</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Thu, 18 Jan 2024 02:56:52 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/streams-in-java-583b</link>
      <guid>https://dev.to/raghwendrasonu/streams-in-java-583b</guid>
      <description>&lt;p&gt;In Java, streams are a powerful and flexible abstraction introduced in Java 8 as part of the java.util.stream package. Streams provide a new way to process data in a functional and declarative manner. They enable developers to express complex data processing operations concisely and efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Operations on Streams:&lt;/strong&gt;&lt;br&gt;
Filtering:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;List filteredList = myList.stream()&lt;br&gt;
                                 .filter(s -&amp;gt; s.startsWith("A"))&lt;br&gt;
                                 .collect(Collectors.toList());&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Mapping:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;List lengths = myList.stream()&lt;br&gt;
                             .map(String::length)&lt;br&gt;
                             .collect(Collectors.toList());&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sorting:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;List sortedList = myList.stream()&lt;br&gt;
                               .sorted()&lt;br&gt;
                               .collect(Collectors.toList());&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Reducing:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Optional concatenated = myList.stream()&lt;br&gt;
                                     .reduce((s1, s2) -&amp;gt; s1 + s2);&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Collecting:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;List collectedList = myList.stream()&lt;br&gt;
                                  .collect(Collectors.toList());&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Grouping and Partitioning:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Map&amp;gt; groupedByLength = myList.stream()&lt;br&gt;
                                                   .collect(Collectors.groupingBy(String::length));&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example of Chaining Stream Operations:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;List result = myList.stream()&lt;br&gt;
                            .filter(s -&amp;gt; s.length() &amp;gt; 2)&lt;br&gt;
                            .map(String::toUpperCase)&lt;br&gt;
                            .sorted()&lt;br&gt;
                            .collect(Collectors.toList());&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this example, the stream is filtered to include only strings with a length greater than 2, then each string is converted to uppercase (so the map is used to do additional operation on the result returned from filter), the resulting strings are sorted, and finally, the result is collected into a new list.&lt;/p&gt;

&lt;p&gt;Streams simplify the processing of collections in Java, providing a concise and expressive way to manipulate data. They are particularly useful when dealing with large datasets or performing complex data transformations.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Different ways of iterating an ArrayList ?</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Thu, 18 Jan 2024 02:41:16 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/different-ways-of-iterating-an-arraylist--1bok</link>
      <guid>https://dev.to/raghwendrasonu/different-ways-of-iterating-an-arraylist--1bok</guid>
      <description>&lt;p&gt;In Java, there are several ways to iterate over an ArrayList, which is a dynamic array implementation provided by the Java Collections Framework. Here are some common ways to iterate through an ArrayList:&lt;/p&gt;

&lt;p&gt;Using a Traditional For Loop:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ArrayList list = new ArrayList&amp;lt;&amp;gt;();&lt;br&gt;
// Add elements to the list&lt;br&gt;
for (int i = 0; i &amp;lt; list.size(); i++) {&lt;br&gt;
    String element = list.get(i);&lt;br&gt;
    // Process the element&lt;br&gt;
}&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using an Enhanced For Loop (for-each loop):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ArrayList list = new ArrayList&amp;lt;&amp;gt;();&lt;br&gt;
// Add elements to the list&lt;br&gt;
for (String element : list) {&lt;br&gt;
    // Process the element&lt;br&gt;
}&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using Iterator:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ArrayList list = new ArrayList&amp;lt;&amp;gt;();&lt;br&gt;
// Add elements to the list&lt;br&gt;
Iterator iterator = list.iterator();&lt;br&gt;
while (iterator.hasNext()) {&lt;br&gt;
    String element = iterator.next();&lt;br&gt;
    // Process the element&lt;br&gt;
}&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using forEach() with Lambda Expression (Java 8 onwards):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ArrayList list = new ArrayList&amp;lt;&amp;gt;();&lt;br&gt;
// Add elements to the list&lt;br&gt;
list.forEach(element -&amp;gt; {&lt;br&gt;
    // Process the element&lt;br&gt;
});&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using forEach() with Method Reference (Java 8 onwards):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ArrayList list = new ArrayList&amp;lt;&amp;gt;();&lt;br&gt;
// Add elements to the list&lt;br&gt;
list.forEach(System.out::println); // Example of printing elements&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using Streams (Java 8 onwards):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ArrayList list = new ArrayList&amp;lt;&amp;gt;();&lt;br&gt;
// Add elements to the list&lt;br&gt;
list.stream().forEach(element -&amp;gt; {&lt;br&gt;
    // Process the element&lt;br&gt;
});&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using ListIterator (for iterating in both directions):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ArrayList list = new ArrayList&amp;lt;&amp;gt;();&lt;br&gt;
// Add elements to the list&lt;br&gt;
ListIterator listIterator = list.listIterator();&lt;br&gt;
while (listIterator.hasNext()) {&lt;br&gt;
    String element = listIterator.next();&lt;br&gt;
    // Process the element&lt;br&gt;
}&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Each of these methods has its advantages and use cases. The enhanced for loop and iterator are common and widely used. The introduction of streams and lambda expressions in Java 8 provides a more concise and expressive way to iterate over collections. Choose the method that best fits your specific requirements and coding style.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>testing</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to get data from Postgres DB as Java Map?</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Tue, 25 Jul 2023 01:19:16 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/how-to-get-data-from-postgres-db-as-java-map-26mi</link>
      <guid>https://dev.to/raghwendrasonu/how-to-get-data-from-postgres-db-as-java-map-26mi</guid>
      <description>&lt;p&gt;In this post i will talk about how we get retrieve data from Postgres DB as map of list as well as list of maps in Java.&lt;/p&gt;

&lt;h2&gt;
  
  
  To fetch data from RDS as List of Map:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public List&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; readResultSetAsList(String query) throws SQLException {
    System.out.println("query(" + query + ")");
    Statement queryStatement = connection.createStatement();
    ResultSet resultSet = queryStatement.executeQuery(query);
    ResultSetMetaData md = resultSet.getMetaData();
    int columns = md.getColumnCount();
    List&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; rows = new ArrayList&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt;();
    while (resultSet.next()) {
      Map&amp;lt;String, Object&amp;gt; row = new HashMap&amp;lt;String, Object&amp;gt;(columns);
      for (int i = 1; i &amp;lt;= columns; ++i) {
        row.put(md.getColumnName(i), resultSet.getObject(i));
      }
      rows.add(row);
    }
    System.out.println("rows=====" + rows);
    return rows;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  To fetch data from RDS as Map of List:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public Map&amp;lt;String, List&amp;lt;Object&amp;gt;&amp;gt; readResultSet(String query) {
    System.out.println("query(" + query + ")");
    Map&amp;lt;String, List&amp;lt;Object&amp;gt;&amp;gt; resultList = null;
    try {
      Statement queryStatement = connection.createStatement();
      ResultSet resultSet = queryStatement.executeQuery(query);
      ResultSetMetaData md = resultSet.getMetaData();
      int columnCount = resultSet.getMetaData().getColumnCount();

      resultList = new HashMap&amp;lt;&amp;gt;(columnCount);
      for (int i = 1; i &amp;lt;= columnCount; ++i) {
        resultList.put(md.getColumnName(i), new ArrayList&amp;lt;&amp;gt;());
      }
      while (resultSet.next()) {
        for (int i = 1; i &amp;lt;= columnCount; ++i) {
          resultList.get(md.getColumnName(i)).add(resultSet.getObject(i));
        }
      }
      System.out.println("resultList=====" + resultList);

      resultSet.close();
      queryStatement.close();
    } catch (SQLException e) {
      Assert.fail(
          "Failed to execute query("
              + query
              + ")! Reason - "
              + e.getSQLState()
              + " "
              + e.getMessage());
    }
    return resultList;
  }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me know in comments if this was helpful.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>All about Selenide</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Wed, 28 Jun 2023 00:47:19 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/all-about-selenide-3oh2</link>
      <guid>https://dev.to/raghwendrasonu/all-about-selenide-3oh2</guid>
      <description>&lt;p&gt;Selenide is an open-source automation testing library that provides a simplified and user-friendly API for automating web applications. It is built on top of Selenium WebDriver and aims to make test automation with Selenium more efficient and readable by reducing the complexity of code.&lt;/p&gt;

&lt;p&gt;Here are some key features and characteristics of Selenide:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Easy Setup&lt;/strong&gt;: Selenide requires minimal configuration and setup. It automatically handles the WebDriver setup, eliminating the need for boilerplate code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Concise and Readable Syntax&lt;/strong&gt;: Selenide offers a fluent and intuitive API, allowing testers to write concise and readable code for their automation scripts. It provides a range of methods for interacting with web elements, such as finding elements by CSS selectors, XPath, or text.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Implicit Waits&lt;/strong&gt;: Selenide automatically waits for elements to appear on the page, removing the need for explicit waits. It provides intelligent waiting strategies that make tests more stable and reliable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Built-in Assertions&lt;/strong&gt;: Selenide includes a rich set of built-in assertions that can be used to validate the state of web elements, such as their visibility, text content, attributes, and more. This simplifies the process of verifying expected behavior in tests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic Browser Management&lt;/strong&gt;: Selenide handles the management of browser instances, including opening and closing the browser, switching between windows or frames, and handling pop-up dialogs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Screenshots and Video Recording&lt;/strong&gt;: Selenide allows capturing screenshots and recording videos during test execution, which can be helpful for debugging and analyzing test failures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integration with Test Frameworks&lt;/strong&gt;: Selenide integrates smoothly with popular Java-based testing frameworks like JUnit and TestNG, enabling seamless test execution and reporting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Support for BDD Frameworks&lt;/strong&gt;: Selenide can be easily integrated with Behavior-Driven Development (BDD) frameworks like Cucumber and JBehave, enabling a more business-readable and collaborative testing approach.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Selenide focuses on providing a developer-friendly experience for test automation, making it easier to write and maintain automated tests using Selenium. Its intuitive API, built-in waiting strategies, and streamlined setup process contribute to its popularity among automation testers.&lt;/p&gt;

&lt;p&gt;To get started with Selenide, you can explore the official documentation and resources available on the project's website: &lt;a href="http://selenide.org/"&gt;http://selenide.org/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Generate Allure reports in Cypress Framework</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Tue, 20 Jun 2023 02:55:17 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/generate-allure-reports-in-cypress-framework-1odb</link>
      <guid>https://dev.to/raghwendrasonu/generate-allure-reports-in-cypress-framework-1odb</guid>
      <description>&lt;p&gt;To generate an HTML Allure report in the Cypress framework, you can follow these steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install the Allure Command Line tool:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Allure Command Line tool is required to generate the HTML report. Install it globally using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g allure-commandline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Add the Cypress Allure Plugin:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install the Cypress Allure Plugin by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev @shelex/cypress-allure-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Configure the Cypress plugin:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the cypress/plugins/index.js file and add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const allureWriter = require('@shelex/cypress-allure-plugin/writer');

module.exports = (on, config) =&amp;gt; {
  allureWriter(on, config);
  return config;
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run your Cypress tests:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run your Cypress tests using the Cypress command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx cypress run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generate the Allure report:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After running the tests, the Allure report data will be stored in the allure-results directory.&lt;/p&gt;

&lt;p&gt;To generate the HTML report, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;allure generate allure-results --clean &amp;amp;&amp;amp; allure open
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will generate the HTML report based on the data in the allure-results directory and open it in your default browser.&lt;/p&gt;

&lt;p&gt;That's it! You have generated an HTML Allure report for your Cypress tests. The report will provide detailed information about the test execution, including test cases, steps, attachments, and more.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to update environment variable on Mac</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Tue, 25 May 2021 06:25:17 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/how-to-update-environment-variable-on-mac-4n1g</link>
      <guid>https://dev.to/raghwendrasonu/how-to-update-environment-variable-on-mac-4n1g</guid>
      <description>&lt;p&gt;Goto terminal&lt;br&gt;
Run : VIM ~/.BASH_PROFILE &lt;br&gt;
Enter I&lt;br&gt;
TO INSERT NEW ENVIRONEMNT PATH&lt;br&gt;
export M2_HOME=/Users/1138872/Documents/Automation/Software/apache-maven-3.6.3&lt;br&gt;
export PATH=$PATH:$M2_HOME/bin:$JAVA_HOME/bin:$GRAILS_HOME/bin&lt;/p&gt;

&lt;p&gt;You can add multiple paths in PATH variable by using : also remember to use /bin in the end of path variable&lt;br&gt;
Once edited this file, tap esc button&lt;br&gt;
Enter :wq to edit this file and quit&lt;br&gt;
To execute this file close all terminal and rerun again else    Type source .bash_profile to execute the .bash_profile file.&lt;/p&gt;

&lt;p&gt;To verify successful installation enter: echo $PATH. It should display your newly added path. Also, You can type echo $M2_HOME&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to use Junit Annotation in Android UI Framework- Kotlin &amp; Espresso based</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Sat, 22 May 2021 05:16:02 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/how-to-use-junit-annotation-in-android-ui-framework-2m4g</link>
      <guid>https://dev.to/raghwendrasonu/how-to-use-junit-annotation-in-android-ui-framework-2m4g</guid>
      <description>&lt;p&gt;&lt;strong&gt;Problem Statement:&lt;/strong&gt;&lt;br&gt;
We need to add a capability in the framework, where they can Create and use JUnit tags to filter/group and run tests. e.g.&lt;/p&gt;

&lt;p&gt;@Sanity&lt;br&gt;
@Regression&lt;br&gt;
@MyAnnotation&lt;/p&gt;

&lt;p&gt;So, basically we will Run specific Android Espresso tests by creating custom annotations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br&gt;
Step 1) Create a custom annotation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy

//Create Annotation Class- Step3
@Target(
    AnnotationTarget.FUNCTION,
    AnnotationTarget.PROPERTY_GETTER,
    AnnotationTarget.PROPERTY_SETTER,
    AnnotationTarget.ANNOTATION_CLASS,
    AnnotationTarget.CLASS
)
@Retention(
    RetentionPolicy.RUNTIME
)
annotation class MyAnnotation\
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;@Target specifies the possible kinds of elements which can be annotated with the annotation (classes, functions, properties, expressions etc.)&lt;/p&gt;

&lt;p&gt;We used it for annotate some functions, so we use AnnotationTarget.FUNCTION&lt;/p&gt;

&lt;p&gt;@Retention specifies whether the annotation is stored in the compiled class files and whether it’s visible through reflection at runtime (by default, both are true).&lt;/p&gt;

&lt;p&gt;AnnotationRetention.RUNTIME makes sure that the Rat annotation is visible to the test runner during the runtime.&lt;/p&gt;

&lt;p&gt;Step 2) Annotate @MyAnnotation on the tests you want to run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Test @MyAnnotation
fun AddTaskToDoListTestAndMarkDone() {
   ......
   ......
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3) Use gradlew to run only MyAnnotation tests&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./gradlew connectedAndroidTest -P android.testInstrumentationRunnerArguments.annotation=com.example.todolist.app.MyAnnotation

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>android</category>
      <category>framework</category>
      <category>kotlin</category>
      <category>espresso</category>
    </item>
    <item>
      <title>Windows Desktop Automation with pyWinAuto</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Thu, 06 Feb 2020 01:50:45 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/windows-desktop-automation-with-pywinauto-532j</link>
      <guid>https://dev.to/raghwendrasonu/windows-desktop-automation-with-pywinauto-532j</guid>
      <description>&lt;p&gt;pywinauto is a set of python modules to automate the Microsoft Windows GUI. At its simplest it allows you to send mouse and keyboard actions to windows dialogs and controls. &lt;/p&gt;

&lt;p&gt;Installation- &amp;gt; pip install pywinauto&lt;/p&gt;

&lt;p&gt;To use this tool, you need to get attributes of your application. For this purpose you can use PyInspect tool. Clone the below repository: &lt;br&gt;
&lt;a href="https://github.com/dm-vodopyanov/py_inspect" rel="noopener noreferrer"&gt;https://github.com/dm-vodopyanov/py_inspect&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and run  python py_inspect.py from command prompt.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffwl84ywa15jpstjtqip9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffwl84ywa15jpstjtqip9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can inspect the properties of all the elements using this tool.&lt;/p&gt;

&lt;p&gt;Later, you need to use these attributes for automation using pyWinAuto.&lt;/p&gt;

&lt;p&gt;I will write a python file that will do following stuffs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;launch Notepad&lt;/li&gt;
&lt;li&gt;type 99999 in the notepad&lt;/li&gt;
&lt;li&gt;Click on Edit -&amp;gt; replace&lt;/li&gt;
&lt;li&gt;Click on Cancel button on the Replace Dialog box.&lt;/li&gt;
&lt;li&gt;Again it will enter "Hi from Python...." text in the notepad&lt;/li&gt;
&lt;li&gt;It will navigate to File-&amp;gt; Save menu&lt;/li&gt;
&lt;li&gt;Save the file with name "Test"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the pyWinAuto code for this use case:&lt;/p&gt;

&lt;p&gt;from pywinauto import application&lt;br&gt;
app=application.Application(backend="uia")&lt;br&gt;
try:&lt;br&gt;
    app.start("Notepad.exe")&lt;br&gt;
    app.window().wait('visible')&lt;br&gt;
    app.window(best_match='Untitled - Notepad').type_keys('99999')&lt;br&gt;
    app.UntitledNotepad.menu_select("Edit -&amp;gt; Replace")&lt;br&gt;
    app.Dialog.CancelButton.click()&lt;br&gt;
    app.UntitledNotepad.Edit.type_keys("Hi from Python.....")&lt;br&gt;
    app.Dialog.menu_select("File-&amp;gt;Save")&lt;br&gt;
    app.Dialog.Pane.ComboBox0.Edit5.type_keys("Test")&lt;br&gt;
    app.Dialog.Save.click()&lt;br&gt;
    app.window(title='Test - Notepad').wait('ready', timeout=10)&lt;br&gt;
except TimeoutError as e:&lt;br&gt;
    print(e)&lt;br&gt;
    raise e&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnq9e4pmt2aspk2cfahb5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnq9e4pmt2aspk2cfahb5.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the execution video. &lt;br&gt;
&lt;a href="https://vimeo.com/389630552" rel="noopener noreferrer"&gt;https://vimeo.com/389630552&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this was helpful. For more details go through pyWinAuto documentation: &lt;a href="https://pywinauto.readthedocs.io/en/latest/" rel="noopener noreferrer"&gt;https://pywinauto.readthedocs.io/en/latest/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>tutorial</category>
      <category>todayisearched</category>
    </item>
    <item>
      <title>What is Cloud Native?</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Thu, 19 Dec 2019 09:24:01 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/what-is-cloud-native-31f5</link>
      <guid>https://dev.to/raghwendrasonu/what-is-cloud-native-31f5</guid>
      <description>&lt;p&gt;Cloud Native is an approach to design, build and run applications using Continuous Integration, Container Engines and Cloud Orchestrators, to reduce the cost and risk and increase quality, scalability and speed of application. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why we need Cloud Native?
&lt;/h2&gt;

&lt;p&gt;1&amp;gt; Modularity- To create modular products. This helps in reducing delivery and maintanence costs. This is achieved by Micro services.&lt;/p&gt;

&lt;p&gt;2&amp;gt; Observability- This helps in easy tracking of the applications and services. So, if something goes wrong with the account services module, only that will get impacted.&lt;/p&gt;

&lt;p&gt;3&amp;gt; Deployability- Quick and easy to deploy in small chunks.&lt;/p&gt;

&lt;p&gt;4&amp;gt; Testability- Easy to test an application and services.&lt;/p&gt;

&lt;p&gt;5&amp;gt; Disposability- Easy to kill part of application, as it does not depend much on other modules or environments.&lt;/p&gt;

&lt;p&gt;6&amp;gt; Replaceability- Can often create and move to other deployments.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the difference between Cloud Native and Traditional Approaches?
&lt;/h2&gt;

&lt;p&gt;1&amp;gt; Abstraction- Cloud native provides abstraction whereas, traditional approach is Operating System dependent.&lt;/p&gt;

&lt;p&gt;2&amp;gt; Predictable- Time taken to deploy an application in Cloud Native is predictable. Whereas, in traditional approach is unpredictable.&lt;/p&gt;

&lt;p&gt;3&amp;gt; Right Size Capacity- Easily scalable application depending on need, traditional approach is most of the time over sized.&lt;/p&gt;

&lt;p&gt;4&amp;gt; Continuous Delivery- Cloud native enforces Continuous Delivery.&lt;/p&gt;

&lt;p&gt;5&amp;gt; Automated Scaling in Cloud Native, whereas Manual scaling in Traditional approach.&lt;/p&gt;

&lt;p&gt;6&amp;gt; Recovery- In case of any failures cloud native is rapidly recoverable than traditional.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to design Cloud Native Application?
&lt;/h2&gt;

&lt;p&gt;There are certain design principles that should be followed to have a Cloud native Application, some of them are:&lt;br&gt;
1&amp;gt; Micro-services- Develop application in chunks.&lt;/p&gt;

&lt;p&gt;2&amp;gt; API Based design- So that it will be easy to deploy and test the services.&lt;/p&gt;

&lt;p&gt;3&amp;gt; Safe Service Infrastructure- Infrastructure should be auto healing and auto load balancing.&lt;/p&gt;

&lt;p&gt;4&amp;gt; Anti fragile- Robust exception handling in application.&lt;/p&gt;

&lt;p&gt;Hope this post was able to give some basic idea of Cloud Native. Thanks for reading.&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>devops</category>
      <category>cicd</category>
      <category>container</category>
    </item>
    <item>
      <title>Automate anything you see, with Sikuli</title>
      <dc:creator>Raghwendra Sonu</dc:creator>
      <pubDate>Tue, 19 Nov 2019 02:36:37 +0000</pubDate>
      <link>https://dev.to/raghwendrasonu/automate-anything-you-see-with-sikuli-86o</link>
      <guid>https://dev.to/raghwendrasonu/automate-anything-you-see-with-sikuli-86o</guid>
      <description>&lt;p&gt;Sikuli is an open source GUI based automation tool. It uses the technique of 'Image Recognition' to interact with elements of the web page and windows popups. Sikuli is preferred when UI elements are stable and are not constantly changing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we did?
&lt;/h2&gt;

&lt;p&gt;Add the Sikuli dependency in pom.xml&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gmQm9hGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/bkoaqtrhppo4bf4mkviz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gmQm9hGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/bkoaqtrhppo4bf4mkviz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Store all of the images inside project Image folder:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OYgqvSIS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jz1ffp46ak2b5t0lpgcf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OYgqvSIS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jz1ffp46ak2b5t0lpgcf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works?
&lt;/h2&gt;

&lt;p&gt;Perform action on the images:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CtM7D5vq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7u37lm9n33eibr4dckek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CtM7D5vq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7u37lm9n33eibr4dckek.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read more about Sikuli commands and available methods from &lt;a href="http://doc.sikuli.org/"&gt;http://doc.sikuli.org/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sikuli</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
