first of can you send a screenshot of the error.
[quote:10zhykd6]Can't we call this listener from testng.xml ??[/quote:10zhykd6]
testng.xml can call this listener.
i have to see your code how you are overriding this listener.
Uploaded project.
in my testng xml --<listeners>
<listener class-name="testng_listeners.CustomListener2" />
</listeners>
Fine in my suiteA I have <test name="Test C">
<classes>
<class name="suite1.TestC" ></class>
</classes>
</test>
So as per logic when TestC runs Listener class should be called. but error coming
Listener testng_listeners.CustomListener2@5aaa6d82 must be one of ITestListener, ISuiteListener, IReporter, IAnnotationTransformer, IMethodInterceptor or IInvokedMethodListener
Usage: <main class> [options] The XML suite files to run
Options:
-configfailurepolicy
Configuration failure policy (skip or continue)
-d
Output directory
-dataproviderthreadcount
Number of threads to use when running data providers
-excludegroups
Comma-separated list of group names to exclude
-groups
Comma-separated list of group names to be run
-junit
JUnit mode
Default: false
-listener
List of .class files or list of class names implementing ITestListener or
ISuiteListener
-methods
Comma separated of test methods
Default: []
-methodselectors
List of .class files or list of class names implementing IMethodSelector
-mixed
Mixed mode - autodetect the type of current test and run it with
appropriate runner
Default: false
-objectfactory
List of .class files or list of class names implementing
ITestRunnerFactory
-parallel
Parallel mode (methods, tests or classes)
Possible Values: [tests, methods, classes, instances, none, true, false]
-port
The port
-reporter
Extended configuration for custom report listener
-suitename
Default name of test suite, if not specified in suite definition file or
source code
-suitethreadpoolsize
Size of the thread pool to use to run suites
Default: 1
-testclass
The list of test classes
-testjar
A jar file containing the tests
-testname
Default name of test, if not specified in suitedefinition file or source
code
-testnames
The list of test names to run
-testrunfactory, -testRunFactory
The factory used to create tests
-threadcount
Number of threads to use when running tests in parallel
-usedefaultlisteners
Whether to use the default listeners
Default: true
-log, -verbose
Level of verbosity
-xmlpathinjar
The full path to the xml file inside the jar file (only valid if -testjar
was specified)
Default: testng.xml
I cannot use AbstractWebDriverEventListener in testng.xml
Then what should i use instead of this??
whats the reason of not using
you'll use these ITestListener, ISuiteListener, IReporter, IAnnotationTransformer, IMethodInterceptor or IInvokedMethodListener for testng.
[quote:2ikerxjz]
whats the reason of not using[/quote:2ikerxjz]
because its selenium listener not a testng listener. you can't put petrol in a diesel car.