<?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: Márcio Corrêa</title>
    <description>The latest articles on DEV Community by Márcio Corrêa (@marciorc_).</description>
    <link>https://dev.to/marciorc_</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%2F414433%2F91582c21-4729-4a71-95d8-c5e83a068101.jpg</url>
      <title>DEV Community: Márcio Corrêa</title>
      <link>https://dev.to/marciorc_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marciorc_"/>
    <language>en</language>
    <item>
      <title>12 Advanced Git Features That Will Transform Your Workflow</title>
      <dc:creator>Márcio Corrêa</dc:creator>
      <pubDate>Wed, 02 Apr 2025 22:42:09 +0000</pubDate>
      <link>https://dev.to/marciorc_/12-advanced-git-features-that-will-transform-your-workflow-4d76</link>
      <guid>https://dev.to/marciorc_/12-advanced-git-features-that-will-transform-your-workflow-4d76</guid>
      <description>&lt;p&gt;While most teams have adopted main instead of master, Git has introduced many other powerful improvements in recent years. Here are 12 key changes that can supercharge your workflow:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Purpose-Specific Commands: git switch and git restore
&lt;/h2&gt;

&lt;p&gt;Replaces the ambiguous git checkout with dedicated commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/new-endpoint  &lt;span class="c"&gt;# Create and switch to new branch&lt;/span&gt;
git restore &lt;span class="nt"&gt;--staged&lt;/span&gt; file.js       &lt;span class="c"&gt;# Unstage changes without losing them&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Partial Repository Checkouts: git sparse-checkout
&lt;/h2&gt;

&lt;p&gt;Optimize performance in monorepos by working with specific subdirectories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone &lt;span class="nt"&gt;--filter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;blob:none &lt;span class="nt"&gt;--sparse&lt;/span&gt; https://repo.url
git sparse-checkout &lt;span class="nb"&gt;set &lt;/span&gt;packages/client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Intelligent Rebasing: &lt;code&gt;--update-refs&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Automatically updates dependent branches during complex rebases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git rebase main feature/auth &lt;span class="nt"&gt;--update-refs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before: Required manual &lt;code&gt;git branch -f&lt;/code&gt; to fix dependent branches&lt;br&gt;
After: Preserves entire branch topology automatically&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Automated Repository Maintenance
&lt;/h2&gt;

&lt;p&gt;Schedule optimization tasks in the background:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git maintenance start &lt;span class="nt"&gt;--schedule&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;daily
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Runs &lt;code&gt;gc&lt;/code&gt;, &lt;code&gt;commit-graph&lt;/code&gt;, and &lt;code&gt;pack-refs&lt;/code&gt; automatically&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Rebase-First Pull Strategy
&lt;/h2&gt;

&lt;p&gt;Configure as global default for cleaner histories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; pull.rebase merges
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Safe Branch Creation
&lt;/h2&gt;

&lt;p&gt;Prevent accidental overwrites with &lt;code&gt;-c&lt;/code&gt; (fails if branch exists):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; new-feature  &lt;span class="c"&gt;# Fails safely if branch exists&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Contextual Stashing
&lt;/h2&gt;

&lt;p&gt;Add semantic messages to temporary saves:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git stash push &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"WIP: auth middleware refactor"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. Precise Commit Range Comparison
&lt;/h2&gt;

&lt;p&gt;Analyze changes between PR iterations or versions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git range-diff HEAD~4..HEAD~2 HEAD~3..HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output: Color-coded diff showing:&lt;br&gt;
    &lt;code&gt;-&lt;/code&gt; Removed commits&lt;br&gt;
    &lt;code&gt;+&lt;/code&gt; Added commits&lt;br&gt;
    &lt;code&gt;!&lt;/code&gt; Modified commits&lt;/p&gt;
&lt;h2&gt;
  
  
  9. Future-Proof Hashing: SHA-256
&lt;/h2&gt;

&lt;p&gt;Migrate to more secure object hashing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; core.hashAlgorithm sha256
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  10. Sensible Default Branch
&lt;/h2&gt;

&lt;p&gt;Initialize repositories with modern conventions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init &lt;span class="nt"&gt;--initial-branch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;trunk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  11. Surgical Code Search
&lt;/h2&gt;

