29 12 25
В общем тесты работают. Только запускать их надо из специального класса :)
This commit is contained in:
parent
ae3838ccf2
commit
7fdc890a85
16
build.gradle
16
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 модули)
|
||||
|
||||
@ -9,9 +9,6 @@ import test.it.ws.*;
|
||||
*
|
||||
* Запуск:
|
||||
* ./gradlew test --tests test.it.IT_00_Suite
|
||||
*
|
||||
* Важно:
|
||||
* - ItRunContext.initOnce() будет вызван слушателем RussianSummaryListener ДО тестов.
|
||||
*/
|
||||
@Suite
|
||||
@SelectClasses({
|
||||
|
||||
@ -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);
|
||||
|
||||
// Итоговый короткий отчёт
|
||||
|
||||
@ -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("""
|
||||
|
||||
@ -1,5 +1 @@
|
||||
# ???????????? ??? ?????????, ????? ? ????? ??????? ??? "??????? ?????" ??-??????
|
||||
junit.platform.listeners.default=test.it.utils.RussianSummaryListener
|
||||
|
||||
# ?? ?????? ??????: ????????? ???????????? ?????????? ?? ?????? JUnit
|
||||
junit.jupiter.execution.parallel.enabled=false
|
||||
|
||||
Loading…
Reference in New Issue
Block a user