|
1 | | -# 📊 Coverage |
| 1 | +# Coverage — TCK VTL local |
2 | 2 |
|
3 | | -## 🧪 TCK (Technology Compatibility Kit) |
| 3 | +Module Maven qui exécute le **Technology Compatibility Kit (TCK)** VTL v2.1 contre Trevas (moteur + backend Spark). |
4 | 4 |
|
5 | | -We are working on a suite of compatibility tests to ensure conformance with the VTL specification across implementations. |
| 5 | +**Point d’entrée JUnit :** `fr.insee.vtl.coverage.TCKTest` |
| 6 | +**Fichier requis :** `coverage/src/main/resources/v2.1.zip` (non versionné — à générer une fois) |
6 | 7 |
|
7 | | -🛠️ _Work in Progress_ |
| 8 | +--- |
8 | 9 |
|
9 | | -### Issues/discussions to follow |
| 10 | +## Démarrage rapide (depuis la racine du dépôt Trevas) |
10 | 11 |
|
11 | | -- [junit5](https://github.com/junit-team/junit5/discussions/4504#discussioncomment-13046641) |
12 | | -- [surefire](https://github.com/apache/maven-surefire/issues/835) |
13 | | -- [dorny/test-reporter](https://github.com/dorny/test-reporter/issues/580) |
| 12 | +Prérequis : **JDK 17+**, **Maven 3.9+**, **Python 3**, accès réseau (clone GitHub la première fois). |
14 | 13 |
|
15 | | -### Temporary run procedure |
| 14 | +```shell |
| 15 | +# 1) Générer le zip TCK (une fois, ou après mise à jour des exemples SDMX-VTL) |
| 16 | +./coverage/scripts/refresh_tck_zip.sh |
| 17 | + |
| 18 | +# 2) Compiler les modules dont dépend coverage (dont vtl-csv, vtl-spark, vtl-engine…) |
| 19 | +mvn clean install -pl coverage -am -DskipTests --batch-mode |
| 20 | + |
| 21 | +# 3) Lancer le TCK (Spark 3 par défaut) |
| 22 | +mvn test -pl coverage --batch-mode |
| 23 | +``` |
16 | 24 |
|
17 | | -While [TCK](https://github.com/sdmx-twg/vtl/pull/565) is not automated in the VTL TF repository, we have to build the input source manually. |
| 25 | +Vérifier que le zip est bien là avant l’étape 3 : |
18 | 26 |
|
19 | 27 | ```shell |
20 | | -git clone https://github.com/sdmx-twg/vtl.git |
21 | | -cd vtl/scripts |
22 | | -DOC_VERSION=v2.1 python3 generate_tck_files.py |
| 28 | +test -f coverage/src/main/resources/v2.1.zip && echo OK || echo "manquant — relancer refresh_tck_zip.sh" |
23 | 29 | ``` |
24 | 30 |
|
25 | | -A zip will be created at `tck/v2.1.zip`. |
| 31 | +### Spark 4 |
26 | 32 |
|
27 | | -Move it in Trevas resources: |
| 33 | +```shell |
| 34 | +mvn clean install -pl coverage -am -DskipTests --batch-mode -Pspark4-tck |
| 35 | +mvn test -pl coverage --batch-mode -Pspark4-tck |
| 36 | +``` |
| 37 | + |
| 38 | +### Rapport lisible après les tests |
28 | 39 |
|
29 | 40 | ```shell |
30 | | -mv vtl/tck/v2.1.zip trevas/coverage/src/main/resources |
| 41 | +python3 coverage/scripts/prettify_tck_surefire_xml.py |
| 42 | +python3 coverage/scripts/render_tck_job_summary.py |
| 43 | +# → coverage/target/tck-scripts-report.md |
31 | 44 | ``` |
32 | 45 |
|
33 | | -You are now able to run `TCKTest`. |
| 46 | +XML Surefire principal : `coverage/target/surefire-reports/TEST-fr.insee.vtl.coverage.TCKTest.xml` |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Pourquoi `mvn test -pl coverage` seul échoue souvent |
| 51 | + |
| 52 | +| Symptôme | Cause | Correctif | |
| 53 | +|----------|--------|-----------| |
| 54 | +| `FileNotFoundException` / zip introuvable | Pas de `v2.1.zip` | `./coverage/scripts/refresh_tck_zip.sh` | |
| 55 | +| `ClassNotFoundException: fr.insee.vtl.csv.CsvDatasetValidator` | Module `vtl-csv` non installé | `mvn install -pl vtl-csv -am -DskipTests` ou **toujours** utiliser `-am` avec `coverage` | |
| 56 | +| Tests TCK absents / 0 test | Classpath incomplet | `mvn clean install -pl coverage -am -DskipTests` puis `mvn test -pl coverage` | |
| 57 | + |
| 58 | +**Règle :** pour `coverage`, utiliser **`-pl coverage -am`** (`-am` = *also make* : construit tous les modules requis du réacteur, dont `vtl-csv`). |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## D’où vient le TCK ? |
| 63 | + |
| 64 | +Les cas sont extraits des exemples du manuel VTL SDMX |
| 65 | +(`v2.1/docs/reference_manual/operators/**/examples`). |
| 66 | + |
| 67 | +Branche Git pinée (fixtures CSV/JSON corrigées) : **`fix/doc-examples`** |
| 68 | +https://github.com/sdmx-twg/vtl/tree/fix/doc-examples |
| 69 | + |
| 70 | +Le script local reproduit ce que fait la CI : |
| 71 | + |
| 72 | +```shell |
| 73 | +./coverage/scripts/refresh_tck_zip.sh |
| 74 | +``` |
| 75 | + |
| 76 | +→ clone `sdmx-twg/vtl`, exécute `scripts/generate_tck_files.py`, copie `tck/v2.1.zip` vers `coverage/src/main/resources/v2.1.zip`. |
| 77 | + |
| 78 | +Variables optionnelles : |
| 79 | + |
| 80 | +```shell |
| 81 | +VTL_TCK_BRANCH=fix/doc-examples ./coverage/scripts/refresh_tck_zip.sh |
| 82 | +DOC_VERSION=v2.1 VTL_TCK_BRANCH=master ./coverage/scripts/refresh_tck_zip.sh |
| 83 | +``` |
| 84 | + |
| 85 | +### Génération manuelle (équivalent) |
| 86 | + |
| 87 | +```shell |
| 88 | +git clone --depth 1 --branch fix/doc-examples https://github.com/sdmx-twg/vtl.git /tmp/vtl-tck |
| 89 | +DOC_VERSION=v2.1 python3 /tmp/vtl-tck/scripts/generate_tck_files.py |
| 90 | +mkdir -p coverage/src/main/resources |
| 91 | +cp /tmp/vtl-tck/tck/v2.1.zip coverage/src/main/resources/v2.1.zip |
| 92 | +``` |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## Lancer un sous-ensemble (debug) |
| 97 | + |
| 98 | +```shell |
| 99 | +# un seul cas (adapter le nom affiché dans les logs / XML) |
| 100 | +mvn test -pl coverage -Dtest='TCKTest#leafCases' --batch-mode |
| 101 | + |
| 102 | +# tests unitaires du module coverage (hors TCK long) |
| 103 | +mvn test -pl coverage -Dtest='!TCKTest' --batch-mode |
| 104 | +``` |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +## CI |
| 109 | + |
| 110 | +Workflows : `.github/workflows/tck-vtl-tf-spark3.yml`, `tck-vtl-tf-spark4.yml` |
| 111 | + |
| 112 | +En résumé : checkout Trevas → génération `v2.1.zip` → `mvn clean install -pl coverage -am -DskipTests` → `mvn test -pl coverage` → rapport Surefire / résumé Markdown. |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## Liens |
| 117 | + |
| 118 | +- [TCK automation PR (VTL TF)](https://github.com/sdmx-twg/vtl/pull/565) |
| 119 | +- [Notes chargeur CSV TCK](../roadmap/tck-csv-loader.md) |
| 120 | +- JUnit / reporting : [junit5](https://github.com/junit-team/junit5/discussions/4504#discussioncomment-13046641), [surefire](https://github.com/apache/maven-surefire/issues/835), [dorny/test-reporter](https://github.com/dorny/test-reporter/issues/580) |
0 commit comments