Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAutomatic translator testing as part of the continuous integration #1310
Comments
This comment has been minimized.
This comment has been minimized.
I'm mostly done with a test runner that runs import tests and know how I'm going to implement export tests. web tests should also be feasible. Not all tests pass yet, but the import tests in all translators that have them run in a second or so. |
This comment has been minimized.
This comment has been minimized.
(and it does indeed show diffs) |
This comment has been minimized.
This comment has been minimized.
To be clear, though, there's already a test runner — we don't need a new one (but the existing one can be improved). |
This comment has been minimized.
This comment has been minimized.
That's cool, then it will be just for me. Is the existing one planned to be ran on every checkin/PR? |
This comment has been minimized.
This comment has been minimized.
That's what this ticket is for, yes. As I mentioned in the other thread, we already have daily translator tests using the same test runner used in Scaffold. For CI tests, we'd test just the modified translator. We could consider also testing translators that depend on the modified one, but that could mean hundreds of translators for something like RIS, so it probably makes more sense just to make sure those translators have appropriate coverage in their own tests. |
This comment has been minimized.
This comment has been minimized.
I'm still seeing some unexpected things assuming the existing test already run daily. I'm not sure about any of this though, please be gentle -- these are what I found, but the way I found it could be way off base. testcase 2 (and a similar issue in testcase 6) in RIS.js: the input has maybe more a question than anything else, but in testcase 3 and 5 of RIS.js, the in testcase 7 of RIS.js there's a BibTeX.js test case 8 misses an Frieze.js has a syntax error (#1820) |
This comment has been minimized.
This comment has been minimized.
The existing translator tests are purely informational, and as you can see in the results, a large number are currently failing, for various reasons: because of genuine problems, because the tests are out of date (the tests were down for a long time until fairly recently), or simply because the translator tester doesn't run JS and therefore doesn't have access to the same initial page DOM that exists when web translators are run in the browser.
It looks like
6403 is the last line of the file, so not sure which line you mean, but |
This comment has been minimized.
This comment has been minimized.
I thought the accessDate didn't change for imports? Maybe web, but straight imports should just believe the accessDate being passed right? I meant line 867, not 6403, sorry. |
This comment has been minimized.
This comment has been minimized.
Yes. I noted that on the linked ticket.
Looks like that's only in ProCite mode, but I don't know the details here. |
This comment has been minimized.
This comment has been minimized.
But accessDate isn't always stripped -- Bookmarks.js has an accessdate in the In any case, found a few things, cool, on to other stuff. |
This comment has been minimized.
This comment has been minimized.
Just to be clear @retorquere -- getting the test runner working via CI on builds would be a huge help to @zuphilip and me, so I don't think anyone wants to discourage you from helping with that -- very much on the contrary. The way I'm understanding Dan was only that he wanted to save you from duplicating existing work. |
This comment has been minimized.
This comment has been minimized.
Just tell me where I can help, I'm big on automated tests and still a little shook that I PRed a breaking change -- getting tests running is an atonement for that in part. But with regard to duplicating existing work, there's this thing I'm working on you may know that duplicates the BibTeX exporter |
This comment has been minimized.
This comment has been minimized.
That's right and I can now see that happening (thanks for the pointer), but looking at https://translator-tests.zotero.org/ though I see two mentions of
in the log for RIS, and from my understanding, fields that trigger such warnings are not imported, right? If that is right, those two testcases in the RIS file shouldn't have the |
This comment has been minimized.
This comment has been minimized.
For local testing Zotero translators there is also the built-in page Anyway, running the test cases automatically for each PR would indeed be very appreciated! However, I am not so sure that the plan I outlined here at the very beginning is still the way to go. I would imagine more that we now can install |
This comment has been minimized.
This comment has been minimized.
Can I do a shallow clone of translation-server including submodules and expect it to work? I'm on a fairly slow link and the recursive clone is taking ages. |
added a commit
to zotero/translation-server
that referenced
this issue
Feb 2, 2019
This comment has been minimized.
This comment has been minimized.
I've made a few tweaks to translation-server's test runner (which is what's used for the daily full tests) so that it can be used for this. Here's what a Travis config will need to do:
Or something like that. Basically If any tests fail, it will exit with a non-0 exit code. Later, we'll probably want to improve/colorize the output from that script. |
This comment has been minimized.
This comment has been minimized.
There are also |
This comment has been minimized.
This comment has been minimized.
404 is a test failure -- often that means that the site has moved or closed down. 403 is trickier because whoever is testing may not have the same access as the person creating the test. No idea where tests of type artwork come from but I agree that sounds like web. |
This comment has been minimized.
This comment has been minimized.
Maybe, we should have a possibility to classify how openly a test case is accessible. At least for automated testing like in CI we would need to skip them.
I see this type in |
This comment has been minimized.
This comment has been minimized.
How about mocking out web access by saving the pages as part of the test suite? That would remove one source of spurious errors and also speed up the tests - and I'm seeing lots more of these, and also 500 errors and redirect loops. In more general terms I'd argue against tests that require login access; I realize some sites only have content when logged in but again mocked GET requests would get around that. |
This comment has been minimized.
This comment has been minimized.
What to make of translators that have |
This comment has been minimized.
This comment has been minimized.
That would defeat the main purpose of the tests, which is to make sure they’re still working on the sites where they’re supposed to work. (It also wouldn’t work for many tests, which require follow-up requests.) We do try to mock web requests in client tests, where we’re interested in testing the client architecture itself. |
This comment has been minimized.
This comment has been minimized.
Marking tests that aren’t expected to work publicly makes sense to me, though. |
This comment has been minimized.
This comment has been minimized.
Fair enough - there's two ways to see these tests I guess; protecting against code breakage, and making sure they track the current version of the site. My mind went to the other kind. But for tests that require login, who will ever run these? |
This comment has been minimized.
This comment has been minimized.
(in my local tests I had doGet mocked to cache responses, so followup requests would work) |
This comment has been minimized.
This comment has been minimized.
They are useful to run, when changing the code. Whoever will work on the translator will also have access to the database and thereby can prove that the results are either the same, or improving, or getting worse. Thereby we can maintain sites and help these collaborators to work on them even when we don't have access to the sites ourselves. |
This comment has been minimized.
This comment has been minimized.
Example? |
This comment has been minimized.
This comment has been minimized.
My bad -- I had picked up |
This comment has been minimized.
This comment has been minimized.
@adam3smith might remember why that was originally added in 2012, though. The variable in Web of Science isn't used. |
This comment has been minimized.
This comment has been minimized.
Not as bad as I thought with broken tests -- 49 broken test cases across all import/web testcases, and 17 requiring auth. How will we mark these? Add |
This comment has been minimized.
This comment has been minimized.
Uh forget about marking reasons for error -- I just did that locally to speed up sussing out which cases were failing. |
This comment has been minimized.
This comment has been minimized.
No, sorry. Especially for RefWorks Tagged, this doesn't make any sense since that's not called from any web translator, nor would we expect it to be. I was relatively new to writing import translators in 2012, so I'm guessing this was just a mistake on my part, likely based on some sloppy copy&paste job. |
This comment has been minimized.
This comment has been minimized.
@retorquere is your work on this visible already? Just curious to take a look. |
This comment has been minimized.
This comment has been minimized.
It's visible but only half-finished as I mean to focus on the translation-server based tests (but I still do use it for quicky tests). A patch that marks translators as broken or requiring auth so my test runner skips them is at https://gist.github.com/8fc7abd258dda9ac7f848ccbc5f1989d; I've not checked this in as I don't mean to submit bulk PRs without discussion first. The test runner (unfinished as it is) lives at https://github.com/retorquere/translators/blob/eslint/.ci/index.js |
This comment has been minimized.
This comment has been minimized.
https://github.com/retorquere/translators/blob/ci/.ci/index.js implements the steps from #1310 (comment) but even when I intentionally introduce errors, I get a 0 exit status. |
zuphilip commentedMay 28, 2017
It would be really good to have automatic translator testing as part of the continuous integration. This doesn't have to be a strict test, but the information could be just shown for all participants of a PR.
I imagine something like this:
a. The same instance we are using now for the daily testing.
b. The same machine but different instance we are using now for the daily testing.
c. Some service like heroku should be easy to set up with the Dockerfile
a. Travis CI which we already use
b. CircleCI or anything else