SWTBot / Ant [message #660144] |
Thu, 17 March 2011 03:40 |
|
Hello,
I try to run my tests (JUnit + SWTBot), and to generate a junitreport (in html) using Ant.
Quote: | My project structure like the following:
|-com.test
|----JRE
|----Plug-in Dependencies
|----src
|--------testPack
|----------------SWTBotTest.java
|----META-INF
|
I have my tests class :
public class SWTBotTest {
private static SWTWorkbenchBot bot;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
bot = new SWTWorkbenchBot();
bot.viewByTitle("Welcome").close();
}
@Test
public void testAddUpdateSite() throws Exception {
bot.menu("Help").menu("Software Updates...").click();
SWTBotShell shell = bot.shell("Software Updates and Add-ons");
shell.activate();
bot.tabItem("Available Software").activate();
// find the new shell widget by its name
bot.button("Add Site...").click();
SWTBotShell shell1 = bot.shell("Add Site");
shell1.activate();
bot.textWithLabel("Location1:").setText(
"http://www.eclipse.org/swt/updates/3.5");
// verify button status
SWTBotAssert.assertEnabled(bot.button("OK"));
// Cancel it, in order to execute again and again
bot.button("Cancel").click();
bot.button("Close").click();
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
}
I create a buildTest.xml :
<?xml version="1.0" encoding="UTF-8" ?>
<project name="testsuite" default="run" basedir=".">
<property name="eclipse-home" value="C:/eclipse" />
<property name="plugin-name" value="com.test" />
<property name="library-file" value="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_2.0.0.595-dev-e34/library.xml" />
<property name="test-classname" value="test.SWTBotTest" />
<target name="suite">
<property name="jvmOption" value="">
</property>
<property name="temp-workspace" value="workspace" />
<delete dir="${temp-workspace}" quiet="true" />
<ant target="swtbot-test" antfile="${library-file}" dir="${eclipse-home}">
<property name="data-dir" value="${temp-workspace}" />
<property name="plugin-name" value="${plugin-name}" />
<property name="os" value="win32" />
<property name="ws" value="win32" />
<property name="arch" value="x86" />
<property name="classname" value="${test-classname}" />
<property name="vmargs" value=" -Xms128M -Xmx512M -XX:MaxPermSize=512M ${jvmOption}" />
</ant>
</target>
<target name="cleanup" />
<target name="run" depends="suite,cleanup">
<ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
<property name="includes" value="*.xml" />
<property name="output-file" value="${plugin-name}.xml" />
</ant>
</target>
<target name="swtbot-test">
<java dir="${eclipse-home}" fork="true" output="${eclipse-home}/output.txt" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="false">
<classpath>
<fileset dir="${eclipse-home}/plugins">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</classpath>
<arg line="-product myproduct" />
<arg line="-application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication" />
<arg line="-testApplication myapplication" />
<arg line="-testPluginName com.test" />
<arg line="-className SWTBotTest" />
<arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,junit-results.xml" />
<arg line="-os win32" />
<arg line="-ws win32" />
<arg line="-arch x86" />
<arg line="-configuration file:F:\workspace_34_test\.metadata\.plugins\org.eclipse.pde.core\pde-junit\" />
<arg line="-dev file:E:/WorkspaceGalileo/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties" />
<arg line="-testLoaderClass org.eclipse.jdt.internal.junit.runner.junit4.JUnit4TestLoader" />
<arg line="-loaderPluginName org.eclipse.jdt.junit4.runtime" />
<arg line="-consoleLog" />
<arg line="-data E:\junit-workspace" />
<jvmarg line="-Xms768m -Xmx768m -XX:PermSize=256m -XX:MaxPermSize=256m" />
</java>
</target>
</project>
The log shows that some error happened:
Quote: | Install location:
file:/c:/eclipse/
Configuration file:
file:/c:/eclipse/configuration/config.ini loaded
Configuration location:
file:/c:/eclipse/configuration/
Framework located:
file:/c:/eclipse/plugins/org.eclipse.osgi_3.4.2.R34x_v200808 26-1230.jar
Framework classpath:
file:/c:/eclipse/plugins/org.eclipse.osgi_3.4.2.R34x_v200808 26-1230.jar
Debug options:
file:/C:/eclipse/.options not found
Time to load bundles: 0
Starting application: 656
Application Started: 4531
Testsuite: test.SWTBotTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
Caused an ERROR
java.lang.Exception: Could not find plugin "com.test"
org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner $TestFailedException: java.lang.Exception: Could not find plugin "com.test"
at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .runFailed(EclipseTestRunner.java:289)
at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .getTest(EclipseTestRunner.java:242)
at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner . <init>(EclipseTestRunner.java:222)
at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:206)
at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .runTests(UITestApplication.java:115)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.Exception: Could not find plugin "com.test"
at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .loadSuiteClass(EclipseTestRunner.java:303)
at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .getTest(EclipseTestRunner.java:239)
|
I'm sorry if my questions are a little bit simple, but I am currently blocked on this point.
Thanks a lot for your help,
Ben.
[Updated on: Thu, 17 March 2011 04:30] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03068 seconds