ATT&CK Data Model (ADM): A TypeScript library for structured interaction with MITRE ATT&CK datasets. Uses Zod schemas, TypeScript types, and ES6 classes to provide a type-safe, object-oriented interface for STIX 2.1 formatted ATT&CK data. Features parsing, validation, and serialization capabilities.
This issue outlines the process for writing comprehensive test suites for ATT&CK schemas using Jest. Each developer will be assigned one or more schemas to test. Follow these instructions to ensure consistent and thorough testing across all schemas.
Assignments
Schema Module
Assigned To
Status
Reviewer
campaign.schema.ts
@adpare
Done
@seansica
matrix.schema.ts
@erinehall
Done
@seansica
group.schema.ts
@erinehall
Done
@seansica
collection.schema.ts
@adpare
Done
@seansica
tactic.schema.ts
@adpare
Done
@seansica
technique.schema.ts
@seansica
Done
@seansica
asset.schema.ts
@clemiller
Done
@seansica
tool.schema.ts
@adpare
Done
@seansica
malware.schema.ts
@adpare
Done
@seansica
identity.schema.ts
@adpare
Done
@seansica
mitigation.schema.ts
@erinehall
Done
@seansica
marking-definition.schema.ts
@erinehall
Done
@seansica
data-source.schema.ts
@adpare
Done
@seansica
data-component.schema.ts
@adpare
Done
@seansica
relationship.schema.ts (sro)
@clemiller
Done
@seansica
stix-bundle.schema.ts
@seansica
Done
@seansica
Test Structure
Use the following template for your test suite: template.test.ts
Test Categories Explanation
True Positives Tests
These tests ensure that the schema accepts valid inputs. Include tests for:
Minimal valid object (only required fields)
Fully populated valid object (all fields, including optional ones)
Edge cases with valid data
True Negative Tests
These tests ensure that the schema rejects invalid inputs. For each property explicitly defined in the schema:
Create a describe block
Test invalid values
Test omission of required fields
Also include schema-level tests, such as rejecting unknown properties.
Edge Cases and Special Scenarios
Create an it test for each case covered in the schema refinements (e.g., refine or superRefine). These tests should cover any complex validation logic specific to the schema.
Validate All Objects
This section tests the schema against all objects in the global.attackData.objectsByType array for the specific object type.
Instructions
Create a new test file for your assigned schema(s) named [schema-name].test.ts.
Copy the template above and adapt it to your specific schema.
Implement tests for each category as described.
Ensure all tests pass and provide good coverage of the schema.
Tips
Use real ATT&CK data from global.attackData when possible.
For True Negative tests, start with a valid object and modify it to be invalid.
Pay special attention to any refine or superRefine logic in the schema.
If you're unsure about a test case, ask for clarification.
ATT&CK Schema Testing Guide
Overview
This issue outlines the process for writing comprehensive test suites for ATT&CK schemas using Jest. Each developer will be assigned one or more schemas to test. Follow these instructions to ensure consistent and thorough testing across all schemas.
Assignments
Test Structure
Use the following template for your test suite: template.test.ts
Test Categories Explanation
True Positives Tests
These tests ensure that the schema accepts valid inputs. Include tests for:
True Negative Tests
These tests ensure that the schema rejects invalid inputs. For each property explicitly defined in the schema:
describe
blockAlso include schema-level tests, such as rejecting unknown properties.
Edge Cases and Special Scenarios
Create an
it
test for each case covered in the schema refinements (e.g.,refine
orsuperRefine
). These tests should cover any complex validation logic specific to the schema.Validate All Objects
This section tests the schema against all objects in the
global.attackData.objectsByType
array for the specific object type.Instructions
[schema-name].test.ts
.Tips
global.attackData
when possible.refine
orsuperRefine
logic in the schema.