Hello I try to create a build in ant were it create a html report which will start my .class file from eclips
"
<property name="src" value="D:/Automation/eclipse/MyWork/OpenCart/src" />
<property name="lib" value="D:/Automation/eclipse/MyWork/OpenCart/lib/" />
<property name="bin" value="D:/Automation/eclipse/MyWork/build" />
<property name="report" value="d:/Automation/report" />
<path id="test.classpath">
<pathelement location="${bin}"/>
<fileset dir="${lib}">
<include name="${lib}/junit.jar" />
</fileset>
</path>
<target name="init">
<delete dir="${bin}" />
<mkdir dir="${bin}" />
</target>
<target name="compile" depends="init">
<javac source="1.7" srcdir="${src}" fork="true" destdir="${bin}" includeantruntime="false" >
<classpath>
<pathelement path="${bin}">
</pathelement>
<fileset dir="${lib}">
<include name="${src}/TestCases/OpenCart.class" />
</fileset>
</classpath>
</javac>
</target>
<target name="exec" depends="compile">
<delete dir="${report}" />
<mkdir dir="${report}" />
<mkdir dir="${report}/xml" />
<junit printsummary="yes" haltonfailure="no">
<classpath>
<pathelement location="${bin}" />
<fileset dir="${lib}">
<include name="${src}/TestCases/OpenCart.class" />
</fileset>
</classpath>
<test name="com.selftechy.seltests.SeleniumTest" haltonfailure="no" todir="${report}/xml" outfile="TEST-result">
<formatter type="xml" />
</test>
</junit>
<junitreport todir="${report}">
<fileset dir="${report}/xml">
<include name="TEST*.xml" />
</fileset>
<report format="frames" todir="${report}/html" />
</junitreport>
</target>
"
I get the error : "
Buildfile: D:\Automation\eclipse\MyWork\OpenCart\Build.xml init:
[delete] Deleting directory D:\Automation\eclipse\MyWork\build [mkdir] Created dir: D:\Automation\eclipse\MyWork\build compile: [javac] Compiling 1 source file to D:\Automation\eclipse\MyWork\build [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:3: error: package com.thoughtworks.selenium does not exist [javac] import com.thoughtworks.selenium.; [javac] ^ [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:5: error: package org.junit does not exist [javac] import org.junit.After; [javac] ^ [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:6: error: package org.junit does not exist [javac] import org.junit.Before; [javac] ^ [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:7: error: package org.junit does not exist [javac] import org.junit.Rule; [javac] ^ [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:8: error: package org.junit does not exist [javac] import org.junit.Test; [javac] ^ [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:9: error: package org.junit.rules does not exist [javac] import org.junit.rules.ErrorCollector; [javac] ^ [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:11: error: package org.junit does not exist [javac] import static org.junit.Assert.; [javac] ^ [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:14: error: cannot find symbol [javac] private Selenium selenium; [javac] ^ [javac] symbol: class Selenium [javac] location: class OpenCart [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:17: error: cannot find symbol [javac] public ErrorCollector errorCollector = new ErrorCollector(); [javac] ^ [javac] symbol: class ErrorCollector [javac] location: class OpenCart [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:16: error: cannot find symbol [javac] @Rule [javac] ^ [javac] symbol: class Rule [javac] location: class OpenCart [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:19: error: cannot find symbol [javac] @Before [javac] ^ [javac] symbol: class Before [javac] location: class OpenCart [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:25: error: cannot find symbol [javac] @Test [javac] ^ [javac] symbol: class Test [javac] location: class OpenCart [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:128: error: cannot find symbol [javac] @After [javac] ^ [javac] symbol: class After [javac] location: class OpenCart [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:17: error: cannot find symbol [javac] public ErrorCollector errorCollector = new ErrorCollector(); [javac] ^ [javac] symbol: class ErrorCollector [javac] location: class OpenCart [javac] D:\Automation\eclipse\MyWork\OpenCart\src\OpenCart.java:21: error: cannot find symbol [javac] selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://IP/"); [javac] ^ [javac] symbol: class DefaultSelenium [javac] location: class OpenCart [javac] 15 errorsBUILD FAILED D:\Automation\eclipse\MyWork\OpenCart\Build.xml:23: Compile failed; see the compiler error output for details.
Total time: 1 second
the ${lib} contains all the libs I used to create this class and running only the class work 100% but when I try to run the build as a ant build in eclips it give me this erros
I have set the %JAVA_HOME% to jdk and in cmd I run javac and it find it the junit.jar is in ${lib} and in %ANT_HOME%/lib and in %JAVA_HOME%/lib
please help !!!