Re: Problem starting selenium with Ant

36 views
Skip to first unread message

Dagang Wang

unread,
Dec 6, 2012, 11:55:05 AM12/6/12
to seleniu...@googlegroups.com
You're using relative paths throughout your tasks, have your defined where your basedir is? Assuming all of the libs are at /somewhere/libs then you might need to set your basedir to basedir=<somewhere> in your project. I'm new too so just guessing.

On Thursday, December 6, 2012 6:01:13 AM UTC-6, Torsten Zander wrote:
I am pretty new to java and not sure if this ist the right place.
I have problem running my selenium tests with ant:
<?xml version="1.0"?>

<project name="Run Selenium Tests" default="run_all">

    <property name="src" location="src" />
    <property name="build" location="build" />
    <property name="target" location="target" />
    <property name="libs" location="libs" />
    <property name="testresults" location="junit-results" />
    <property name="testreport" location="junit-report" />

    <property name="seleniumVersion" value="2.25.0" />

    <property name="seleniumLibsFolder" value="selenium_${seleniumVersion}" />
    <property name="seleniumclient" location="${libs}/${seleniumLibsFolder}/selenium-java-2.26.0.jar" />
    <property name="seleniumserver" location="${libs}/${seleniumLibsFolder}/selenium-server-standalone-${seleniumVersion}.jar"/>

    <path id="junit.class.path">
        <pathelement location="${libs}/junit-4.11.jar" />
        <pathelement location="${seleniumclient}" />
        <pathelement location="${seleniumserver}" />
        <pathelement location="${build}" />
    </path>

    <target name="clean">
        <delete dir="${build}" />
        <delete dir="${testresults}" />
        <delete dir="${testreport}" />
    </target>
    <target name="makedir">
        <mkdir dir="${build}" />
        <mkdir dir="${testresults}" />
        <mkdir dir="${testreport}" />
    </target>

    <!-- Compiles the java code -->
    <target name="compile" depends="clean, makedir">
        <javac srcdir="${src}" destdir="${build}" debug="true" includeAntRuntime="false">
            <classpath refid="junit.class.path" />
        </javac>
    </target>


    <target name="report-junit">
        <junitreport todir="${testreport}">
            <fileset dir="${testresults}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="${testreport}"/>
        </junitreport>
    </target>

    <target name="run_all" depends="compile">
        <junit printsummary="yes" fork="yes" errorproperty="junit.error" failureproperty="junit.error">

            <classpath refid="junit.class.path" />
            <formatter type="xml" />

            <batchtest todir="${testresults}">
                <fileset dir="${build}" includes="de/wl/webdriver/MyFirstTest.class" />
            </batchtest>

        </junit>
        <antcall target="report-junit"/>
        <fail if="junit.error" message="Selenium test(s) failed.  See reports!"/>
    </target>

</project>

I have the jars: selenium-java-2.25.0.jar, selenium-server-standalone-2.25.0, junit-4.11.jar in my libs directory, this should take care for the dependencies.
But get errors like:
symbol  : class RemoteWebDriver
    [javac] location: class de.wl.webdriver.testcases.CrossSiteTest
    [javac]         this.driver = new RemoteWebDriver(
    [javac]                           ^
    [javac] /Users/torsten/Sites/wl/src/test/java/de/wl/webdriver/testcases/CrossSiteTest.java:58: cannot find symbol


when compiling.
 

Thanks for your help in advance
Reply all
Reply to author
Forward
0 new messages