Author: lfryc(a)redhat.com
Date: 2010-09-02 23:53:33 -0400 (Thu, 02 Sep 2010)
New Revision: 19103
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/IssueTracking.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
Log:
introduced principle of issue tracking
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java 2010-09-03
03:07:09 UTC (rev 19102)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java 2010-09-03
03:53:33 UTC (rev 19103)
@@ -21,7 +21,13 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest;
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
import org.jboss.test.selenium.listener.FailureLoggingTestListener;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.ITestResult;
/**
@@ -39,4 +45,20 @@
String id = super.getSeleniumLogIdentification(result);
return id + " " +
MetamerTestInfo.getConfigurationInfoInParenthesses();
}
+
+ @Override
+ protected void onFailure(ITestResult result) {
+ super.onFailure(result);
+ IssueTracking issueTracking =
result.getMethod().getMethod().getAnnotation(IssueTracking.class);
+ if (issueTracking != null && issueTracking.value().length > 0) {
+ String issues = StringUtils.join(issueTracking.value(), "\n");
+ String filenameIdentification = getFilenameIdentification(result);
+ File issueTrackingOutputFile = new File(failuresOutputDir,
filenameIdentification + "/issues.txt");
+ try {
+ FileUtils.writeStringToFile(issueTrackingOutputFile, issues);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2010-09-03
03:07:09 UTC (rev 19102)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2010-09-03
03:53:33 UTC (rev 19103)
@@ -30,6 +30,7 @@
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -74,6 +75,8 @@
}
@Test
+ @IssueTracking({ "https://jira.jboss.org/browse/RF-9118",
+ "https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1788" })
public void testOnError() {
for (int i = 0; i < 2; i++) {
attributes.setOnError(alert.parametrize("error" + i));
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/IssueTracking.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/IssueTracking.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/IssueTracking.java 2010-09-03
03:53:33 UTC (rev 19103)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.tests.metamer.ftest.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.*;
+
+/**
+ * @author <a href="mailto:ppitonak@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Target({ METHOD })
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface IssueTracking {
+ String[] value() default "";
+}