]> source.dussan.org Git - vaadin-framework.git/commitdiff
Combine server name and test class into test name
authorArtur Signell <artur@vaadin.com>
Tue, 3 Sep 2013 07:14:00 +0000 (10:14 +0300)
committerArtur Signell <artur@vaadin.com>
Tue, 3 Sep 2013 07:14:00 +0000 (10:14 +0300)
* Cleaned up integration test hierarchy
* Corrected web socket test to actually use web sockets

Change-Id: I33171026469ffaf3b79e50a56f6a1a682c0f2705

uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/integration/IntegrationTestStreamingTB3.java
uitest/src/com/vaadin/tests/integration/IntegrationTestTB3.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/integration/IntegrationTestWebsocketTB3.java
uitest/src/com/vaadin/tests/integration/IntegrationTestXhrTB3.java

diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java
new file mode 100644 (file)
index 0000000..99e564e
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed 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 com.vaadin.tests.integration;
+
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * JUnit runner for integration tests.
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+public class IntegrationTestRunner extends BlockJUnit4ClassRunner {
+
+    private Class<?> testClass;
+
+    /**
+     * @param klass
+     * @throws InitializationError
+     */
+    public IntegrationTestRunner(Class<?> klass) throws InitializationError {
+        super(klass);
+        testClass = klass;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.junit.runners.BlockJUnit4ClassRunner#testName(org.junit.runners.model
+     * .FrameworkMethod)
+     */
+    @Override
+    protected String testName(FrameworkMethod method) {
+        if (IntegrationTestTB3.class.isAssignableFrom(testClass)) {
+            return testClass.getSimpleName() + "-"
+                    + System.getProperty("server-name");
+        } else {
+            return super.testName(method);
+        }
+    }
+}
index d5891f6fb5e6e76ba829337710aa10590f55f717..9f5b92f5ff77984c92b5f6bc2c574d89954c89ea 100644 (file)
@@ -1,6 +1,6 @@
 package com.vaadin.tests.integration;\r
 \r
-public class IntegrationTestStreamingTB3 extends IntegrationTestXhrTB3 {\r
+public class IntegrationTestStreamingTB3 extends IntegrationTestTB3 {\r
 \r
     @Override\r
     protected Class<?> getUIClass() {\r
diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestTB3.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestTB3.java
new file mode 100644 (file)
index 0000000..dfdb1fe
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed 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 com.vaadin.tests.integration;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.PrivateTB3Configuration;
+
+/**
+ * 
+ * @since
+ * @author Vaadin Ltd
+ */
+@RunWith(IntegrationTestRunner.class)
+public class IntegrationTestTB3 extends PrivateTB3Configuration {
+    @Test
+    public void runTest() throws IOException, AssertionError {
+        compareScreen("initial");
+
+        WebElement cell = vaadinElement(getTableCell(getTable(), 0, 1));
+        testBenchElement(cell).click(51, 13);
+
+        compareScreen("finland");
+    }
+
+    private String getTableCell(String tableLocator, int row, int col) {
+        return tableLocator
+                + "/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild["
+                + row + "]/domChild[" + col + "]/domChild[0]";
+    }
+
+    protected String getTable() {
+        return "/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]";
+    }
+
+    @Override
+    protected String getPath() {
+        return "/demo" + super.getPath();
+    }
+
+    @Override
+    protected String getBaseURL() {
+        return System.getProperty("deployment.url");
+    }
+
+    @Override
+    protected String getTestName() {
+        // Note that this is used for screenshots. The test name shown in the
+        // build server and when running the JUnit test is produced by
+        // IntegrationTestRunner
+        return super.getTestName() + "-" + System.getProperty("server-name");
+    }
+
+}
index bce4744053a6c7a4a3dbfadda1eaa28c084681fb..ad7ea093501fa08107c84d81965596e496dde05f 100644 (file)
@@ -1,10 +1,9 @@
 package com.vaadin.tests.integration;\r
 \r
-\r
-public class IntegrationTestWebsocketTB3 extends IntegrationTestXhrTB3 {\r
+public class IntegrationTestWebsocketTB3 extends IntegrationTestTB3 {\r
 \r
     @Override\r
     protected Class<?> getUIClass() {\r
-        return com.vaadin.tests.integration.IntegrationTestStreaming.class;\r
+        return com.vaadin.tests.integration.IntegrationTestWebsocket.class;\r
     }\r
 }\r
index a49a0c2cdfb0885391ac877de65a6861f219dea8..d17b7b7a88e3ed53db79399a4cfe5496df392ac5 100644 (file)
@@ -1,51 +1,10 @@
 package com.vaadin.tests.integration;\r
 \r
-import java.io.IOException;\r
-\r
-import org.junit.Test;\r
-import org.openqa.selenium.WebElement;\r
-\r
-import com.vaadin.tests.tb3.PrivateTB3Configuration;\r
-\r
-public class IntegrationTestXhrTB3 extends PrivateTB3Configuration {\r
-\r
-    @Test\r
-    public void runTest() throws IOException, AssertionError {\r
-        compareScreen("initial");\r
-\r
-        WebElement cell = vaadinElement(getTableCell(getTable(), 0, 1));\r
-        testBenchElement(cell).click(51, 13);\r
-\r
-        compareScreen("finland");\r
-    }\r
-\r
-    private String getTableCell(String tableLocator, int row, int col) {\r
-        return tableLocator\r
-                + "/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild["\r
-                + row + "]/domChild[" + col + "]/domChild[0]";\r
-    }\r
-\r
-    protected String getTable() {\r
-        return "/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]";\r
-    }\r
 \r
+public class IntegrationTestXhrTB3 extends IntegrationTestTB3 {\r
     @Override\r
     protected Class<?> getUIClass() {\r
         return IntegrationTestUI.class;\r
     }\r
 \r
-    @Override\r
-    protected String getPath() {\r
-        return "/demo" + super.getPath();\r
-    }\r
-\r
-    @Override\r
-    protected String getBaseURL() {\r
-        return System.getProperty("deployment.url");\r
-    }\r
-\r
-    @Override\r
-    protected String getTestName() {\r
-        return super.getTestName() + "-" + System.getProperty("server-name");\r
-    }\r
 }\r