HW-SWeL / BMUSE

Bioschemas Mark Up Scraper and Extractor
https://app.swaggerhub.com/apis-docs/swel/BMUSE/
Apache License 2.0
3 stars 5 forks source link

Fix broken tests #74

Open AlasdairGray opened 3 years ago

AlasdairGray commented 3 years ago

Several tests relied on external pages which have either become unavailable or changed their content.

Some tests have been fixed to URLs in our control, but ideally no test should rely on an external URL.

In commit f06e621 the failing tests were set to be ignored.

AlasdairGray commented 2 years ago

On a fresh checkout of the dev branch, the following errors were obtained (after getting the chromedriver installed and configured):

[ERROR] Tests run: 11, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 4.462 s <<< FAILURE! - in hwu.elixir.scrape.scraper.ScraperCoreTest
[ERROR] test_getHtml(hwu.elixir.scrape.scraper.ScraperCoreTest)  Time elapsed: 0.461 s  <<< ERROR!
java.lang.NullPointerException
    at hwu.elixir.scrape.scraper.ScraperCoreTest.test_getHtml(ScraperCoreTest.java:127)

[ERROR] test_getHtml_404(hwu.elixir.scrape.scraper.ScraperCoreTest)  Time elapsed: 0.147 s  <<< FAILURE!
java.lang.AssertionError: Expected exception: hwu.elixir.scrape.exceptions.FourZeroFourException
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   ScraperCoreTest.test_getHtml_404 Expected exception: hwu.elixir.scrape.exceptions.FourZeroFourException
[ERROR] Errors:
[ERROR]   ScraperCoreTest.test_getHtml:127 NullPointer
[INFO]
[ERROR] Tests run: 35, Failures: 1, Errors: 1, Skipped: 3
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Scraper 0.5.2:
[INFO]
[INFO] Scraper ............................................ SUCCESS [  0.440 s]
[INFO] Scraper ............................................ FAILURE [ 58.737 s]
[INFO] Elixir scraper webapp .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  59.329 s
[INFO] Finished at: 2022-06-10T15:02:06+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project core: There are test failures.
AlasdairGray commented 2 years ago

May be better to do this with GitHub raw pages rather than the HWU servers