Go down
Posts : 7
Join date : 2014-11-14
Age : 35

Ant build file for TestNG not running

on Fri Nov 14, 2014 3:52 pm

I m using Ant Build.xml for TestNG.xml to run testng with ANT.
My Build.xml looks like this..

<?xml version="1.0" encoding="UTF-8" ?>

<project name="ANT File For TestNG" default="runTest"


 <property name="src" location="src" />

  <property name="bin" location="bin" />

  <property name="lib" location="D:\\Reference Library"

<path id="class.path">

location="${lib}/selenium-server-standalone-2.43.1.jar" />

   <pathelement location="${lib}/testng-5.5.jar" />

   <pathelement location="${lib}/ReportNG/guice-3.0.jar"

   <pathelement location="${lib}/ReportNG/reportng-1.1.2"

   <pathelement location="${lib}/ReportNG/velocity-dep-1.4"

   <pathelement location="${lib}/ojdbc6_g.jar" />

   <pathelement location="${bin}" />


<target name="ktele">

 <mkdir dir="${bin}"/>

  <javac classpathref="class.path" destdir="${bin}"
encoding="UTF-8" srcdir="${src}"/>



<taskdef name="testng" classname="org.testng.TestNGAntTask">


      <pathelement location="${lib}/testng-5.5.jar"



<target name="runTest" depends="ktele">

 <testng outputdir="test-output" classpathref="class.path"

  <xmlfileset dir="." includes="TestNG.xml" />




and after running this build file..
Buildfile: D:\OllehSpace\Ktele\build.xml
    [javac] D:\OllehSpace\Ktele\build.xml:20: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
   [testng] Usage:
[options] The XML suite files to run
   [testng]   Options:
   [testng]     -configfailurepolicy               Configuration failure policy (skip or
   [testng]                                        continue)
   [testng]     -d                                 Output directory
   [testng]     -dataproviderthreadcount           Number of threads to use when running
   [testng]                                        data providers
   [testng]     -excludegroups                     Comma-separated list of group names to
   [testng]                                        exclude
   [testng]     -groups                            Comma-separated list of group names to be
   [testng]                                        run
   [testng]     -junit                             JUnit mode
   [testng]                                        Default: false
   [testng]     -listener                          List of .class files or list of class
   [testng]                                        names implementing ITestListener or
   [testng]                                        ISuiteListener
   [testng]     -methods                           Comma separated of test methods
   [testng]                                        Default: []
   [testng]     -methodselectors                   List of .class files or list of class
   [testng]                                        names implementing IMethodSelector
   [testng]     -mixed                             Mixed mode - autodetect the type of
   [testng]                                        current test and run it with appropriate runner
   [testng]                                        Default: false
   [testng]     -objectfactory                     List of .class files or list of class
   [testng]                                        names implementing ITestRunnerFactory
   [testng]     -parallel                          Parallel mode (methods, tests or classes)
   [testng]     -port                              The port
   [testng]     -reporter                          Extended configuration for custom report
   [testng]                                        listener
   [testng]     -suitename                         Default name of test suite, if not
   [testng]                                        specified in suite definition file or source code
   [testng]     -suitethreadpoolsize               Size of the thread pool to use to run
   [testng]                                        suites
   [testng]                                        Default: 1
   [testng]     -testclass                         The list of test classes
   [testng]     -testjar                           A jar file containing the tests
   [testng]     -testname                          Default name of test, if not specified in
   [testng]                                        suitedefinition file or source code
   [testng]     -testnames                         The list of test names to run
   [testng]     -testrunfactory, -testRunFactory   The factory used to create tests
   [testng]     -threadcount                       Number of threads to use when running
   [testng]                                        tests in parallel
   [testng]     -usedefaultlisteners               Whether to use the default listeners
   [testng]                                        Default: true
   [testng]     -log, -verbose                     Level of verbosity
   [testng]     -xmlpathinjar                      The full path to the xml file inside the
   [testng]                                        jar file (only valid if -testjar was
   [testng]                                        specified)
   [testng]                                        Default: testng.xml
   [testng] Unknown option: -d D:\OllehSpace\Ktele\test-output -sourcedir D:\OllehSpace\Ktele\bin -suitename "Ant suite" -testname "Ant test" "D:\OllehSpace\Ktele\TestNG.xml"
Total time: 2 seconds

I will get BUILD succes msg but script inside TestNg.xml are not running.
Can anyone help me ?
Back to top
Permissions in this forum:
You cannot reply to topics in this forum