Menu

DataBinding annotation is not working

2015-07-30
2015-08-04
  • Daniel Ivasse

    Daniel Ivasse - 2015-07-30

    Hi

    I've created the following test Class:

    @DataBinding
    public class MeuTeste {

    @Test
    public void metodoTeste1(
    @TestInput(name="parametro1") final Integer parametro1 ) {
    // ...
    }
    }

    With the following data.properties file

    MeuTeste.data.properties

    metodoTeste1.dataSource=csv
    metodoTeste1.url=/com/matera/ban/sdopen/unit/procedures/metodoTeste1.csv
    metodoTeste1.mapper=headerNameMapper
    metodoTeste1.separator=;
    metodoTeste1.inputColumnPrefix=

    And with the following metodoTeste1.csv file:

    parametro1
    1
    1
    1
    1

    When I run the test, I'm getting an erros informing that no parameters were
    received for the test method. But, when I change my test class for the
    following, it works:

    public class MeuTeste {

    @Test( dataProviderClass=GenericDataProvider.class,
    dataProvider="DataProvider" )
    public void metodoTeste1(
    @TestInput(name="parametro1") final Integer parametro1 ) {
    // ...
    }
    }

    Is it a bug?
    Does anyone have this issue?

    --

    Daniel M. Ivasse
    daniel_ivasse@hotmail.com

     
  • Matthias Rothe

    Matthias Rothe - 2015-08-04

    Hi Daniel,

    thanks for reporting this issue. As I'm not familiar with the setup of your environment, may I kindly ask you as a first attempt to solve this issue to check whether you've registered the net.sf.testng.databinding.TestAnnotationTransformer with TestNG before running the tests? Registering this annotation transformer is needed to get the @DataBinding annotation working. Please see http://testngdatabind.sourceforge.net/apidocs/net/sf/testng/databinding/TestAnnotationTransformer.html for details. Please let me know if this didn't solve the issue. Thanks a lot!

    Kind regards,
    Matt

     

Anonymous
Anonymous

Add attachments
Cancel