Modify

Opened 3 years ago

Closed 4 months ago

Last modified 4 months ago

#16637 closed defect (fixed)

Rework unit tests to not depend on external website

Reported by: Don-vip Owned by: team
Priority: normal Milestone: 20.11
Component: Unit tests Version:
Keywords: Cc: ris

Description (last modified by simon04)

We still have some unit tests making real network connections, failing when the website is slow or unreachable:

  1. ✔ org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClientTest.testCookieHandlingMock
  2. org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClientTest.testCookieHandlingCookieManager
  3. ✔ org.openstreetmap.josm.gui.preferences.server.ApiUrlTestTaskTest.testNominalUrl
  4. ✔ org.openstreetmap.josm.gui.preferences.server.ApiUrlTestTaskTest.testAlertInvalidServerResult
  5. ✔ org.openstreetmap.josm.io.OsmServerHistoryReaderTest.testWay
  6. ✔ org.openstreetmap.josm.io.OsmServerHistoryReaderTest.testNode
  7. ✔ org.openstreetmap.josm.tools.HttpClientTest.testOpenUrlBzip
  8. ✔ org.openstreetmap.josm.tools.HttpClientTest.testOpenUrlGzip
  9. ✔ org.openstreetmap.josm.tools.HttpClientTest.testTicket9660

Attachments (0)

Change History (18)

comment:1 Changed 3 years ago by ris

There also those that unintentionally make network requests, e.g. fetching the "start page" from the wiki.

comment:2 Changed 3 years ago by Don-vip

In 14191/josm:

see #16637 - javadoc

comment:3 Changed 5 months ago by simon04

Related: #15102

comment:4 Changed 5 months ago by Don-vip

In 17075/josm:

see #15102 - see #16637 - get rid of real HTTP calls to http://httpstat.us in unit tests, mock them

comment:5 Changed 5 months ago by Don-vip

In 17154/josm:

see #15102 - see #16637 - get rid of real HTTP calls to https://httpbin(go).org in unit tests, mock them

comment:6 Changed 5 months ago by simon04

In 17189/josm:

see #15102 - see #16637 - get rid of real HTTP calls to https://josm.openstreetmap.de/josmticket in unit tests, mock them

comment:7 Changed 5 months ago by simon04

Milestone: 20.10

comment:8 Changed 5 months ago by simon04

In 17192/josm:

see #15102 - see #16637 - get rid of real HTTP calls to https://api.openstreetmap.org in ApiUrlTestTaskTest, mock them

comment:9 Changed 5 months ago by simon04

In 17194/josm:

see #15102 - see #16637 - get rid of real HTTP calls to https://api.openstreetmap.org in OsmServerHistoryReaderTest, mock them

comment:10 Changed 5 months ago by simon04

In 17195/josm:

see #15102 - see #16637 - Use WireMockServer.url()

comment:11 Changed 5 months ago by simon04

In 17196/josm:

see #15102 - see #16637 - get rid of real HTTP calls to https://www.openstreetmap.org/login in OsmOAuthAuthorizationClientTest, mock them

comment:12 Changed 5 months ago by simon04

Description: modified (diff)

comment:13 Changed 5 months ago by simon04

In 17197/josm:

see #15102 - see #16637 - get rid of real HTTP calls to https://www.openstreetmap.org/trace in HttpClientTest, mock them

comment:14 Changed 5 months ago by simon04

Description: modified (diff)

comment:15 in reply to:  13 Changed 5 months ago by skyper

Replying to simon04:

In 17197/josm:

see #15102 - see #16637 - get rid of real HTTP calls to https://www.openstreetmap.org/trace in HttpClientTest, mock them

This broke some other test.
Are failing tests a reason for not building the ubuntu package?

comment:16 Changed 5 months ago by simon04

In 17211/josm:

see #15102 - see #16637 - Fix HttpClientTest

comment:17 Changed 4 months ago by Don-vip

Resolution: fixed
Status: newclosed

comment:18 Changed 4 months ago by Don-vip

Milestone: 20.1020.11

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.