mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Log test run failure to the split log
GitOrigin-RevId: 8578c276d5d52a5bd715a58fd53afa7ad975d653
This commit is contained in:
committed by
intellij-monorepo-bot
parent
10a3a75697
commit
8a271c2334
@@ -211,6 +211,12 @@ public final class TestLoggerFactory implements Logger.Factory {
|
||||
onTestFinished(success, description.getDisplayName());
|
||||
}
|
||||
|
||||
public static void logTestFailure(@NotNull Throwable t) {
|
||||
if (shouldSplitTestLogs()) {
|
||||
log(Level.ERROR.toString(), "Test framework", "Test failed", t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke this method instead of {@link #onTestFinished(boolean)} to support separate logs saving
|
||||
*
|
||||
@@ -256,6 +262,7 @@ public final class TestLoggerFactory implements Logger.Factory {
|
||||
|
||||
@Override
|
||||
protected void failed(Throwable e, Description description) {
|
||||
logTestFailure(e);
|
||||
onTestFinished(false, description);
|
||||
}
|
||||
|
||||
|
||||
@@ -566,6 +566,10 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
success = true;
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable t) {
|
||||
TestLoggerFactory.logTestFailure(t);
|
||||
throw t;
|
||||
}
|
||||
finally {
|
||||
TestLoggerFactory.onTestFinished(success, testDescription);
|
||||
}
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ abstract class AbstractInspectionTest : KotlinLightCodeInsightFixtureTestCase()
|
||||
EntryPointsManagerBase.getInstance(project).ADDITIONAL_ANNOTATIONS.add(ENTRY_POINT_ANNOTATION)
|
||||
runWriteAction { FileTypeManager.getInstance().associateExtension(GroovyFileType.GROOVY_FILE_TYPE, "gradle") }
|
||||
} catch (e: Throwable) {
|
||||
TestLoggerFactory.logTestFailure(e)
|
||||
TestLoggerFactory.onTestFinished(false, Description.createTestDescription(javaClass, name))
|
||||
throw e
|
||||
}
|
||||
|
||||
+3
@@ -360,16 +360,19 @@ public abstract class KtUsefulTestCase extends TestCase {
|
||||
super.runTest();
|
||||
TestLoggerFactory.onTestFinished(true, testDescription);
|
||||
} catch (InvocationTargetException e) {
|
||||
TestLoggerFactory.logTestFailure(e);
|
||||
TestLoggerFactory.onTestFinished(false, testDescription);
|
||||
e.fillInStackTrace();
|
||||
throwables[0] = e.getTargetException();
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
TestLoggerFactory.logTestFailure(e);
|
||||
TestLoggerFactory.onTestFinished(false, testDescription);
|
||||
e.fillInStackTrace();
|
||||
throwables[0] = e;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
TestLoggerFactory.logTestFailure(e);
|
||||
TestLoggerFactory.onTestFinished(false, testDescription);
|
||||
throwables[0] = e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user