Ant Build.xml | Selenium Forum
M
Posted on 25/07/2016
Hi,

I am trying to compile and run using ANT.
I have set path for my Jar files as below
*************************************************
<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="C:/Users/Indu/maven/jars"/>
<property name="test.dest" value="${ws.jars}/build"/>
<property name="test.src" value="${ws.home}/src"/>
<property name="ng.result" value="test-output"/>
*******************************************************

Instead of above specified path ws.jar file always taking different path as below.

C:\Users\Indu\Downloads\My Softwares\Selenium_Pack\Selenium_Pack\Selenium_Pack\jars.

Can you please let me know why is it referring to different path other than mentioned in build.xml and what should i change to rectify it.

Thank you.

M
Replied on 25/07/2016

[quote:adxsyyqm]name="ws.jars" value="C:/Users/Indu/maven/jars"[/quote:adxsyyqm]

this refers to where all the jar files located.


M
Replied on 26/07/2016

Hi,

When i try to run through Ant i am getting following error and test is getting failed.
Can you please let me know what is this error and why is this error coming only when running through ANT


<exception class="java.lang.IncompatibleClassChangeError">
<message>
<![CDATA[Class org.openqa.selenium.remote.DesiredCapabilities does not implement the requested interface org.openqa.selenium.Capabilities]]>
</message>
<full-stacktrace>
<![CDATA[java.lang.IncompatibleClassChangeError: Class org.openqa.selenium.remote.DesiredCapabilities does not implement the requested interface org.openqa.selenium.Capabilities
at org.openqa.selenium.firefox.FirefoxDriver.dropCapabilities(FirefoxDriver.java:324)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:217)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at core.qtpselenium.core.hybrid.GenericKeywords.openBrowser(GenericKeywords.java:51)
at core.qtpselenium.core.hybrid.Keywords.generateKeywords(Keywords.java:53)
at com.qtpslenium.core.hybrid.GmailLogin.doLogin(GmailLogin.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1211)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.TestNG.privateMain(TestNG.java:1355)
at org.testng.TestNG.main(TestNG.java:1324)


M
Replied on 26/07/2016

how are you implementing? there is a mistake in your desired capabilities implementation.


M
Replied on 26/07/2016

I am learning Hybrid framework using testng module 21.

Below are the steps i have done

1) Set up Maven
2) Created a Test case GMAIL Test and required class files as shown in attached picture.

Until here My Project is executing fine and i am getting results as expected.

3) Now I am trying to run using ANT
4) I have setup ANT
5) Added Build.xml file
6) Changed Jar file path and added testng XML and associated test case xml's
7) In CMD promt I gave ANT command and checked whether my ANT is setup properly and i got ANT can run the test
8) Compiled ANT and it was successful
9) But when i run My test was failing and I see above mentioned exception when i checked test-output file.
But when i execute same test case directly in eclipse my tests were passing.

I have attached the results of same test cases when executed in ANT and Eclipse.


M
Replied on 27/07/2016

there is mismatch about desires capabilities

you trying to implement Remote desired capabilities class with local desired capabilities class.


M
Replied on 27/07/2016

Actually I didn't use Desired capabilities class anywhere in this project.
I just started with basic Gmail Test to develop hybrid testng framework and trying to run through Ant.

Module 21 Till class 10


M
Replied on 27/07/2016

download the selenium pack again and then use the module 21 from that.