Hi, why not handle all unit tests that access external services as integration-tests? IMHO these are no unit tests anymore if they access an external resource. So migrating them to integration-tests would be solution.
Best, - Fabian 2012/9/25 Rupert Westenthaler <[email protected]>: > Hi, > > I can confirm that > > 1. the Integration tests do run in OfflineMode > 2. that the CELI engines do support OfflineMode and therefore > deactivate themselves if stanbol is started in OfflineMode > > For Unit Tests it is a real dilemma because on the one hand failing > tests because of non-functional (or non reachable) external services > are inconvenient on the other hand without running those tests with > normal tests there is a good change that we will miss API (and data > changes) of those external Services. E.g. some time ago the confidence > values provided by geoname.org changed from [0..1] to [0..*]. This > would have been not detected without running the those test with every > build. > > So what I typically do is to catch IOExceptions that typically result > of unreachable (or timed out) calls to external services. This ensures > that test do not fail if the external service is down - or the > developer does not have a internet connection while still ensuring > that the Stanbol Engines are validated against the external services > with every build. > > I will have a look what kind of Exception caused the failed build and > make sure that those do cause tests to be skipped for future builds. > > WDYT > Rupert > > On Mon, Sep 24, 2012 at 2:28 PM, Reto Bachmann-Gmür <[email protected]> wrote: >> On Mon, Sep 24, 2012 at 1:37 PM, Bertrand Delacretaz <[email protected] >>> wrote: >> >>> On Mon, Sep 24, 2012 at 12:19 PM, Reto Bachmann-Gmür <[email protected]> >>> wrote: >>> > On Mon, Sep 24, 2012 at 8:54 AM, Bertrand Delacretaz < >>> [email protected] >>> >> On Sunday, September 23, 2012, Reto Bachmann-Gmür wrote: >>> >> > ...I think the tests shold not access external services... >>> >> Yes - there's OfflineMode for that. >>> >> >>> > ...The offline mode is for not updating libraries from the remote repos. >>> If I >>> > have the libraries in the local repository I can use the offline mode. If >>> > tests are skipped in offline mode this means that some projects might >>> buil >>> > with -o and fail otherwise... >>> >>> Sorry I was too terse maybe, didn't mean maven's offline mode, but the >>> STANBOL-86 OfflineMode service, which allows you to modify your >>> service's behavior when the system should not make any external >>> requests, which IMO is needed when running our automated tests. >>> >> >> The test that was failing was a unit tests that doesn't use OSGi and thus >> couldn't use STANBOL-86. >> >> For the integration tests STANBOL-86 seems a good approach. If understand >> STANBOL-87 <https://issues.apache.org/jira/browse/STANBOL-87> correctly the >> integrations tests are always run in offline mode. I think the unit tests >> should always be offline while for the integration tests it might be good >> to have the options to check if things integrate with the outside world. >> >> Cheers, >> Reto >> >> >>> -Bertrand >>> > > > > -- > | Rupert Westenthaler [email protected] > | Bodenlehenstraße 11 ++43-699-11108907 > | A-5500 Bischofshofen -- Fabian http://twitter.com/fctwitt
