Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Enables folder-based test organization with multiple testing methods (static, dynamic, network) per test, maintaining backward compatibility with flat file structure.

Changes

  • New hook: inject-test-methods.py

    • Scans for method-*.md files in test directories
    • Extracts type from frontmatter and injects content before "## Evaluation" section
    • Generates "## Method N - {Type}" headings automatically
    • Updates page metadata with aggregated types from all methods
    • Priority -35 (after ID extraction, before content processing)
  • Navigation pattern update in mkdocs.yml

    • Changed from /*.md to /**/MASTG-TEST-*.md for all test categories
    • Matches both flat (MASTG-TEST-0202.md) and folder-based (MASTG-TEST-0202/MASTG-TEST-0202.md) structures

Structure Example

MASTG-TEST-0202/
  ├── MASTG-TEST-0202.md    # Main test file with Overview and Evaluation
  ├── method-1.md           # type: static
  ├── method-2.md           # type: dynamic
  └── method-3.md           # type: network

Each method file contains frontmatter with type and markdown content with ## Steps and ## Observation sections. The hook injects all methods before the Evaluation section in the main test file.

Technical Details

  • Regex pattern supports Windows/Unix line endings: r'^---\s*(?:\r?\n)(.*?)(?:\r?\n)---\s*(?:\r?\n)(.*)$'
  • Specific exception handling for UnicodeDecodeError, PermissionError, and OSError
  • Type display mapping: static → Static Analysis, dynamic → Dynamic Analysis, network → Network Analysis
  • Falls back gracefully when no "## Evaluation" section exists (appends at end)
Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for folder-based MASTG-TEST</issue_title>
<issue_description>Currently, tests in tests-beta/ are structured like OWASP/mastg/tests-beta/**/**/MASTG-TEST-****.md.

We need to update this to OWASP/mastg/tests-beta/**/**/MASTG-TEST-****/MASTG-TEST-****.md similar to how our demos/ work. But still support OWASP/mastg/tests-beta/**/**/MASTG-TEST-****.md for backwards compatibility for now.

In addition to that, tests in the MASTG-TEST-****/ folders will support one or more testing methods.

Each method is a method-*.md file (e.g. method-1.md, method-2.md, etc.)

---
platform: android
type: static
---

Some intro...

## Steps

...

## Observation

...

The automation will inject any existing methods into the main MASTG-TEST-****.md file before the Evaluation section.

---
platform: android
title: References to APIs and Permissions for Accessing External Storage
id: MASTG-TEST-0202
...
type: [<<add unique list of types from methods>>]
---

## Overview

...

<<inject methods here>>

## Evaluation

...

Example:

ls OWASP/mastg/tests-beta/android/MASVS-STORAGE/MASTG-TEST-0202/
MASTG-TEST-0202.md
method-1.md
method-2.md
method-3.md
method-4.md

Would render as:

---
platform: android
title: References to APIs and Permissions for Accessing External Storage
id: MASTG-TEST-0202
...
type: [static]
---

## Overview

...

## Method 1 - Static Analysis

Some intro...

### Steps

...

### Observation

...

## Method 2 - Static Analysis

Some intro...

### Steps

...

### Observation

...

## Method 3 - Dynamic Analysis

Some intro...

### Steps

...

### Observation

...

## Method 4 - Network Analysis

Some intro...

### Steps

...

### Observation

...

## Evaluation

...
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add support for folder-based MASTG-TEST structure Add folder-based structure support for MASTG-TEST files with method injection Dec 9, 2025
Copilot AI requested a review from cpholguera December 9, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for folder-based MASTG-TEST

2 participants