Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing ability to pass information about test method to a data provider method #28

Merged
merged 3 commits into from
Jul 7, 2014

Conversation

barancev
Copy link
Contributor

@barancev barancev commented Jul 3, 2014

No description provided.

@aaschmid
Copy link
Member

aaschmid commented Jul 3, 2014

Hi @barancev,

nice idea. May I ask what you want to do with it? Just for my curiosity and use cases for documentation :-)

Cheers,
Andreas

@barancev
Copy link
Contributor Author

barancev commented Jul 3, 2014

This feature allows to create "universal data providers" that can be configured via annotations assigned to test methods, for example:

@Test
@UseDataProvider("loadFromFile")
@TestDataFile("file1.dat")
public void test1() { ... }

@Test
@UseDataProvider("loadFromFile")
@TestDataFile("file2.dat")
public void test2() { ... }

@DataProvider
public static Object[][] loadFromFile(FrameworkMethod testMethod) throws IOException {
  File testDataFile = new File(testMethod.getAnnotation(TestDataFile.class).value());
  // load data from the specified file and return it
}

@barancev
Copy link
Contributor Author

barancev commented Jul 3, 2014

Yes, passing null to call as static is correct, my bad.

@aaschmid
Copy link
Member

aaschmid commented Jul 4, 2014

Yes, passing null to call as static is correct, my bad.

Can you change this directly in the pull request by adding just another commit to your branch from which the pull request is generated?

And an acceptance test (= example) using the new feature in com.tngtech.test.java.junit.dataprovider.DataProviderJavaAcceptanceTest would be great (but I can do it on the weekend as well as I know understand the use case ;-) )

Thanks a lot for contributing!

@barancev
Copy link
Contributor Author

barancev commented Jul 4, 2014

Will do both on the weekend

@aaschmid
Copy link
Member

aaschmid commented Jul 4, 2014

Great, looking forward to it ... thanks a lot!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling ddf8ac9 on barancev:master into 0f40ab2 on TNG:master.

@barancev
Copy link
Contributor Author

barancev commented Jul 7, 2014

Done

aaschmid added a commit that referenced this pull request Jul 7, 2014
Implementing ability to pass information about test method to a data provider method
@aaschmid aaschmid merged commit eea5327 into TNG:master Jul 7, 2014
aaschmid added a commit that referenced this pull request Jul 7, 2014
aaschmid added a commit that referenced this pull request Jul 7, 2014
@aaschmid
Copy link
Member

aaschmid commented Jul 7, 2014

Thank you very much, I have just added another test and refactored the code a bit. Also added release notes and example as you may see ...

@barancev
Copy link
Contributor Author

barancev commented Jul 7, 2014

Thanks! Also remove it from the TBD section of the README

@aaschmid
Copy link
Member

aaschmid commented Jul 7, 2014

But it's not release for now ... I will change the section as soon as I will release a new version, ok? Hopefully at the end of the week, will that be ok for you?

@barancev
Copy link
Contributor Author

barancev commented Jul 7, 2014

OK

@aaschmid aaschmid self-assigned this Aug 15, 2014
@aaschmid aaschmid added this to the v1.8.0 milestone Aug 15, 2014
@aaschmid aaschmid removed the fixed label Aug 15, 2014
@aaschmid
Copy link
Member

Hi @barancev,

I know that your PR request is a long time ago. Can you hereby agree to the new CLA:

  • You will only submit contributions where you have authored 100% of the content.
  • You will only submit contributions to which you have the necessary rights. This means in particular, that if you are employed you have received the necessary permissions from your employer to make the contributions.
  • Whatever content you contribute will be provided under the project license(s) (see "LICENSE.txt")

Thank you very much again for your PR :-)

@barancev
Copy link
Contributor Author

Yes, I confirm I agree to this CLA.

@aaschmid
Copy link
Member

Thanks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants