Assertj +如何禁用堆栈跟踪

时间:2019-03-01 05:34:52

标签: assertj

我想禁用堆栈跟踪,因为它在所有测试失败中都是重复的。

请告诉我,是否有可能。

ForAtleastOneTupleResult.getAssertionDone(ForAtleastOneTupleResult.java:57)


at org.assertj.core.api.AbstractSoftAssertions.throwsBestMultipleAssertionsError(AbstractSoftAssertions.java:198)
at org.assertj.core.api.SoftAssertions.assertAll(SoftAssertions.java:131)
at com.xyz.assertion.ForAtleastOneTupleResult.getAssertionDone(ForAtleastOneTupleResult.java:71)
at com.xyz.regression.standard.PlacesTest.placesValidation(PlacesTest.java:61)
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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:71)
at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:14)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

1 个答案:

答案 0 :(得分:0)

我不确定是否可以,我相信这是断言错误本身的一部分。 您可以使用http://joel-costigliola.github.io/assertj/core-8/api/org/assertj/core/api/Assertions.html#setRemoveAssertJRelatedElementsFromStackTrace-boolean-减少堆栈跟踪,但这仅适用于堆栈的assertj部分