Re: [testng-users] newbie: Help needed with @factory annotation

162 views
Skip to first unread message

Cédric Beust ♔

unread,
Sep 12, 2012, 9:08:37 AM9/12/12
to testng...@googlegroups.com
I am confused: if it runs fine with testng.xml, what did you use to compile your code if it fails with ant?

-- 
Cédric




On Wed, Sep 12, 2012 at 1:00 AM, Neha <nghos...@gmail.com> wrote:
Hi All,

I am a newbie to testng.I have used a factory method in the following way in code:

@Factory(dataProviderClass=test.DVODataProvider.class,dataProvider="SampleDataProvider")
 public ExcelSheetReader(String line) {

Execution via testng.xml is working fine and see the output as expected.I want to run the same through Ant build file.But the compilation fails with error

 C:\Users\nraj\workspace\TestNGDemo1\src\test\ExcelSheetReader.java:47: cannot find symbol
    [javac] symbol  : method dataProviderClass()
    [javac] location: @interface org.testng.annotations.Factory
    [javac]     @Factory(dataProviderClass=test.DVODataProvider.class,dataProvider="fileDataProvider")
    [javac]              ^
    [javac] C:\Users\nraj\workspace\TestNGDemo1\src\test\ExcelSheetReader.java:47: annotation type not applicable to this kind of declaration
    [javac]     @Factory(dataProviderClass=test.DVODataProvider.class,dataProvider="fileDataProvider")

Can someone please guide me how to overcome this error.

Thanks in advance

Neha

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/b-gVVZATsT0J.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Krishnan Mahadevan

unread,
Sep 12, 2012, 9:13:31 AM9/12/12
to testng...@googlegroups.com
Neha,
I have seen such kind of errors when trying to compile a project which has annotations using Maven.
Maven by default would make use of JDK 1.4 but for annotations to be recognized JDK 1.5 or higher would be needed. 

Perhaps ANT has a similar thing too ?

I found this thread which shows how to specify the version of JDK to ant : http://www.coderanch.com/t/108814/tools/specify-jdk-version-build-xml


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

Neha

unread,
Sep 13, 2012, 3:29:56 AM9/13/12
to testng...@googlegroups.com
Hi ,

The issue got resolved.The buildpath had two versions of Testng library added.I removed the older version jar.The program is giving results with Ant build now as well.
Sorry for the blast..:P

Thanks,

Neha.
Reply all
Reply to author
Forward
0 new messages