Page MenuHomePhabricator

Port bin/parserTests.js, the parser tests runner script
Closed, ResolvedPublic

Description

Parsoid has a parser tests runner which supports a lot of options over and beyond what the existing PHP version of the test runner supports.

So, we have one of two paths forward:

  • Either port the JS version to PHP
  • Copy over the PHP version from core and upgrade it to support the features that the JS version supports

We need to figure out which of the two solutions is simpler and makes more sense.

Event Timeline

ssastry triaged this task as High priority.May 30 2019, 4:48 PM
ssastry added subscribers: Anomie, Tgr.
ssastry added a subscriber: Arlolra.

Given our goal of wanting to run parser tests independently in this code base without having MediaWiki checked out and integrated, it makes sense to port our JS runner. The core runner has tighter integration with MediaWiki internals and isn't suitable if we are serious about the isolation goal. If at a later point, this goal is no longer relevant, we can revisit.

But, couple of things that came up in discussion in the parsing team meeting:

  • this needs to run via both command line and via PHPUnit. Core parser tests runner had to do a bunch of refactoring to enable that. So, probably look at that design for our version.
  • we need to figure out how to hook this up with the coverage tool.
  • we would need to replace mockAPI.js (used by the JS parserTests runner) with ParserTests version of SiteConfig, PageConfig, and DataAccess classes. Probably by deriving the exising tests/mocks/Mock* versions of these to hardcode implementation decisions and values specific to parser tests.
  • eventually, we do want a single parser tests runner, and so if there is a way we can use this runner with a --legacy flag to run against the Parser.php parser vs. Parsoid, that would be ideal. But, this is probably better done as part of the "Unify Parsers" phase, not right away.
  • we would also need to support running parser tests for extensions - but, this is harder to support right now till we work out all the details of the extension API, and porting those extensions. So, this is is probably also better done as part of the "Unify Parsers" phase, not right away.

Change 520341 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] Port ParserTests Grammar file

https://gerrit.wikimedia.org/r/520341

Change 520343 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] js2php: Generate tests/TestUutils.php & update tools/ScriptUtils.php

https://gerrit.wikimedia.org/r/520343

Change 520341 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Port ParserTests Grammar file

https://gerrit.wikimedia.org/r/520341

Change 520343 merged by Subramanya Sastry:
[mediawiki/services/parsoid@master] Init parserTests runner files via js2php

https://gerrit.wikimedia.org/r/520343

Change 520358 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] WIP: Port tests/TestUtils.php & bin/parserTests.php

https://gerrit.wikimedia.org/r/520358

Change 523330 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] WIP: Port parserTests script with associated classes and utils

https://gerrit.wikimedia.org/r/523330

Change 520358 abandoned by Subramanya Sastry:
WIP: Port tests/TestUtils.php & bin/parserTests.php

Reason:
Covered by gerrit 523330 .. I forgot to update change-id to this patch.

https://gerrit.wikimedia.org/r/520358

Change 521351 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] Port tools/ScriptUtils

https://gerrit.wikimedia.org/r/521351

Change 523329 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] Port ParserTests-specific extensions and enhance ParsoidExtensionAPI

https://gerrit.wikimedia.org/r/523329

Change 522635 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] Port mockAPI.js as MockAPIHelper for use with ParserTests

https://gerrit.wikimedia.org/r/522635

Change 521351 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Port tools/ScriptUtils

https://gerrit.wikimedia.org/r/521351

Change 523329 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Port ParserTests-specific extensions and enhance ParsoidExtensionAPI

https://gerrit.wikimedia.org/r/523329

Change 522635 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Port mockAPI.js as MockAPIHelper for use with ParserTests

https://gerrit.wikimedia.org/r/522635

Change 523330 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Port parserTests script with associated classes and utils

https://gerrit.wikimedia.org/r/523330