Skip to content

Commit

Permalink
add even more logging for test issue debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmipt committed Dec 21, 2023
1 parent 24d352f commit d6be34e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test-integration/studio/ui/ResultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.logging.log4j.Logger;
import org.assertj.swing.data.TableCell;
import org.assertj.swing.fixture.*;
import org.assertj.swing.hierarchy.SingleComponentHierarchy;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
Expand All @@ -12,6 +13,8 @@
import studio.kdb.MockQSession;

import java.awt.*;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.Arrays;

public class ResultTest extends StudioTest {
Expand Down Expand Up @@ -84,6 +87,13 @@ public void testMarkersAfterSorting() {
Assert.assertEquals(bgAfter, table.backgroundAt(TableCell.row(5).column(0)).target());
}

private void logHierarchy(String str) {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
PrintStream out = new PrintStream(outStream);
robot().printer().printComponents(out);
log.info("Hierarchy [{}]:%n{}", str, outStream);
}

@Test
public void testTableConnExtractor() {
MockQSession.setResponse(
Expand All @@ -95,12 +105,15 @@ public void testTableConnExtractor() {

execute();
JTableFixture table = frameFixture.panel("resultPanel0").table();
logHierarchy("Before first popup menu");
JPopupMenuFixture popupMenu = table.showPopupMenuAt(TableCell.row(1).column(0));
logHierarchy("After first popup menu");
String[] labels = popupMenu.menuLabels();
Assert.assertEquals("Open z:2", labels[0]);

table.tableHeader().clickColumn(0).click();
popupMenu = table.showPopupMenuAt(TableCell.row(1).column(0));
logHierarchy("After second popup menu");
labels = popupMenu.menuLabels();
log.info("Got the following menu items {}", Arrays.toString(labels));
Assert.assertEquals("Open b:3", labels[0]);

Check failure on line 119 in test-integration/studio/ui/ResultTest.java

View workflow job for this annotation

GitHub Actions / JUnit Tests

studio.ui.ResultTest ► testTableConnExtractor

Failed test found in: build/test-results/integrationTest/TEST-studio.ui.ResultTest.xml Error: org.junit.ComparisonFailure: expected:<Open [b:3]> but was:<Open [z:2]>
Raw output
org.junit.ComparisonFailure: expected:<Open [b:3]> but was:<Open [z:2]>
	at org.junit.Assert.assertEquals(Assert.java:115)
	at org.junit.Assert.assertEquals(Assert.java:144)
	at studio.ui.ResultTest.testTableConnExtractor(ResultTest.java:119)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.assertj.swing.junit.runner.MethodInvoker.evaluate(MethodInvoker.java:44)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Expand Down

0 comments on commit d6be34e

Please sign in to comment.