Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Add TestLogger so that we can see in the log which tests have run or …
Browse files Browse the repository at this point in the history
…failed
  • Loading branch information
seanf committed Feb 2, 2015
1 parent b111490 commit caee3ad
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion functional-test/pom.xml
Expand Up @@ -591,7 +591,7 @@
<properties>
<property>
<name>listener</name>
<value>org.zanata.util.ScreenshotEnabledTestRunListener,org.zanata.util.FeatureInventoryRecorder</value>
<value>org.zanata.util.ScreenshotEnabledTestRunListener,org.zanata.util.FeatureInventoryRecorder,org.zanata.util.TestLogger</value>
</property>
</properties>
<systemPropertyVariables>
Expand Down
61 changes: 61 additions & 0 deletions functional-test/src/test/java/org/zanata/util/TestLogger.java
@@ -0,0 +1,61 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.util;

import lombok.extern.slf4j.Slf4j;

import org.junit.runner.Description;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;

/**
* @author Sean Flanigan
* <a href="mailto:sflaniga@redhat.com">sflaniga@redhat.com</a>
*/
@Slf4j
public class TestLogger extends RunListener {
@Override
public void testStarted(Description description) throws Exception {
log.info("Test {} starting", description);
}

@Override
public void testFinished(Description description) throws Exception {
log.info("Test {} finished", description);
}

@Override
public void testFailure(Failure failure) throws Exception {
log.error("FAILED test " + failure, failure.getException());
}

@Override
public void testAssumptionFailure(Failure failure) {
log.error("FAILED ASSUMPTION in test " + failure,
failure.getException());
}

@Override
public void testIgnored(Description description) throws Exception {
log.error("Test {} IGNORED", description);
}

}

0 comments on commit caee3ad

Please sign in to comment.