Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: technical interoperability testing #2

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{
"root": true,
"plugins": [
"@typescript-eslint",
"prettier"
],
"plugins": ["@typescript-eslint", "prettier"],
"ignorePatterns": ["documentation"],
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parserOptions": {
"project": [
"./packages/tsconfig.settings.json",
"./packages/*/tsconfig.json"
]
"project": ["./packages/tsconfig.settings.json", "./packages/*/tsconfig.json"]
},
"rules": {
"no-console": "warn",
Expand All @@ -30,9 +25,7 @@
},
"overrides": [
{
"files": [
"*.js"
],
"files": ["*.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
name: Deploy to GitHub Pages

on:
push:
pull_request:
branches:
- main
- next

jobs:
deploy:
Expand Down
24 changes: 24 additions & 0 deletions documentation/docs/test-suites/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
sidebar_position: 1
title: Test Suites
---

import Disclaimer from '../\_disclaimer.mdx';

<Disclaimer />

The UNTP Test Suite comprises three test suites:

1. [**Technical Interoperability**](/docs/test-suites/technical-interoperability): Validates the technical aspects of implementations against UNTP protocol requirements.

2. [**Semantic Interoperability**](/docs/test-suites/semantic-interoperability): Ensures credentials produced by an implementation are semantically consistent with the UNTP protocol, allowing for conformance while permitting extensions.

3. **Graph Validation**: Assesses the entire trust graph produced by an implementation, verifying the integrity and validity of relationships.

The Test Suite follows a tiered approach:

- [**Tier 1**](/docs/test-suites/technical-interoperability): Technical interoperability
- [**Tier 2**](/docs/test-suites/semantic-interoperability): Semantic interoperability
- **Tier 3**: Graph validation

This structure enables progressive validation of UNTP implementations. The Semantic Interoperability and Graph Validation components are extensible, allowing customisation for specific industry needs whilst maintaining core UNTP compliance.
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
sidebar_position: 5
title: Configuration
---

import Disclaimer from './../../../\_disclaimer.mdx';

<Disclaimer />

Before proceeding, we need to create the configuration file. The Tier 2 test suite config file defines the credentials being tested, the schema version to test against, and the location of the credential being tested.

## Generating the configuration file

To generate the configuration file, run the following command:

```bash
yarn run untp config
```

This will create a base configuration file named `credentials.json` in the base directory of the Tier 2 test suite folder: `tests-untp/packages/untp-test-suite/credentials.json`.

## Structure of the configuration file

The generated configuration file will have the following structure:

```json
{
"credentials": [
{
"type": "aggregationEvent",
"version": "v0.0.1",
"dataPath": ""
},
{
"type": "conformityCredential",
"version": "v0.0.1",
"dataPath": ""
},
{
"type": "objectEvent",
"version": "v0.0.1",
"dataPath": ""
},
{
"type": "productPassport",
"version": "v0.0.1",
"dataPath": ""
},
{
"type": "transactionEvent",
"version": "v0.0.1",
"dataPath": ""
},
{
"type": "transformationEvent",
"version": "v0.0.1",
"dataPath": ""
}
]
}
```

### Credentials
The value of the credentials property is an array of objects containing information about the credential type (corresponding to a schema), the credential schema version, and the location of the credential to be tested.

### Schema and version structure

The schemas used in the test suite are located in the following directory structure:

```
packages/
└── untp-test-suite/
└── src/
└── schemas/
β”œβ”€β”€ aggregationEvent/
β”‚ └── v0.0.1/
β”‚ └── schema.json
β”œβ”€β”€ conformityCredential/
β”‚ └── v0.0.1/
β”‚ └── schema.json
β”œβ”€β”€ objectEvent/
β”‚ └── v0.0.1/
β”‚ └── schema.json
β”œβ”€β”€ productPassport/
β”‚ └── v0.0.1/
β”‚ └── schema.json
β”œβ”€β”€ transactionEvent/
β”‚ └── v0.0.1/
β”‚ └── schema.json
└── transformationEvent/
└── v0.0.1/
└── schema.json
```

### Type
The `type` property value corresponds to the folder name within the `src/schemas` directory of the test suite. This allows logical grouping of schema versions. For example, `"type": "aggregationEvent"` corresponds to the `aggregationEvent` folder.

### Version
The `version` property value corresponds to the folder name within the respective credential type folder. For example, `"version": "v0.0.1"` corresponds to the `v0.0.1` folder within the credential type folder.

### Data Path

The `dataPath` value is the relative location of the credential you want to test against the schema type and version.

## Adding test credentials

To test credentials developed or produced by a UNTP implementation against the core UNTP data model:

1. Create a directory to store the credentials you want to test:

```bash
cd packages/untp-test-suite
mkdir credentials
```

2. Add the credentials you want to test to the directory created in the previous step. The files should have unique names and be in JSON format:

```
packages/
└── untp-test-suite/
β”œβ”€β”€ credentials/
β”œβ”€β”€ aggregationEvent-sample.json
β”œβ”€β”€ conformityCredential-sample.json
β”œβ”€β”€ objectEvent-sample.json
β”œβ”€β”€ productPassport-sample.json
β”œβ”€β”€ transactionEvent-sample.json
└── transformationEvent-sample.json
```

3. Update the config file to point to the location of the credential you want to test within the corresponding object and save the file:

```json
{
"credentials": [
{
"type": "aggregationEvent",
"version": "v0.0.1",
"dataPath": "credentials/aggregationEvent-sample.json"
},
{
"type": "conformityCredential",
"version": "v0.0.1",
"dataPath": "credentials/conformityCredential-sample.json"
},
{
"type": "objectEvent",
"version": "v0.0.1",
"dataPath": "credentials/objectEvent-sample.json"
},
{
"type": "productPassport",
"version": "v0.0.1",
"dataPath": "credentials/productPassport-sample.json"
},
{
"type": "transactionEvent",
"version": "v0.0.1",
"dataPath": "credentials/transactionEvent-sample.json"
},
{
"type": "transformationEvent",
"version": "v0.0.1",
"dataPath": "credentials/transformationEvent-sample.json"
}
]
}
```

You have now successfully configured the Tier 2 test suite to test your credentials against the core UNTP data model.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
sidebar_position: 7
title: Extensions
---

import Disclaimer from './../../../_disclaimer.mdx';

<Disclaimer />

The [United Nations Transparency Protocol (UNTP)](https://uncefact.github.io/spec-untp/) allows for extensions to its core data model. The UNTP Semantic Interoperability Test Suite can validate these extensions, ensuring they remain compliant with the core UNTP data model. This enables implementors to prototype and test custom credential types or additional properties while maintaining conformance with the UNTP protocol.

## Adding a Custom Schema

1. Create a new directory for your schema:

```
packages/
└── untp-test-suite/
└── src/
└── schemas/
└── myCustomCredential/
└── v0.0.1/
└── schema.json
```

2. Define your schema in `schema.json`, extending the core UNTP model as needed.

3. Update `credentials.json` to include your new credential type:

```json
{
"credentials": [
// ... existing credentials
{
"type": "myCustomCredential",
"version": "v0.0.1",
"dataPath": "credentials/myCustomCredential-sample.json"
}
]
}
```

4. Create a sample credential file matching your schema.

5. Run the test suite to validate your extended credential:

```bash
yarn run untp test
```

By following these steps, you can prototype extensions to the UNTP data model while ensuring compatibility with the core specification.

Remember to thoroughly test your extensions and consider submitting valuable additions to the [UNTP community](https://github.com/uncefact/tests-untp) for potential inclusion in future versions of the protocol or submit your extension to the [extensions register](https://uncefact.github.io/spec-untp/docs/extensions).
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
sidebar_position: 3
title: CLI
---

import Disclaimer from './../../../\_disclaimer.mdx';

<Disclaimer />

The [United Nations Transparency Protocol (UNTP)](https://uncefact.github.io/spec-untp/) Semantic Interoperability Test Suite CLI is a powerful tool designed for rapid validation of credentials produced by UNTP implementers and implementations. This suite ensures that the credentials comply with the core UNTP data model, making it an essential resource for developers, organisations and communities working with the UNTP protocol.

## Key Features

- **Rapid Validation**: Quickly verify the compliance of UNTP credentials with the core data model.
- **Prototype Testing**: Ideal for credential development, allowing you to prototype and test extensions to the UNTP protocol.
- **Flexibility**: Suitable for both implementation testing and exploratory development.

By the end of this section, you will have a solid understanding of how to install, configure and use the CLI to validate UNTP credentials. You will be familiar with the configuration file structure, available commands and how to test your extensions against the core UNTP data model.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
sidebar_position: 4
title: Installation
---

import Disclaimer from './../../../\_disclaimer.mdx';

<Disclaimer />

Before you begin installing the Tier 2 test suite CLI, ensure that you have the following prerequisites in place:

### Prerequisites

1. Clone the repository:
```
git clone https://github.com/uncefact/tests-untp.git
```

2. Node.js version 20.12.2: Make sure you have Node.js version 20.12.2 installed on your system. You can download it from the official Node.js website: [https://nodejs.org](https://nodejs.org)

3. Yarn version 1.22.17: Ensure that you have Yarn version 1.22.17 installed. You can install it by running the following command:
```
npm install -g [email protected]
```

### Installation Steps

Once you have met the prerequisites, follow these steps to install the dependencies:

1. Navigate to the cloned repository directory:
```
cd tests-untp/packages/untp-test-suite
```

2. Install the dependencies using Yarn:
```
yarn install
```

3. Build the test suite:
```
yarn build
```

After completing these steps, you will have all the necessary dependencies installed.

In the next section, we will initialise and explore the configuration file for the test suite.
Loading
Loading