&lt;p&gt;Pinpoint locations with column precision:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nt"&gt;--column&lt;/span&gt; &lt;span class="s2"&gt;"TODO: refactor"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  12. Performance Optimizations
&lt;/h2&gt;

&lt;p&gt;Notable improvements in Git 2.35+:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;50% faster git status in large repos&lt;/li&gt;
&lt;li&gt;Optimized git log --author queries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Implementation Checklist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify version (git --version)&lt;/li&gt;
&lt;li&gt;Update via package manager if &amp;lt; 2.23&lt;/li&gt;
&lt;li&gt;Add aliases for frequent commands:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;alias&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
  rb &lt;span class="o"&gt;=&lt;/span&gt; rebase &lt;span class="nt"&gt;--update-refs&lt;/span&gt;
  rs &lt;span class="o"&gt;=&lt;/span&gt; restore &lt;span class="nt"&gt;--staged&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These features represent Git's evolution from a version control system to a sophisticated development environment manager. By leveraging them, teams can achieve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;40% reduction in branch management overhead&lt;/li&gt;
&lt;li&gt;30% faster code reviews&lt;/li&gt;
&lt;li&gt;Elimination of entire classes of VCS-related errors&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Which of these have you implemented in your workflow? Share your experiences with advanced Git features in the comments.&lt;/p&gt;

</description>
      <category>git</category>
      <category>development</category>
    </item>
    <item>
      <title>Schema Validation vs. Contract Testing: Understanding the Differences</title>
      <dc:creator>Márcio Corrêa</dc:creator>
      <pubDate>Mon, 17 Mar 2025 20:47:08 +0000</pubDate>
      <link>https://dev.to/marciorc_/schema-validation-vs-contract-testing-understanding-the-differences-58ji</link>
      <guid>https://dev.to/marciorc_/schema-validation-vs-contract-testing-understanding-the-differences-58ji</guid>
      <description>&lt;p&gt;Many people confuse schema validation with contract testing, but in reality, schema validation is just one part of contract testing. Let’s explore the differences between these concepts and understand why both are essential for ensuring API quality.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Contract Testing?
&lt;/h2&gt;

&lt;p&gt;Contract testing is a broad approach that verifies whether the communication between two systems (such as a client and a server) adheres to a predefined "contract". This contract defines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Request and response formats&lt;/strong&gt;: Data structure, field types, status codes, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expected behavior&lt;/strong&gt;: How the API should behave in different scenarios.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Business rules&lt;/strong&gt;: Specific validations the API must perform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Contract testing ensures that the server (API provider) and the client (API consumer) are aligned, preventing compatibility issues and integration problems.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Schema Validation?
&lt;/h2&gt;

&lt;p&gt;Schema validation is a specific step within contract testing. It focuses on verifying whether the structure of the data (such as JSON or XML) sent and received by the API matches a defined schema, like a JSON Schema or an OpenAPI (Swagger) specification.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Does Schema Validation Check?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data types&lt;/strong&gt;: Whether fields have the correct types (e.g., number, string, boolean).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Required fields&lt;/strong&gt;: Whether mandatory fields are present.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data format&lt;/strong&gt;: Whether the data follows a specific pattern (e.g., dates, emails).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Differences Between Schema Validation and Contract Testing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Schema Validation&lt;/th&gt;
&lt;th&gt;Contract Testing&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scope&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Focuses only on data structure.&lt;/td&gt;
&lt;td&gt;Covers structure, behavior, and business rules.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Goal&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ensures data is in the correct format.&lt;/td&gt;
&lt;td&gt;Ensures the API follows the defined contract with the client.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Examples of Checks&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;- Field types. &lt;br&gt; - Required fields. &lt;br&gt; - Data format.&lt;/td&gt;
&lt;td&gt;- Status codes. &lt;br&gt; - API behavior. &lt;br&gt; - Business rules. &lt;br&gt; - Data structure.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Common Tools&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;- JSON Schema Validator. &lt;br&gt; - OpenAPI Validator.&lt;/td&gt;
&lt;td&gt;- Pact. &lt;br&gt; - Postman. &lt;br&gt; - RestAssured.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Why is Schema Validation Only Part of Contract Testing?
&lt;/h2&gt;

