Skip to content

Extend Pod::POM::Web::indexer tests#20

Open
paultcochrane wants to merge 6 commits intodamil:masterfrom
paultcochrane:pr/extend-pod-pom-web-indexer-tests
Open

Extend Pod::POM::Web::indexer tests#20
paultcochrane wants to merge 6 commits intodamil:masterfrom
paultcochrane:pr/extend-pod-pom-web-indexer-tests

Conversation

@paultcochrane
Copy link
Copy Markdown
Contributor

These changes increase the code coverage of the Pod::POM::Web::Indexer tests to roughly 70%. This figure is a bit misleading, since the tests themselves are very coarse-grained and require the index to be built at least twice; hence the tests take a minute or two to run. Although this sounds like a bad thing, the increased test coverage means one can be more confident in refactoring the codebase and hence the tests can become more focused over time and thus faster again. It might be a good idea to skip some of the tests using the indexing operations on slow hardware; if you want I could add something like a SLOW_TESTS environment variable and then only when this is set will the slow tests be run.

Anyway, hope these changes help in some way!

The way the indexer tests were skipping the tests if `Search::Indexer`
wasn't available didn't allow further tests to be easily written.  By
putting the check for `Search::Indexer` into a `BEGIN` block, we can
still skip all tests if `Search::Indexer` isn't available, however we
can also more easily add tests to this test suite.
So that its behaviour is specified as part of the test suite.
... this will allow us to move some of the global variables into the
object, thus making tests easier to control.
Now we can set this variable to e.g. a temporary directory in tests so
that we can start testing the indexing code.
Although this causes the test suite to slow down a lot, it at least
tests the code and hence gives some support for later refactoring
efforts.  The indexing operation takes roughly a minute on my box, so
this should not be a problem for other dev machines.  The comment about
the indexing operation taking about half an hour seems as if it could be
outdated.
This function requires the index to have been built, hence we build the
index again in a new temporary directory to ensure a clean slate before
starting the tests.  This could be improved upon by not indexing an
entire Perl installation as part of the tests, however the code needs to
be refactored to allow that and these tests are a step to enabling
such future refactorings.
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

Successfully merging this pull request may close these issues.

1 participant