From 7fdc890a8578663f1d2d4b5efb3c2c8f53b8a7c5d323e15a3cd130b6381b3af3 Mon Sep 17 00:00:00 2001 From: AidarKC Date: Mon, 29 Dec 2025 14:51:13 +0300 Subject: [PATCH] =?UTF-8?q?29=2012=2025=20=D0=92=20=D0=BE=D0=B1=D1=89?= =?UTF-8?q?=D0=B5=D0=BC=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=D1=8E=D1=82.=20=D0=A2=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=BA=D0=BE=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B8=D1=85=20=D0=BD=D0=B0=D0=B4=D0=BE=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B0=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 16 ---------------- src/test/java/test/it/IT_00_Suite.java | 3 --- src/test/java/test/it/IT_RunAllMain.java | 2 +- .../test/it/ws/IT_03_AddBlock_NoAuth.java | 19 ++++++++++++++----- src/test/resources/junit-platform.properties | 4 ---- 5 files changed, 15 insertions(+), 29 deletions(-) diff --git a/build.gradle b/build.gradle index ff1043b..da87556 100644 --- a/build.gradle +++ b/build.gradle @@ -52,22 +52,6 @@ dependencies { -// -// -// // -------------------- ТЕСТЫ -------------------- -// testImplementation platform('org.junit:junit-bom:5.11.4') -// testImplementation 'org.junit.jupiter:junit-jupiter' -// testImplementation 'org.junit.platform:junit-platform-suite-api' -// testRuntimeOnly 'org.junit.platform:junit-platform-suite-engine' -// -// testRuntimeOnly "org.junit.platform:junit-platform-launcher" -// -// // Suite (чтобы запустить классы в заданном порядке) -// testImplementation "org.junit.platform:junit-platform-suite:1.10.2" -// -// // Нужно, чтобы TestExecutionListener (RussianSummaryListener) корректно подхватывался -// testRuntimeOnly 'org.junit.platform:junit-platform-launcher' -//} // -------------------- ТЕСТЫ (JUnit 5) -------------------- // Один BOM на всё семейство JUnit (Jupiter + Platform модули) diff --git a/src/test/java/test/it/IT_00_Suite.java b/src/test/java/test/it/IT_00_Suite.java index 9ccd233..4c3f3f3 100644 --- a/src/test/java/test/it/IT_00_Suite.java +++ b/src/test/java/test/it/IT_00_Suite.java @@ -9,9 +9,6 @@ import test.it.ws.*; * * Запуск: * ./gradlew test --tests test.it.IT_00_Suite - * - * Важно: - * - ItRunContext.initOnce() будет вызван слушателем RussianSummaryListener ДО тестов. */ @Suite @SelectClasses({ diff --git a/src/test/java/test/it/IT_RunAllMain.java b/src/test/java/test/it/IT_RunAllMain.java index 0df4dff..a0e8791 100644 --- a/src/test/java/test/it/IT_RunAllMain.java +++ b/src/test/java/test/it/IT_RunAllMain.java @@ -56,7 +56,7 @@ public class IT_RunAllMain { // 3) IT_03_AddBlock_NoAuth (оставлен как есть, поэтому запускаем через его main) // Если он упадёт — он кинет исключение. Мы перехватим и посчитаем как fail=1. TestLog.stepTitle("RUN: IT_03_AddBlock_NoAuth (main)"); - int f3 = 0; //TestLog.runOne("IT_03_AddBlock_NoAuth", () -> IT_03_AddBlock_NoAuth.main(new String[0])); + int f3 = IT_03_AddBlock_NoAuth.run(); failed += f3; passed += (f3 == 0 ? 1 : 0); // Итоговый короткий отчёт diff --git a/src/test/java/test/it/ws/IT_03_AddBlock_NoAuth.java b/src/test/java/test/it/ws/IT_03_AddBlock_NoAuth.java index 5b83d0d..a6d351d 100644 --- a/src/test/java/test/it/ws/IT_03_AddBlock_NoAuth.java +++ b/src/test/java/test/it/ws/IT_03_AddBlock_NoAuth.java @@ -35,10 +35,13 @@ import static org.junit.jupiter.api.Assertions.*; public class IT_03_AddBlock_NoAuth { public static void main(String[] args) { - ItRunContext.initIfNeeded(); - ensureUserExists(); - new IT_03_AddBlock_NoAuth().addBlock_shouldAppendHeaderThenTextThenReaction(); - TestLog.pass("IT_03_AddBlock_NoAuth: OK"); + int failed = run(); + System.exit(failed); + } + + /** Запуск одного теста (standalone). Возвращает 0 если ок, 1 если упал. */ + public static int run() { + return TestLog.runOne("IT_03_AddBlock_NoAuth", IT_03_AddBlock_NoAuth::testBody); } @BeforeAll @@ -57,10 +60,16 @@ public class IT_03_AddBlock_NoAuth { @Test void addBlock_shouldAppendHeaderThenTextThenReaction() { + // JUnit-режим: как обычно + testBody(); + } + + private static void testBody() { ItRunContext.initIfNeeded(); + ensureUserExists(); // таймаут на каждый one-shot запрос - Duration t = Duration.ofSeconds(8); + Duration t = Duration.ofSeconds(1); if (TestConfig.DEBUG()) { TestLog.titleBlock(""" diff --git a/src/test/resources/junit-platform.properties b/src/test/resources/junit-platform.properties index 2fe8504..4c0d52d 100644 --- a/src/test/resources/junit-platform.properties +++ b/src/test/resources/junit-platform.properties @@ -1,5 +1 @@ -# ???????????? ??? ?????????, ????? ? ????? ??????? ??? "??????? ?????" ??-?????? -junit.platform.listeners.default=test.it.utils.RussianSummaryListener -# ?? ?????? ??????: ????????? ???????????? ?????????? ?? ?????? JUnit -junit.jupiter.execution.parallel.enabled=false