&lt;p&gt;Schema validation is important, but it doesn’t cover all aspects of an API contract. Here are some examples of what contract testing can include beyond schema validation:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Status Code Validation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Verifies if the API returns the correct HTTP status codes (e.g., 200 for success, 404 for resource not found).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. API Behavior&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ensures the API behaves as expected in different scenarios (e.g., returning an error when trying to create a duplicate resource).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Business Rules&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Validates if the API enforces specific business rules (e.g., a user can only access their own data).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Version Compatibility&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Checks if a new API version is compatible with clients using the previous version.&lt;/p&gt;




&lt;h2&gt;
  
  
  Practical Example
&lt;/h2&gt;

&lt;p&gt;Scenario:&lt;/p&gt;

&lt;p&gt;You have a user API with the following contract:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GET /users/{id} request&lt;/strong&gt; should return:

&lt;ul&gt;
&lt;li&gt;Status code: 200.
&lt;/li&gt;
&lt;li&gt;Response body:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"John Doe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"active"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Schema Validation:
&lt;/h3&gt;

&lt;p&gt;Checks if the response has the fields &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt;, and &lt;code&gt;active&lt;/code&gt;, with the correct types (&lt;code&gt;number&lt;/code&gt;, &lt;code&gt;string&lt;/code&gt;, &lt;code&gt;boolean&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Contract Testing:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Verifies if the status code is 200.&lt;/li&gt;
&lt;li&gt;Verifies if the response body matches the defined schema.&lt;/li&gt;
&lt;li&gt;Verifies if the API returns a 404 error when the user doesn’t exist.&lt;/li&gt;
&lt;li&gt;Verifies if the API enforces business rules (e.g., an inactive user cannot be returned).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;While schema validation is an important step to ensure data structure is correct, contract testing goes further, covering behavior, business rules, and compatibility. Both are essential for ensuring API quality and reliability, but it’s important to understand that schema validation is just one part of the process.&lt;/p&gt;

</description>
      <category>apitesting</category>
      <category>qa</category>
      <category>softwaretesting</category>
    </item>
    <item>
      <title>Avoiding Over-Engineering in Test Automation</title>
      <dc:creator>Márcio Corrêa</dc:creator>
      <pubDate>Wed, 12 Mar 2025 12:26:47 +0000</pubDate>
      <link>https://dev.to/marciorc_/avoiding-over-engineering-in-test-automation-ep8</link>
      <guid>https://dev.to/marciorc_/avoiding-over-engineering-in-test-automation-ep8</guid>
      <description>&lt;p&gt;Over-engineering in test automation occurs when solutions are designed to be more complex than necessary, often leading to increased costs, maintenance challenges, and unnecessary risks. Let’s explore how this can happen and how to avoid it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Over-Engineering?
&lt;/h2&gt;

&lt;p&gt;Over-engineering is the practice of developing solutions that are more complex than required to solve a problem. In test automation, this often means adding unnecessary layers of abstraction, tools, or features that go beyond the actual testing needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples of Over-Engineering in Test Automation
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Excessively Complex Frameworks&lt;br&gt;
Creating a test automation framework with multiple layers of abstraction and advanced design patterns when a simpler solution would suffice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automating Unlikely Scenarios&lt;br&gt;
Automating edge cases or scenarios that are extremely rare or irrelevant to the application’s real-world use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Overuse of Tools and Integrations&lt;br&gt;
Integrating multiple reporting, monitoring, or management tools when a single tool could meet all requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unnecessary Test Coverage&lt;br&gt;
Automating tests to achieve 100% code coverage, even for trivial or non-critical parts of the codebase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automating Simple Manual Tests&lt;br&gt;
Automating tests that are quick and easy to perform manually, such as checking button text or element colors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Custom Solutions Over Existing Tools&lt;br&gt;
Building a custom automation tool from scratch when established tools like Selenium, Cypress, or Playwright already meet the needs.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to Avoid Over-Engineering in Test Automation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Focus on Real Needs: Automate only what is necessary to ensure software quality.&lt;/li&gt;
&lt;li&gt;Keep It Simple: Use straightforward frameworks and tools that meet requirements without unnecessary complexity.&lt;/li&gt;
&lt;li&gt;Prioritize Critical Scenarios: Automate the most critical and frequently executed test cases first.&lt;/li&gt;
&lt;li&gt;Evaluate Cost vs. Benefit: Consider the time and resources required to develop and maintain automation versus the benefits gained.&lt;/li&gt;
&lt;li&gt;Leverage Existing Tools: Use well-established automation tools instead of building custom solutions.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I’ll admit, I’ve made my fair share of over-engineering mistakes in the past—whether it was building overly complex frameworks or automating tests that didn’t really need automation. It’s all part of the learning process!&lt;/p&gt;

&lt;p&gt;Have you ever fallen into the over-engineering trap? What lessons did you learn? Share your experiences in the comments—I’d love to hear your stories! 😊&lt;/p&gt;

</description>
      <category>testautomation</category>
      <category>overengineering</category>
      <category>qa</category>
    </item>
    <item>
      <title>GitHub Project Setup: Markdown Tips</title>
      <dc:creator>Márcio Corrêa</dc:creator>
      <pubDate>Tue, 11 Mar 2025 00:27:05 +0000</pubDate>
      <link>https://dev.to/marciorc_/github-project-setup-markdown-tips-4kan</link>
      <guid>https://dev.to/marciorc_/github-project-setup-markdown-tips-4kan</guid>
      <description>&lt;p&gt;Setting up a GitHub project with well-structured Markdown files can greatly improve collaboration and project clarity. Here are some essential tips for creating and organizing Markdown files in your repository, including how to use Mermaid for diagrams:&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull Request (PR) Templates
&lt;/h2&gt;

&lt;p&gt;Using PR templates ensures contributors provide consistent and sufficient information for code reviews.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Create a PR Template:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a folder called &lt;code&gt;.github&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Inside it, create another folder named &lt;code&gt;PULL_REQUEST_TEMPLATE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add a template file, e.g., &lt;code&gt;pull_request_template.md&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example PR Template:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### Description&lt;/span&gt;
Describe the purpose of this PR. What does it fix or improve?

&lt;span class="gu"&gt;### Type of Change&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Bug fix
&lt;span class="p"&gt;-&lt;/span&gt; [ ] New feature
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Code improvement
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Documentation
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Other (please specify)

&lt;span class="gu"&gt;### Checklist&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; [ ] My code follows the project's style guidelines.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] I tested my changes locally.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] I added tests to cover my changes.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Documentation has been updated, if necessary.

&lt;span class="gu"&gt;### Related Issues&lt;/span&gt;
Resolves # (insert the related issue number, if applicable)

&lt;span class="gu"&gt;### Screenshots (if applicable)&lt;/span&gt;
Add screenshots to illustrate visual changes, if any.

&lt;span class="gu"&gt;### Additional Notes&lt;/span&gt;
Add any additional information relevant to the review.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Issue Templates
&lt;/h2&gt;

&lt;p&gt;Issue templates standardize how tasks and bugs are reported, making it easier to track and resolve them.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Create an Issue Template:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Inside the &lt;code&gt;.github&lt;/code&gt; folder, create a folder named &lt;code&gt;ISSUE_TEMPLATE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add template files for different types of issues, such as &lt;code&gt;bug_report.md&lt;/code&gt; and &lt;code&gt;feature_request.md&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example Bug Report Template:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;### Bug Description
Describe the bug clearly and concisely.

### Steps to Reproduce
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See the error

### Expected Behavior
Describe what you expected to happen.

### Actual Behavior
Describe what actually happened.

### Screenshots
Add screenshots to help explain the issue.

### Additional Information
- Operating System:
- Browser (if applicable):
- Software Version:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  README and Documentation
&lt;/h2&gt;

&lt;p&gt;A good &lt;code&gt;README.md&lt;/code&gt; is essential for explaining your project, how to set it up, and how to contribute.&lt;br&gt;
Suggested README Structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Project Name&lt;/span&gt;

&lt;span class="gu"&gt;## Description&lt;/span&gt;
A brief description of the project.

&lt;span class="gu"&gt;## Setup&lt;/span&gt;
Steps to set up the project locally.

&lt;span class="gu"&gt;## Contributing&lt;/span&gt;
Instructions for contributing to the project.

&lt;span class="gu"&gt;## License&lt;/span&gt;
Information about the project's license.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Contributing Guidelines
&lt;/h2&gt;

&lt;p&gt;Create a &lt;code&gt;CONTRIBUTING.md&lt;/code&gt; file to guide new contributors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# How to Contribute&lt;/span&gt;
&lt;span class="p"&gt;
1.&lt;/span&gt; Fork the repository.
&lt;span class="p"&gt;2.&lt;/span&gt; Create a branch for your feature (&lt;span class="sb"&gt;`git checkout -b feature/new-feature`&lt;/span&gt;).
&lt;span class="p"&gt;3.&lt;/span&gt; Commit your changes (&lt;span class="sb"&gt;`git commit -m 'Add new feature'`&lt;/span&gt;).
&lt;span class="p"&gt;4.&lt;/span&gt; Push your branch (&lt;span class="sb"&gt;`git push origin feature/new-feature`&lt;/span&gt;).
&lt;span class="p"&gt;5.&lt;/span&gt; Open a Pull Request.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Mermaid for Diagrams
&lt;/h2&gt;

&lt;p&gt;GitHub supports Mermaid, a powerful tool for creating diagrams directly in Markdown files. This is especially useful for documenting workflows, architectures, or processes.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Use Mermaid:
&lt;/h3&gt;

&lt;p&gt;Wrap your Mermaid code in a code block with the mermaid language specifier.&lt;br&gt;
Basic Flowchart Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;'''mermaid
graph TD;
    A[Start] --&amp;gt; B{Decision?};
    B --&amp;gt;|Yes| C[Do something];
    B --&amp;gt;|No| D[Do something else];
    C --&amp;gt; E[End];
    D --&amp;gt; E;
'''
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;ps.: I needed to replace the character (`) for (') because of the dev.to code block.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By following these tips, you can ensure your GitHub project is well-documented, easy to navigate, and visually engaging with Mermaid diagrams. If you have any questions or need further examples, feel free to ask! 😊&lt;/p&gt;

</description>
      <category>github</category>
      <category>markdown</category>
    </item>
    <item>
      <title>Understanding Software Testing: White Box, Black Box, and Gray Box Testing</title>
      <dc:creator>Márcio Corrêa</dc:creator>
      <pubDate>Fri, 07 Mar 2025 17:42:10 +0000</pubDate>
      <link>https://dev.to/marciorc_/understanding-software-testing-white-box-black-box-and-gray-box-testing-19jj</link>
      <guid>https://dev.to/marciorc_/understanding-software-testing-white-box-black-box-and-gray-box-testing-19jj</guid>
      <description>&lt;p&gt;When it comes to software testing, there are several approaches to ensure that an application works as expected. Three of the most common types are White Box Testing, Black Box Testing, and Gray Box Testing. In this post, I’ll break down these concepts in a simple way, with examples, and discuss the pros and cons of each approach.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. White Box Testing
&lt;/h2&gt;

&lt;p&gt;White Box Testing, also known as Clear Box Testing or Structural Testing, involves testing the internal structure or code of the software. The tester has full knowledge of the code and tests how it works "under the hood."&lt;/p&gt;

&lt;h3&gt;
  
  
  When is it used?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;To verify the correctness of the code.&lt;/li&gt;
&lt;li&gt;To ensure that all parts of the code are tested (e.g., all branches, loops, and conditions).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;

&lt;p&gt;Imagine you have a simple function that adds two numbers. In White Box Testing, you would test the function by checking its internal logic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Function to add two numbers
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="c1"&gt;# White Box Test
&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Test passed!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Test failed!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Here, you know exactly how the &lt;code&gt;add&lt;/code&gt; function works and test it directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Thorough Testing: Ensures that all parts of the code are tested, including branches, loops, and conditions.&lt;/li&gt;
&lt;li&gt;Early Bug Detection: Helps identify issues early in the development process.&lt;/li&gt;
&lt;li&gt;Optimization: Can help optimize the code by identifying redundant or inefficient logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Time-Consuming: Requires detailed knowledge of the code, which can be time-consuming.&lt;/li&gt;
&lt;li&gt;Complexity: Can be complex to implement, especially for large systems.&lt;/li&gt;
&lt;li&gt;Limited User Perspective: Does not focus on the user experience or overall functionality.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Black Box Testing
&lt;/h2&gt;

&lt;p&gt;Black Box Testing focuses on testing the functionality of the software without any knowledge of its internal code. The tester treats the software as a "black box" and only checks the inputs and outputs.&lt;/p&gt;

&lt;h3&gt;
  
  
  When is it used?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;To verify that the software meets the requirements.&lt;/li&gt;
&lt;li&gt;To test the software from the user’s perspective.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;

&lt;p&gt;Using the same add function, but this time, you don’t know how it’s implemented. You only test if the function returns the correct output for a given input.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: 2 and 3
Expected Output: 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the function returns 5, the test passes. If not, it fails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User-Centric: Focuses on the user experience and overall functionality.&lt;/li&gt;
&lt;li&gt;No Code Knowledge Needed: Testers do not need to know the internal code, making it easier to implement.&lt;/li&gt;
&lt;li&gt;Effective for Large Systems: Suitable for testing large systems where the internal code is complex or unknown.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Limited Coverage: May not cover all parts of the code, leading to potential undetected issues.&lt;/li&gt;
&lt;li&gt;Inefficient for Complex Logic: Less effective for testing complex logic or algorithms.&lt;/li&gt;
&lt;li&gt;Dependent on Requirements: Relies heavily on well-defined requirements; unclear requirements can lead to inadequate testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Gray Box Testing
&lt;/h2&gt;

&lt;p&gt;Gray Box Testing is a combination of White Box and Black Box Testing. The tester has partial knowledge of the internal structure of the software. This approach is often used to test the interaction between different components of the system.&lt;/p&gt;

&lt;h3&gt;
  
  
  When is it used?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;To test the integration of different modules or components.&lt;/li&gt;
&lt;li&gt;When you need to understand some parts of the code but not all.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;

&lt;p&gt;Suppose you know that the add function is used in a larger system, but you don’t know all the details of its implementation. You test the function’s output and also verify that it’s being called correctly within the system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: 2 and 3
Expected Output: 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verification: Is the &lt;code&gt;add&lt;/code&gt; function being called correctly?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Balanced Approach: Combines the strengths of both White Box and Black Box Testing.&lt;/li&gt;
&lt;li&gt;Effective for Integration Testing: Ideal for testing the interaction between different components.&lt;/li&gt;
&lt;li&gt;Partial Code Knowledge: Requires only partial knowledge of the code, making it easier to implement than White Box Testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Limited Depth: May not be as thorough as White Box Testing in terms of code coverage.&lt;/li&gt;
&lt;li&gt;Complexity: Can be more complex than Black Box Testing due to the need for some code knowledge.&lt;/li&gt;
&lt;li&gt;Dependent on Documentation: Relies on good documentation to understand the parts of the code being tested.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Understanding the differences between White Box, Black Box, and Gray Box Testing is essential for any software tester or developer. Each approach has its strengths and is suited for different scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;White Box Testing is ideal for verifying internal logic.&lt;/li&gt;
&lt;li&gt;Black Box Testing is great for ensuring the software meets user requirements.&lt;/li&gt;
&lt;li&gt;Gray Box Testing is useful for testing integration and functionality with partial knowledge of the code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By combining these testing methods, you can ensure that your software is robust, reliable, and ready for users.&lt;/p&gt;

</description>
      <category>qa</category>
      <category>testing</category>
    </item>
    <item>
      <title>How Kotlin Makes API Test Automation with RestAssured Easier</title>
      <dc:creator>Márcio Corrêa</dc:creator>
      <pubDate>Tue, 04 Mar 2025 23:52:38 +0000</pubDate>
      <link>https://dev.to/marciorc_/how-kotlin-makes-api-test-automation-with-restassured-easier-4dp7</link>
      <guid>https://dev.to/marciorc_/how-kotlin-makes-api-test-automation-with-restassured-easier-4dp7</guid>
      <description>&lt;p&gt;If you work with API test automation, you’ve probably heard of RestAssured, a powerful library for testing REST APIs in Java. But what if I told you that you can make your tests even more efficient, readable, and maintainable by using Kotlin? 😉&lt;/p&gt;

&lt;p&gt;Kotlin is a modern, concise, and feature-rich language that pairs perfectly with RestAssured. In this post, I’ll show you some Kotlin features that can supercharge your API tests!&lt;/p&gt;

&lt;p&gt;1 - Concise and Readable Syntax&lt;/p&gt;

&lt;p&gt;Kotlin is famous for its clean and concise syntax. This means less boilerplate code and more clarity. Check out how a simple test becomes cleaner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;response&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;given&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"""{"name": "John", "age": 30}"""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;`when`&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/users"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fewer lines, less confusion, more productivity! 🚀&lt;/p&gt;

&lt;p&gt;2 - Multiline Strings (Triple Quotes)&lt;/p&gt;

&lt;p&gt;Tired of concatenating strings to create JSON payloads? With Kotlin, you can use multiline strings with """&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;jsonPayload&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"""
    {
        "name": "John",
        "age": 30,
        "email": "john@example.com"
    }
"""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple and organized, right?&lt;/p&gt;

&lt;p&gt;3 - Extension Functions&lt;/p&gt;

&lt;p&gt;Kotlin allows you to create extension functions, which are perfect for adding custom functionality to RestAssured. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nc"&gt;RequestSpecification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;withJsonBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nc"&gt;RequestSpecification&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;response&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;given&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;withJsonBody&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"""{"name": "John"}"""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;`when`&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/users"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes your code more modular and reusable. 💡&lt;/p&gt;

&lt;p&gt;4 - Null Safety&lt;/p&gt;

&lt;p&gt;Nothing worse than an unexpected NullPointerException, right? With Kotlin’s null safety system, you can avoid these issues:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Can be null&lt;/span&gt;
&lt;span class="nf"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="s"&gt;"Email not found"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Handles null values&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sleep well knowing your code won’t break because of a null! 😴&lt;/p&gt;

&lt;p&gt;5 - Data Classes&lt;/p&gt;

&lt;p&gt;Need to represent domain objects or DTOs? Kotlin’s data classes are perfect for this. They automatically generate methods like toString(), equals(), and hashCode():&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;data class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;user&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"john@example.com"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Output: User(id=1, name=John, email=john@example.com)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Less code, more productivity! 🎉&lt;/p&gt;

&lt;p&gt;6 - Coroutines (Asynchronous Programming)&lt;/p&gt;

&lt;p&gt;If your tests involve asynchronous calls, Kotlin’s coroutines can be a lifesaver:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;kotlinx.coroutines.*&lt;/span&gt;

&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;fetchUserAsync&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nc"&gt;Deferred&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GlobalScope&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;given&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/users/1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;runBlocking&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;response&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fetchUserAsync&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;await&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;asString&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Asynchronous programming without the headache! 🌐&lt;/p&gt;

&lt;p&gt;7 - DSL (Domain-Specific Language)&lt;/p&gt;

&lt;p&gt;Kotlin allows you to create DSLs (Domain-Specific Languages), which can make your tests even more expressive&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;apiTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;RequestSpecification&lt;/span&gt;&lt;span class="p"&gt;.()&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Unit&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nc"&gt;Response&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;given&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;`when`&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;response&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;apiTest&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Bearer token"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;queryParam&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Fluent and easy-to-understand code? Yes, please! 😍&lt;/p&gt;

&lt;p&gt;Complete API Test Example&lt;/p&gt;

&lt;p&gt;Here’s a complete example of an API test using Kotlin and RestAssured:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;io.restassured.RestAssured.*&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;io.restassured.response.Response&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.hamcrest.Matchers.*&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.junit.Test&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ApiTest&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@Test&lt;/span&gt;
    &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;testCreateUser&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;jsonPayload&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"""
            {
                "name": "John",
                "age": 30,
                "email": "john@example.com"
            }
        """&lt;/span&gt;

        &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Response&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;given&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;jsonPayload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;`when`&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/users"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;equalTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="nf"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"User created with ID: ${response.path&amp;lt;String&amp;gt;("&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="s"&gt;")}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nd"&gt;@Test&lt;/span&gt;
    &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;testGetUser&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Response&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;given&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;queryParam&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;`when`&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/users"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;equalTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="nf"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"User details: ${response.body().asString()}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Kotlin is a powerful language that pairs perfectly with RestAssured for API test automation. With its concise syntax, null safety, extension functions, and coroutine support, you can write more efficient, readable, and maintainable tests.&lt;/p&gt;

&lt;p&gt;So, are you ready to take your API tests to the next level with Kotlin? If you’re already using Kotlin or have any questions, drop a comment below! Let’s chat! 🚀&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>restassured</category>
      <category>apitesting</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
