diff --git a/util/src/test/java/org/killbill/billing/api/AbortAfterFirstFailureListener.java b/util/src/test/java/org/killbill/billing/api/AbortAfterFirstFailureListener.java
new file mode 100644
index 0000000..09e26ab
--- /dev/null
+++ b/util/src/test/java/org/killbill/billing/api/AbortAfterFirstFailureListener.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2014-2018 Groupon, Inc
+ * Copyright 2014-2018 The Billing Project, LLC
+ *
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.killbill.billing.api;
+
+import org.testng.IInvokedMethod;
+import org.testng.IInvokedMethodListener;
+import org.testng.ITestResult;
+import org.testng.SkipException;
+
+public class AbortAfterFirstFailureListener implements IInvokedMethodListener {
+
+ private boolean hasFailures = false;
+
+ @Override
+ public void beforeInvocation(final IInvokedMethod method, final ITestResult testResult) {
+ if (!method.isTestMethod()) {
+ return;
+ }
+
+ synchronized (this) {
+ if (hasFailures) {
+ throw new SkipException("Skipping this test");
+ }
+ }
+ }
+
+ @Override
+ public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) {
+ if (!method.isTestMethod()) {
+ return;
+ }
+
+ if (!testResult.isSuccess()) {
+ synchronized (this) {
+ hasFailures = true;
+ }
+ }
+ }
+}
diff --git a/util/src/test/java/org/killbill/billing/GuicyKillbillTestSuite.java b/util/src/test/java/org/killbill/billing/GuicyKillbillTestSuite.java
index 3196aef..331ce03 100644
--- a/util/src/test/java/org/killbill/billing/GuicyKillbillTestSuite.java
+++ b/util/src/test/java/org/killbill/billing/GuicyKillbillTestSuite.java
@@ -1,7 +1,7 @@
/*
* Copyright 2010-2013 Ning, Inc.
- * Copyright 2014-2017 Groupon, Inc
- * Copyright 2014-2017 The Billing Project, LLC
+ * Copyright 2014-2018 Groupon, Inc
+ * Copyright 2014-2018 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
@@ -23,6 +23,7 @@ import java.util.UUID;
import javax.inject.Inject;
+import org.killbill.billing.api.AbortAfterFirstFailureListener;
import org.killbill.billing.api.FlakyInvokedMethodListener;
import org.killbill.billing.callcontext.InternalTenantContext;
import org.killbill.billing.callcontext.MutableInternalCallContext;
@@ -45,7 +46,14 @@ import org.testng.annotations.Listeners;
import com.google.common.collect.ImmutableMap;
-@Listeners(FlakyInvokedMethodListener.class)
+import static org.testng.ITestResult.CREATED;
+import static org.testng.ITestResult.FAILURE;
+import static org.testng.ITestResult.SKIP;
+import static org.testng.ITestResult.STARTED;
+import static org.testng.ITestResult.SUCCESS;
+import static org.testng.ITestResult.SUCCESS_PERCENTAGE_FAILURE;
+
+@Listeners({FlakyInvokedMethodListener.class, AbortAfterFirstFailureListener.class})
public class GuicyKillbillTestSuite implements IHookable {
// Use the simple name here to save screen real estate
@@ -138,9 +146,34 @@ public class GuicyKillbillTestSuite implements IHookable {
@AfterMethod(alwaysRun = true)
public void afterMethodAlwaysRun(final Method method, final ITestResult result) throws Exception {
+ final String tag;
+ switch (result.getStatus()) {
+ case SUCCESS:
+ tag = "SUCCESS";
+ break;
+ case FAILURE:
+ tag = "!!! FAILURE !!!";
+ break;
+ case SKIP:
+ tag = "SKIP";
+ break;
+ case SUCCESS_PERCENTAGE_FAILURE:
+ tag = "SUCCESS WITHIN PERCENTAGE";
+ break;
+ case STARTED:
+ tag = "STARTED";
+ break;
+ case CREATED:
+ tag = "CREATED";
+ break;
+ default:
+ tag = "UNKNOWN";
+ break;
+ }
+
log.info("***************************************************************************************************");
log.info("*** Ending test {}:{} {} ({} s.)", new Object[]{method.getDeclaringClass().getName(), method.getName(),
- result.isSuccess() ? "SUCCESS" : "!!! FAILURE !!!",
+ tag,
(result.getEndMillis() - result.getStartMillis()) / 1000});
log.info("***************************************************************************************************");
if (!hasFailed && !result.isSuccess()) {