prosberry/specs/001-add-blog/research.md

2.1 KiB

Research: Testing Approaches for Blog Feature

Decision: Testing Frameworks and Approaches

Shell Script Testing (posodobi_blog.sh)

  • Decision: Utilize Bats-core for unit testing the posodobi_blog.sh script.
  • Rationale: Bats-core is a lightweight, TAP-compliant testing framework specifically designed for Bash scripts. Its simplicity and clear syntax make it suitable for ensuring the correctness of the posodobi_blog.sh script's logic, including file parsing, sorting, and HTML generation.
  • Alternatives Considered:
    • ShellSpec: A BDD-style framework, potentially overkill for this script's complexity.
    • ShUnit2: A xUnit-style framework, also a good option, but Bats-core's TAP output is often easier to integrate into CI/CD.

Static Site Testing (Generated Blog Pages)

  • Decision: Implement a combination of HTML/CSS/JS Linting/Validation and Link Checking.
  • Rationale: For a static website, ensuring valid markup, consistent styling, and functional navigation are key quality indicators.
    • Linting/Validation: Leverages existing project linting tools (if any) or standard validators to catch syntax errors and ensure best practices.
    • Link Checking: A simple script can verify that all internal and external links within the generated blog pages are valid, preventing broken navigation.
  • Alternatives Considered:
    • Visual Regression Testing (e.g., BackstopJS, Percy): While valuable, it adds significant setup and maintenance overhead and might be overkill for the initial phase of a static blog, especially given the existing site's visual consistency is expected to be maintained.
    • End-to-End Testing (e.g., Cypress, Selenium): Primarily for dynamic web applications with complex user interactions, which is not the core focus of this static blog.

Resolution of NEEDS CLARIFICATION in Technical Context

  • Testing: Specific testing frameworks/approaches for shell scripts and static site generation will include Bats-core for posodobi_blog.sh and HTML/CSS/JS Linting/Validation along with Link Checking for the generated static pages.