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

Set up automated unit tests #66

Open
MER-C opened this issue Mar 21, 2015 · 12 comments
Open

Set up automated unit tests #66

MER-C opened this issue Mar 21, 2015 · 12 comments

Comments

@MER-C
Copy link
Owner

MER-C commented Mar 21, 2015

Now that we're on Github, we have access to some CI tools e.g. Travis-CI. This would be great for running unit tests automatically.

@MER-C
Copy link
Owner Author

MER-C commented Apr 2, 2015

That was much less traumatic than I anticipated. Codeship can also automatically deploy to Google App Engine -- something we should make happen. This includes generating Javadoc.

@Nirvanchik
Copy link

Nirvanchik commented Jul 18, 2016

Wow looks interesting. Are you talking about https://en.wikipedia.org/wiki/Travis_CI ?
Also, generating Javadoc - is very suitable. But I saw it at https://wikipediatools.appspot.com/doc/index.html How did you do that?

I have just checked the page: https://github.com/integrations - really impressive.

@Nirvanchik
Copy link

Nirvanchik commented Jul 18, 2016

Also, it would be nice to compile Wiki.java to JAR library and upload to Maven.
I am very close now to the moment when I don't need patches to Wiki.java, or in other words Box version of wiki.java satisfes me and I can just fetch Wiki-java.jar with Ivy (Maven/Gradle/whatsever) and not copy-paste it to the project.

I apologize. Just stumbled upon #88

@Nirvanchik
Copy link

How do you like to write tests?
by scope:

  1. Go with just one "smoke" test for each feature. Feature works and we are fine.
  2. Deep full testing. Test-cases cover all good & bad occasions, inputs & conditions for feature.

by infrastructure:

  1. Mock everything. Mock fetch(), post(), mock HTTP responce.
  2. Do not mock nothing (anything). No mocks. Test on real Wiki, on real Internet, on real data.

I see you chose 2) but instead of real Wikipedia you use test.wikipedia.org with test pages specially created for that. Hm. LGTM. Regular testing on real Mediawiki ensures stability and freshness.

@Nirvanchik
Copy link

I consider using getMax() instead of hardcoded "max" in "&tllimit=max" or similar.
This is for testing.
In tests you are not going to create 501 pages for your 1 test-case. You are ok with 2-3 pages and for that you should be able to set limit other than 500 (max).

@MER-C
Copy link
Owner Author

MER-C commented Jul 22, 2016

Codeship is similar. Two test classes are necessary because there are some things that can never be unit tested due to dynamic content (e.g. recentchanges). I would like the unit tests to cover as much as possible, but writing them is not particularly interesting.

@Nirvanchik
Copy link

What about using Mockito in tests?
I know Wiki-java has no dependencies yet and this is cool. Mockito would be a dependency and break this ideal feature.

But you can't imagin how powerful and useful it is.

@maflcko
Copy link
Contributor

maflcko commented Oct 13, 2016

I am not familiar with Codeship. Does it run on pull requests and return the result so it can be displayed on GitHub? Otherwise, I'd suggest using travis-ci.org.

@intracer
Copy link
Contributor

Implemented Travis CI support #141

@MER-C
Copy link
Owner Author

MER-C commented Nov 18, 2016

Codeship allows direct push to Google App Engine, which is something I want to set up eventually.

@tiramon
Copy link

tiramon commented Aug 9, 2017

Testcase 'org.wikipedia.WikiUnitTest.diff' is failing since August 4th

@tiramon
Copy link

tiramon commented Aug 9, 2017

And after reading the discussion i like Mockito to fake remote content, works fine for my testcases
Or PowerMock if you need a more powerful version and you have to fake output of static method etc.

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

No branches or pull requests

6 participants
@intracer @tiramon @maflcko @MER-C @Nirvanchik and others