<?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>Forem: Hashira Belén Vargas Candia</title>
    <description>The latest articles on Forem by Hashira Belén Vargas Candia (@hashiravc).</description>
    <link>https://forem.com/hashiravc</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%2F3527669%2Fc2dac607-59a2-4f31-9974-046a234b4a9b.png</url>
      <title>Forem: Hashira Belén Vargas Candia</title>
      <link>https://forem.com/hashiravc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/hashiravc"/>
    <language>en</language>
    <item>
      <title>Applying Fortify Static Code Analyzer to a Node.js Application: A Practical Guide</title>
      <dc:creator>Hashira Belén Vargas Candia</dc:creator>
      <pubDate>Sat, 06 Dec 2025 04:34:32 +0000</pubDate>
      <link>https://forem.com/hashiravc/applying-fortify-static-code-analyzer-to-a-nodejs-application-a-practical-guide-2fen</link>
      <guid>https://forem.com/hashiravc/applying-fortify-static-code-analyzer-to-a-nodejs-application-a-practical-guide-2fen</guid>
      <description>&lt;p&gt;Article by: Hashira Belén Vargas Candia&lt;br&gt;
Systems Engineering Student – Application Security Focus&lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction to SAST Tools
&lt;/h2&gt;

&lt;p&gt;Static Application Security Testing (SAST) tools analyze source code to identify security vulnerabilities before the application is deployed. While tools like SonarQube, Snyk, and Semgrep are popular, this article explores Micro Focus Fortify Static Code Analyzer (SCA) – an enterprise-grade SAST solution for comprehensive security analysis.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Fortify SCA?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fortify SCA offers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multi-language support (Java, .NET, C++, Python, JavaScript, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deep code analysis with data flow and control flow tracking&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Comprehensive vulnerability database (OWASP Top 10, CWE, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integration capabilities with CI/CD pipelines&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Detailed remediation guidance&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Setting Up Fortify SCA for a Node.js Application
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Micro Focus Fortify SCA installation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Node.js project with source code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fortify Plugin for your IDE (optional)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Step 1: Installation &amp;amp; Setup
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Download Fortify SCA from official Micro Focus portal
# Install with default settings
# Verify installation
fortify version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Step 2: Configure Scan Settings
&lt;/h2&gt;

&lt;p&gt;Create a fortify-sca.properties file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Scan configuration for Node.js application
com.fortify.sca.Phase0HigherOrder.Languages=javascript
com.fortify.sca.EnableHTML5Scan=true
com.fortify.sca.NPM.EnableDependencyScanning=true
com.fortify.sca.Yarn.EnableDependencyScanning=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Running the Scan
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Navigate to your Node.js project directory
cd /path/to/your/nodejs-app

# Run sourceanalyzer to translate source code
sourceanalyzer -b myNodeAppBuild -clean
sourceanalyzer -b myNodeAppBuild -source 1.8 **/*.js **/*.ts **/*.jsx **/*.tsx

# Scan for vulnerabilities
fortifyclient start scan -b myNodeAppBuild
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Real-World Example: Vulnerable Node.js Code
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Before SAST Analysis
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// app.js - Vulnerable code examples

// 1. SQL Injection vulnerability
app.get('/users', (req, res) =&amp;gt; {
    const userId = req.query.id;
    // UNSAFE: Direct string concatenation
    db.query(`SELECT * FROM users WHERE id = ${userId}`, (err, result) =&amp;gt; {
        res.json(result);
    });
});

// 2. XSS vulnerability
app.post('/comment', (req, res) =&amp;gt; {
    const comment = req.body.comment;
    // UNSAFE: Direct DOM injection
    res.send(`&amp;lt;div&amp;gt;${comment}&amp;lt;/div&amp;gt;`);
});

// 3. Hardcoded credentials
const dbPassword = 'Admin@123'; // Security issue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  After Fortify SCA Analysis &amp;amp; Fixes
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// app.js - Secure code after remediation

// 1. Fixed SQL Injection using parameterized queries
app.get('/users', (req, res) =&amp;gt; {
    const userId = req.query.id;
    // SAFE: Parameterized query
    db.query('SELECT * FROM users WHERE id = ?', [userId], (err, result) =&amp;gt; {
        res.json(result);
    });
});

// 2. Fixed XSS using output encoding
const escapeHtml = require('escape-html');
app.post('/comment', (req, res) =&amp;gt; {
    const comment = req.body.comment;
    // SAFE: HTML escaping
    res.send(`&amp;lt;div&amp;gt;${escapeHtml(comment)}&amp;lt;/div&amp;gt;`);
});

// 3. Removed hardcoded credentials
const dbPassword = process.env.DB_PASSWORD; // From environment variables
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Understanding Fortify Scan Results
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Sample Output Format
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "issues": [
    {
      "id": "CWE-89",
      "severity": "High",
      "category": "SQL Injection",
      "file": "/src/routes/users.js",
      "line": 45,
      "description": "User input flows into SQL query without validation",
      "recommendation": "Use parameterized queries or stored procedures"
    },
    {
      "id": "CWE-79",
      "severity": "Medium",
      "category": "Cross-Site Scripting (XSS)",
      "file": "/src/views/comments.ejs",
      "line": 23,
      "description": "User input directly reflected in HTML output",
      "recommendation": "Implement proper output encoding"
    }
  ],
  "summary": {
    "total_issues": 15,
    "high_severity": 3,
    "medium_severity": 8,
    "low_severity": 4
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Severity Classification
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Critical/High: Immediate attention required (SQLi, RCE, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Medium: Address in next development cycle (XSS, CSRF, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Low: Consider fixing (information disclosure, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Integrating Fortify SCA into CI/CD Pipeline
&lt;/h2&gt;

&lt;h3&gt;
  
  
  GitHub Actions Integration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .github/workflows/fortify-scan.yml
name: Fortify SAST Scan

on: [push, pull_request]

jobs:
  fortify-scan:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '18'

    - name: Install dependencies
      run: npm ci

    - name: Download Fortify SCA
      run: |
        wget https://download.fortify.com/sca/fortify-sca-latest.zip
        unzip fortify-sca-latest.zip

    - name: Run Fortify Scan
      run: |
        ./fortify-sca/bin/sourceanalyzer -b ${{ github.run_id }} -clean
        ./fortify-sca/bin/sourceanalyzer -b ${{ github.run_id }} **/*.js
        ./fortify-sca/bin/fortifyclient start scan -b ${{ github.run_id }}

    - name: Upload Results
      uses: actions/upload-artifact@v3
      with:
        name: fortify-results
        path: fortify-reports/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  GitLab CI/CD Integration
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .gitlab-ci.yml
stages:
  - test
  - security

fortify_sast:
  stage: security
  image: node:18
  before_script:
    - apt-get update &amp;amp;&amp;amp; apt-get install -y wget unzip
    - wget https://download.fortify.com/sca/fortify-sca-latest.zip
    - unzip fortify-sca-latest.zip
  script:
    - npm ci
    - ./fortify-sca/bin/sourceanalyzer -b $CI_PIPELINE_ID -clean
    - ./fortify-sca/bin/sourceanalyzer -b $CI_PIPELINE_ID **/*.js
    - ./fortify-sca/bin/fortifyclient start scan -b $CI_PIPELINE_ID
  artifacts:
    paths:
      - fortify-reports/
    when: always
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Best Practices for SAST Implementation
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Regular Scanning Schedule&lt;/li&gt;
&lt;li&gt;Pre-commit hooks: Scan before each commit&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Nightly builds: Comprehensive scans during off-hours&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Release gates: Mandatory scans before production deployment&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Tuning &amp;amp; Customization
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Custom rule pack configuration
com.fortify.sca.CustomRules.Path=/path/to/custom/rules.xml
com.fortify.sca.SuppressionFilter.Path=/path/to/false-positives.xml
com.fortify.sca.Severity.Threshold=Medium
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Developer Education&lt;/li&gt;
&lt;li&gt;Remediation workshops: How to fix identified issues&lt;/li&gt;
&lt;li&gt;Secure coding training: Preventing vulnerabilities at source&lt;/li&gt;
&lt;li&gt;Knowledge sharing: Internal security champions program&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Comparison with Other SAST Tools
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Fortify SCA&lt;/th&gt;
&lt;th&gt;Checkmarx&lt;/th&gt;
&lt;th&gt;CodeQL&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Language Support&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;25+ languages&lt;/td&gt;
&lt;td&gt;25+ languages&lt;/td&gt;
&lt;td&gt;10+ languages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Analysis Depth&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Deep flow analysis&lt;/td&gt;
&lt;td&gt;Flow analysis&lt;/td&gt;
&lt;td&gt;Semantic analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Integration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Extensive CI/CD plugins&lt;/td&gt;
&lt;td&gt;Good integration&lt;/td&gt;
&lt;td&gt;GitHub native&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Learning Curve&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Moderate to steep&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Reporting&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Enterprise-grade&lt;/td&gt;
&lt;td&gt;Comprehensive&lt;/td&gt;
&lt;td&gt;GitHub-focused&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Common Challenges &amp;amp; Solutions
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Challenge&lt;/th&gt;
&lt;th&gt;Solution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;False Positives&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Create suppression filters for known false positives&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Long Scan Times&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Implement incremental scanning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Complex Setup&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Use containerized deployment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;High Resource Usage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Optimize scan configurations and schedule off-hours&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Developer Resistance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Provide training and integrate smoothly into workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h4&gt;
  
  
  Challenge 1: False Positives
&lt;/h4&gt;

&lt;p&gt;Solution: Create suppression filters for known false positives&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- false-positives.xml --&amp;gt;
&amp;lt;SuppressionFilters&amp;gt;
  &amp;lt;Suppress&amp;gt;
    &amp;lt;RuleID&amp;gt;CWE-78&amp;lt;/RuleID&amp;gt;
    &amp;lt;File&amp;gt;.*legacy-code\.js&amp;lt;/File&amp;gt;
  &amp;lt;/Suppress&amp;gt;
&amp;lt;/SuppressionFilters&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Challenge 2: Long Scan Times
&lt;/h4&gt;

&lt;p&gt;Solution: Implement incremental scanning&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## Only scan changed files
sourceanalyzer -b myApp -incremental
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Challenge 3: Complex Setup
&lt;/h4&gt;

&lt;p&gt;Solution: Use containerized deployment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Dockerfile for Fortify SCA
FROM node:18
RUN wget https://download.fortify.com/sca/fortify-sca-latest.zip
RUN unzip fortify-sca-latest.zip
COPY . /app
WORKDIR /app
CMD ["./run-fortify-scan.sh"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Fortify Static Code Analyzer provides robust security scanning for applications across multiple programming languages. While it requires initial setup and configuration, its comprehensive vulnerability detection and detailed remediation guidance make it valuable for enterprise security programs.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key takeaways:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;SAST tools like Fortify catch vulnerabilities early in development&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integration with CI/CD pipelines enables automated security testing&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Regular scans and developer education significantly improve application security&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Proper tuning reduces false positives and increases tool effectiveness&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Additional Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;OWASP SAST Tools List&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fortify SCA Documentation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NIST Application Security Guidelines&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Secure Coding Practices Checklist&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>A Real-World Comparison of Testing Management Tools: GitHub Actions vs GitLab CI/CDs</title>
      <dc:creator>Hashira Belén Vargas Candia</dc:creator>
      <pubDate>Thu, 04 Dec 2025 05:20:49 +0000</pubDate>
      <link>https://forem.com/hashiravc/a-real-world-comparison-of-testing-management-tools-github-actions-vs-gitlab-cicds-52g</link>
      <guid>https://forem.com/hashiravc/a-real-world-comparison-of-testing-management-tools-github-actions-vs-gitlab-cicds-52g</guid>
      <description>&lt;p&gt;Article by: Hashira Belén Vargas Candia&lt;br&gt;
Systems Engineering Student – CI/CD &amp;amp; DevOps Focus&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
In modern software development, continuous integration and delivery (CI/CD) are essential for ensuring code quality and fast deployments. Automated testing tools allow test suites to run automatically with every code change. In this article, I will compare two of the most popular tools: GitHub Actions and GitLab CI/CD, providing real configuration examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub Actions&lt;/strong&gt;&lt;br&gt;
Overview&lt;br&gt;
GitHub Actions is the native CI/CD solution integrated directly into GitHub. It allows workflow automation using YAML files in the .github/workflows directory. It is highly flexible, with a marketplace of pre-built actions and support for Docker containers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Configuration&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .github/workflows/run-tests.yml
name: Run Tests

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '18'

    - name: Install dependencies
      run: npm ci

    - name: Run unit tests
      run: npm test

    - name: Run integration tests
      run: npm run test:integration

    - name: Upload coverage reports
      uses: codecov/codecov-action@v3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;GitLab CI/CD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Overview&lt;br&gt;
GitLab CI/CD is the continuous integration tool included within the GitLab platform. It is configured using a .gitlab-ci.yml file in the repository root. It offers visual pipelines, deployment environments, and deep integration with the DevOps lifecycle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Configuration&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .gitlab-ci.yml
stages:
  - test
  - deploy

unit_tests:
  stage: test
  image: node:18-alpine
  script:
    - npm ci
    - npm test
  artifacts:
    when: always
    paths:
      - coverage/
    reports:
      junit: junit.xml

integration_tests:
  stage: test
  image: node:18-alpine
  services:
    - postgres:latest
  variables:
    POSTGRES_DB: test_db
    POSTGRES_USER: runner
    POSTGRES_PASSWORD: ""
  script:
    - npm ci
    - npm run test:integration

pages:
  stage: deploy
  script:
    - npm run build:coverage
  artifacts:
    paths:
      - public
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Detailed Comparison&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;GitHub Actions&lt;/th&gt;
&lt;th&gt;GitLab CI/CD&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Native Integration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;With GitHub (perfect if you use GitHub)&lt;/td&gt;
&lt;td&gt;With GitLab (complete DevOps ecosystem)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Configuration Syntax&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;YAML with reusable actions&lt;/td&gt;
&lt;td&gt;YAML with defined stages and jobs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Marketplace/Pre-built Actions&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Extensive GitHub Marketplace&lt;/td&gt;
&lt;td&gt;Reusable templates and components&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Visual Environments&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Basic but functional&lt;/td&gt;
&lt;td&gt;More detailed visual pipelines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pricing for Private Repos&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2000 free minutes/month&lt;/td&gt;
&lt;td&gt;400 free minutes/month on SaaS free tier&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Self-hosted Runners&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Yes (runners)&lt;/td&gt;
&lt;td&gt;Yes (GitLab runners)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cache and Artifacts&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Built-in support&lt;/td&gt;
&lt;td&gt;Very robust with configurable storage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kubernetes Integration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Yes (via actions)&lt;/td&gt;
&lt;td&gt;Native and very strong&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Real-World Use Case: Testing Pipeline for a REST API&lt;/strong&gt;&lt;br&gt;
Context&lt;br&gt;
I developed a REST API with Node.js/Express that requires:&lt;/p&gt;

&lt;p&gt;Unit tests (Jest)&lt;/p&gt;

&lt;p&gt;Integration tests with PostgreSQL&lt;/p&gt;

&lt;p&gt;Load testing (optional)&lt;/p&gt;

&lt;p&gt;Coverage reports&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub Actions Solution&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- name: Run load tests
  if: github.ref == 'refs/heads/main'
  run: |
    npm install -g artillery
    artillery run load-test.yml
GitLab CI/CD Solution
yaml
performance_tests:
  stage: test
  only:
    - main
  script:
    - npm install -g artillery
    - artillery run load-test.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both tools allow running load tests only on the main branch, optimizing resource usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tool Selection Recommendations
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Choose GitHub Actions if:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Your repository is already on GitHub&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You need integration with many third-party tools*&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You prefer a community-driven actions ecosystem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your team is small to medium and values simplicity&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Choose GitLab CI/CD if:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You already use GitLab for repository management&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You need a complete DevOps pipeline (from issues to deploy)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You require native integration with Kubernetes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You work in a large team with auditing and security needs&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Both GitHub Actions and GitLab CI/CD are powerful tools for test automation. The choice mainly depends on where your code is hosted and your specific DevOps workflow needs.&lt;/p&gt;

&lt;p&gt;GitHub Actions stands out for its simplicity and vast action ecosystem, while GitLab CI/CD offers deeper integration with the full development lifecycle. Both enable robust, scalable, and maintainable testing pipelines.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>ci</category>
      <category>continuousdelivery</category>
      <category>automation</category>
    </item>
    <item>
      <title>Applying API Testing Frameworks: Real-World Examples with Swagger and JUnit</title>
      <dc:creator>Hashira Belén Vargas Candia</dc:creator>
      <pubDate>Tue, 04 Nov 2025 07:11:07 +0000</pubDate>
      <link>https://forem.com/hashiravc/the-future-of-machine-learning-in-api-testing-a-new-era-of-automation-260h</link>
      <guid>https://forem.com/hashiravc/the-future-of-machine-learning-in-api-testing-a-new-era-of-automation-260h</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In today's software development landscape, APIs (Application Programming Interfaces) are essential for enabling communication between different systems. Ensuring that these APIs function correctly is crucial, which is why &lt;strong&gt;API testing&lt;/strong&gt; is an integral part of the development process.&lt;/p&gt;

&lt;p&gt;This article explores how to apply &lt;strong&gt;API testing frameworks&lt;/strong&gt; in real-world scenarios, using &lt;strong&gt;Swagger&lt;/strong&gt; and &lt;strong&gt;JUnit&lt;/strong&gt; as examples. These frameworks help automate and streamline the testing process, ensuring that APIs are functional, secure, and performant.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an API Testing Framework?
&lt;/h2&gt;

&lt;p&gt;An &lt;strong&gt;API testing framework&lt;/strong&gt; is a set of tools, libraries, and processes that facilitate the testing of APIs. The goal of such a framework is to standardize the testing process, making it easier to write, run, and maintain tests for APIs across different endpoints and services.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of Using an API Testing Framework:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automation&lt;/strong&gt;: Reduces manual effort by automating repetitive tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consistency&lt;/strong&gt;: Ensures uniformity in testing across various API endpoints.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Makes it easier to scale tests as the system grows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration&lt;/strong&gt;: Can be integrated into Continuous Integration (CI) and Continuous Deployment (CD) pipelines for continuous testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Using Swagger for API Testing
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Swagger&lt;/strong&gt; (now known as &lt;strong&gt;OpenAPI&lt;/strong&gt;) is one of the most widely used frameworks for defining and testing APIs. It allows developers to define their APIs in a standardized format, which can then be used for documentation and testing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 1: Testing API with Swagger
&lt;/h3&gt;

&lt;p&gt;To test an API with Swagger, first define the API endpoints in a &lt;strong&gt;Swagger&lt;/strong&gt; (OpenAPI) specification file. Here's a simple example of how a user API might be defined in &lt;strong&gt;Swagger&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;openapi&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;3.0.0&lt;/span&gt;
&lt;span class="na"&gt;info&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;User API&lt;/span&gt;
  &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;API for managing users in a system&lt;/span&gt;
  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;1.0.0&lt;/span&gt;
&lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;/users/{id}&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;summary&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Get a user by ID&lt;/span&gt;
      &lt;span class="na"&gt;parameters&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;in&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;path&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;id&lt;/span&gt;
          &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
          &lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;integer&lt;/span&gt;
            &lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
      &lt;span class="na"&gt;responses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;200&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;User found&lt;/span&gt;
          &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;application/json&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;object&lt;/span&gt;
                &lt;span class="na"&gt;properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;integer&lt;/span&gt;
                  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;string&lt;/span&gt;
                &lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
                  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;John&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Doe"&lt;/span&gt;
        &lt;span class="na"&gt;404&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;User not found&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this Swagger file, we've defined a GET request to retrieve a user by their ID.&lt;/p&gt;

&lt;h1&gt;
  
  
  Testing with Swagger Inspector
&lt;/h1&gt;

&lt;p&gt;You can use Swagger Inspector to validate the API by running tests directly from the Swagger specification.&lt;/p&gt;

&lt;p&gt;To use Swagger Inspector, simply enter the Swagger URL or upload the Swagger JSON/YAML file, and it will generate test requests for each defined endpoint.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using JUnit and RestAssured for API Testing in Java
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JUnit&lt;/strong&gt; is one of the most widely used testing frameworks for Java. When combined with RestAssured, a library designed for testing REST APIs, JUnit provides a powerful solution for testing APIs in Java.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 2: Testing an API with JUnit and RestAssured
&lt;/h3&gt;

&lt;p&gt;First, add RestAssured and JUnit to your pom.xml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;io.rest-assured&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;rest-assured&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;4.3.3&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;test&lt;span class="nt"&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.junit.jupiter&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;junit-jupiter-api&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;5.7.0&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;scope&amp;gt;&lt;/span&gt;test&lt;span class="nt"&gt;&amp;lt;/scope&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's write a simple JUnit test to verify the GET request for the /users/{id} endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;io.restassured.RestAssured&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.junit.jupiter.api.Test&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;static&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hamcrest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;Matchers&lt;/span&gt;&lt;span class="o"&gt;.*;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserApiTest&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@Test&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;testGetUser&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;RestAssured&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;baseURI&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"https://reqres.in/api"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Base URL&lt;/span&gt;

        &lt;span class="nc"&gt;RestAssured&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;given&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pathParam&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"id"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Path parameter&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;when&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/users/{id}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// GET request to /users/{id}&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Assert that the status code is 200 (OK)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"data.id"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;equalTo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// Validate that the ID is 1&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"data.first_name"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;equalTo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"George"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Validate first_name&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RestAssured&lt;/strong&gt; is used to send a &lt;strong&gt;GET&lt;/strong&gt; request to the /users/{id} endpoint.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;JUnit&lt;/strong&gt; is used to validate that the response code is 200 and that the returned ID and first_name match the expected values.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Running the Test&lt;/strong&gt;&lt;br&gt;
You can run the test using Maven:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will execute the test, and JUnit will validate the response based on the conditions defined in the test.&lt;/p&gt;

&lt;h1&gt;
  
  
  Integrating API Tests into CI/CD Pipelines
&lt;/h1&gt;

&lt;p&gt;Integrating API tests into your CI/CD pipeline ensures that your tests run automatically with each code change. This helps identify issues early in the development process.&lt;/p&gt;

&lt;h1&gt;
  
  
  Integrating with Jenkins
&lt;/h1&gt;

&lt;p&gt;To run the JUnit tests in Jenkins, you can add the following steps to your Jenkinsfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;pipeline&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="n"&gt;any&lt;/span&gt;
    &lt;span class="n"&gt;stages&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Build'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'mvn clean install'&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Test'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'mvn test'&lt;/span&gt; &lt;span class="c1"&gt;// Run JUnit tests&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This Jenkins pipeline will trigger the JUnit tests automatically every time code is committed to your repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running Swagger Tests in CI/CD
&lt;/h3&gt;

&lt;p&gt;You can also integrate Swagger Inspector in a CI/CD pipeline by calling the Swagger API using a curl command in your pipeline to validate the API against your Swagger definitions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Best Practices for API Testing
&lt;/h1&gt;

&lt;p&gt;When applying frameworks for API testing, consider the following best practices:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Organize Your Tests&lt;/strong&gt;: Group your tests by API category or functionality for easier maintenance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Data-Driven Testing&lt;/strong&gt;: Test different data sets to ensure the API behaves correctly with a variety of inputs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mock APIs&lt;/strong&gt;: Use mock servers to simulate APIs during testing, especially when the actual API is not available.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automate Your Tests&lt;/strong&gt;: Automate your API tests and integrate them into the CI/CD pipeline for continuous testing.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;API testing is an essential part of ensuring the functionality, security, and performance of your APIs. By using Swagger for API documentation and JUnit with RestAssured for testing, you can streamline the testing process and ensure that your APIs are thoroughly tested.&lt;/p&gt;

&lt;p&gt;Integrating these tools into your CI/CD pipeline allows for continuous testing, ensuring your APIs remain reliable and meet the expected requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://swagger.io/docs/" rel="noopener noreferrer"&gt;Swagger Documentation&lt;/a&gt;&lt;br&gt;
&lt;a href="https://junit.org/" rel="noopener noreferrer"&gt;JUnit 5 Documentation&lt;/a&gt;&lt;br&gt;
&lt;a href="https://rest-assured.io/" rel="noopener noreferrer"&gt;RestAssured Documentation&lt;/a&gt;&lt;br&gt;
&lt;a href="https://alicealdaine.medium.com/top-10-api-testing-tools-rest-soap-services-5395cb03cfa9" rel="noopener noreferrer"&gt;Top 15 API Testing Tools in 2022&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>api</category>
    </item>
  </channel>
</rss>
