Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jubula.examples.api.adder.rcp/shared')
-rw-r--r--org.eclipse.jubula.examples.api.adder.rcp/shared/resources/objectMapping_SimpleAdderRCP.properties11
-rw-r--r--org.eclipse.jubula.examples.api.adder.rcp/shared/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java140
2 files changed, 151 insertions, 0 deletions
diff --git a/org.eclipse.jubula.examples.api.adder.rcp/shared/resources/objectMapping_SimpleAdderRCP.properties b/org.eclipse.jubula.examples.api.adder.rcp/shared/resources/objectMapping_SimpleAdderRCP.properties
new file mode 100644
index 000000000..0e2b95d9c
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.adder.rcp/shared/resources/objectMapping_SimpleAdderRCP.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2014 BREDEX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+equalsButton=rO0ABXNyAD1vcmcuZWNsaXBzZS5qdWJ1bGEudG9vbHMuaW50ZXJuYWwub2JqZWN0cy5Db21wb25lbnRJZGVudGlmaWVyAAAAAAAABAcCAAlaABRtX2VxdWFsT3JpZ2luYWxGb3VuZEQAEW1fbWF0Y2hQZXJjZW50YWdlSQAhbV9udW1iZXJPZk90aGVyTWF0Y2hpbmdDb21wb25lbnRzTAAYbV9hbHRlcm5hdGl2ZURpc3BsYXlOYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7TAAUbV9jb21wb25lbnRDbGFzc05hbWVxAH4AAUwAFW1fY29tcG9uZW50UHJvcGVydGllc3QAD0xqYXZhL3V0aWwvTWFwO0wAEG1faGllcmFyY2h5TmFtZXN0ABBMamF2YS91dGlsL0xpc3Q7TAAMbV9uZWlnaGJvdXJzcQB+AANMABRtX3N1cHBvcnRlZENsYXNzTmFtZXEAfgABeH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1dHRvbl8xdAAfb3JnLmVjbGlwc2Uuc3d0LndpZGdldHMuTGFiZWxfMXQAH29yZy5lY2xpcHNlLnN3dC53aWRnZXRzLkxhYmVsXzJ0AB5vcmcuZWNsaXBzZS5zd3Qud2lkZ2V0cy5UZXh0XzF0AB5vcmcuZWNsaXBzZS5zd3Qud2lkZ2V0cy5UZXh0XzJ4dAAcb3JnLmVjbGlwc2Uuc3d0LndpZGdldHMuVGV4dA==
diff --git a/org.eclipse.jubula.examples.api.adder.rcp/shared/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java b/org.eclipse.jubula.examples.api.adder.rcp/shared/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java
new file mode 100644
index 000000000..ddf7790a6
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.adder.rcp/shared/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2014 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.examples.api.adder.rcp;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.jubula.client.AUT;
+import org.eclipse.jubula.client.AUTAgent;
+import org.eclipse.jubula.client.MakeR;
+import org.eclipse.jubula.client.ObjectMapping;
+import org.eclipse.jubula.client.Result;
+import org.eclipse.jubula.client.exceptions.CheckFailedException;
+import org.eclipse.jubula.client.launch.AUTConfiguration;
+import org.eclipse.jubula.toolkit.base.components.GraphicsComponent;
+import org.eclipse.jubula.toolkit.concrete.components.TextComponent;
+import org.eclipse.jubula.toolkit.concrete.components.TextInputComponent;
+import org.eclipse.jubula.toolkit.enums.ValueSets.InteractionMode;
+import org.eclipse.jubula.toolkit.enums.ValueSets.Operator;
+import org.eclipse.jubula.toolkit.rcp.config.RCPAUTConfiguration;
+import org.eclipse.jubula.toolkit.swt.SwtComponents;
+import org.eclipse.jubula.toolkit.swt.components.Button;
+import org.eclipse.jubula.toolkit.swt.components.Label;
+import org.eclipse.jubula.toolkit.swt.components.Text;
+import org.eclipse.jubula.tools.AUTIdentifier;
+import org.eclipse.jubula.tools.ComponentIdentifier;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/** @author BREDEX GmbH */
+public class SimpleAdder {
+ /** AUT-Agent host name to use */
+ public static final String AGENT_HOST = "localhost"; //$NON-NLS-1$
+ /** AUT-Agent port to use */
+ public static final int AGENT_PORT = 60000;
+ /** the value1 */
+ private static TextInputComponent value1;
+ /** the value2 */
+ private static TextInputComponent value2;
+ /** the button */
+ private static GraphicsComponent button;
+ /** the result */
+ private static TextComponent result;
+ /** the AUT-Agent */
+ private AUTAgent m_agent;
+ /** the AUT */
+ private AUT m_aut;
+
+ /** global prepare */
+ @SuppressWarnings("unchecked")
+ @BeforeClass
+ public static void loadObjectMapping() throws Exception {
+ URL input = SimpleAdder.class.getClassLoader().getResource(
+ "objectMapping_SimpleAdderRCP.properties"); //$NON-NLS-1$
+
+ ObjectMapping om = MakeR.createObjectMapping(input.openStream());
+
+ ComponentIdentifier<Text> val1Id = om.get("value1"); //$NON-NLS-1$
+ ComponentIdentifier<Text> val2Id = om.get("value2"); //$NON-NLS-1$
+ ComponentIdentifier<Button> buttonId = om.get("equalsButton"); //$NON-NLS-1$
+ ComponentIdentifier<Label> sumId = om.get("sum"); //$NON-NLS-1$
+
+ if (val1Id != null && val2Id != null && buttonId != null
+ && sumId != null) {
+ value1 = SwtComponents.createText(val1Id);
+ value2 = SwtComponents.createText(val2Id);
+ button = SwtComponents.createButton(buttonId);
+ result = SwtComponents.createTextComponent(sumId);
+ }
+ }
+
+ /** prepare */
+ @Before
+ public void setUp() throws Exception {
+ m_agent = MakeR.createAUTAgent(AGENT_HOST, AGENT_PORT);
+ m_agent.connect();
+
+ final String autID = "SimpleAdder_rcp"; //$NON-NLS-1$
+ AUTConfiguration config = new RCPAUTConfiguration(
+ "api.aut.conf.simple.adder.rcp", //$NON-NLS-1$
+ autID, "SimpleAdder.exe", //$NON-NLS-1$
+ "..\\examples\\AUTs\\SimpleAdder\\rcp\\win32\\win32\\x86\\", //$NON-NLS-1$
+ null, Locale.getDefault(), Locale.getDefault());
+
+ AUTIdentifier id = m_agent.startAUT(config);
+ if (id != null) {
+ m_aut = m_agent.getAUT(id, SwtComponents.getToolkitInformation());
+ m_aut.connect();
+ } else {
+ Assert.fail("AUT start has failed!"); //$NON-NLS-1$
+ }
+ }
+
+ /** cleanup */
+ @After
+ public void tearDown() throws Exception {
+ m_aut.disconnect();
+ m_agent.stopAUT(m_aut.getIdentifier());
+ m_agent.disconnect();
+ }
+
+ /** the actual test method */
+ @Test(expected = CheckFailedException.class)
+ public void testTestFirstSimpleAdderSteps() throws Exception {
+
+ final int firstValue = 17;
+ List<Result<String>> results = new ArrayList<Result<String>>();
+ try {
+ for (int i = 1; i < 5; i++) {
+ results.add(m_aut.execute(
+ value1.replaceText(String.valueOf(firstValue)),
+ "Entering first value")); //$NON-NLS-1$
+ results.add(m_aut.execute(
+ value2.replaceText(String.valueOf(i)),
+ "Entering second value")); //$NON-NLS-1$
+ results.add(m_aut.execute(
+ button.click(1, InteractionMode.primary),
+ "Invoking calculation")); //$NON-NLS-1$
+ results.add(m_aut.execute(result.checkText(
+ String.valueOf(firstValue + i), Operator.equals),
+ "Checking result")); //$NON-NLS-1$
+ }
+ } finally {
+ Assert.assertTrue(results.size() == 15);
+ }
+ }
+} \ No newline at end of file

Back to the top