﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
12949	[Patch] Use test rule instead of JOSMFixture to speed up tests.	michael2402	team	"During #12937, we noticed a problem with the tests being slow.

A single test takes more than 1s to run due to the slow initialization of the JSOMFixture class.

This patches imporves the situation: We use a TestRule added in JUnit 4.9. This allows us to add custom cleanup code before / after each test case. The code is fine graned so that you can e.g. only instanciate preferences. Preferences use the default preferences and do not write back to disk on default. A basic OSM API is faked (corrently only for image blacklist) - in the old version the capabilies were requested for every test.

I designed the code to be short and make it easy to implement more features. We might improve the performance of some implementations (preferences, platform, ...) in the future but they are already much faster than the normal JOSM fixture.

Using a faked OSM API we can make unit tests not depend on the OSM server - this should be done in integration tests.

The rule supports `forkmode=""once""`

==AddImageryLayerActionTest==
Old:
JOSM src code coverage: 13.5%
Run time using the fork per test policy: 8.369s
Run time using the fork once policy: 1.698s

New:
JOSM src code coverage: 2.6%
Run time using the fork per test policy: 2.265s (most of which are HTTP requests for the TMS/... layers)
Run time using the fork once policy: 0.650s

==SearchCompilerTest==
Old:
JOSM src code coverage: 2.1%
Run time using the fork per test policy: 3.173s
Run time using the fork once policy: 1.122s

New:
JOSM src code coverage: 1.2%
Run time using the fork per test policy: 1.229s
Run time using the fork once policy: 1.084s"	enhancement	closed	major	16.06	Unit tests		fixed	gsoc-core performance	Don-vip bastiK stoecker
