History log of /external/vogar/test/vogar/android/VogarArgsRule.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
03101ad378a900179c6a4b56598f0c70a1dd10c0 03-Apr-2016 Paul Duffin <paulduffin@google.com> Fix the tests so that they work with OpenJDK

Switches VogarArgsRule to use TestRule instead of the deprecated
MethodRule.

Adds target in Android.mk to build vogar tests with comment on
how to run them and makes test work when ANDROID_BUILD_TOP is
set as it will be when the tests are run from the command line.

Makes org.junit.Assert more consistent with standard JUnit class
so that the tests can be run from the command line.

Added AllAndroidTests suite.

Change-Id: I0a5084451a796992bc1d8ae2bdccf1159b84bedf
/external/vogar/test/vogar/android/VogarArgsRule.java
fbfaf2cea09d4a35fccfd359e8d4e7fdaa5f974f 09-Dec-2015 Paul Duffin <paulduffin@google.com> Fix problem with passing args to runners

There is a bit of a catch 22 situation as the CaliperRunner
needs to use the arguments to determine whether the supplied
class contains any benchmarks but it doesn't know whether the
arguments are intended for Caliper until after it has determined
whether the supplied class contains any benchmarks.

The solution is to catch exceptions thrown by Caliper's parsing
of the arguments and if they occur to print a warning and then
treat all classes as if they were not for Caliper.

This adds some more tests to TestRunnerTest to improve the test
coverage and avoid this issue from recurring. That necessitated
a couple of refactorings.

1) TestRunner is changed to take a Properties parameter in its
constructor to allow them to be supplied by a test.
2) JUnitRunnerFactory sorts the List<VogarTest> to ensure the
order is consistent for skipping past checks.

This adds a TestRunnerRule to facilitate creation of a
TestRunner by tests, in particular the creation of the
Properties that it requires. Tests can specify the properties
for the TestRunner by specifying an @TestRunnerProperties
annotation. It has meaningful defaults for the properties that
TestRunner uses and so tests only have to specify the ones that
they need to change.

As a result of the TestRunnerRule being added the
test.properties file is no longer needed so is deleted.

This also adds an InterceptOutputStreams TestRule which as its
name suggests intercepts output written to System.out/err and
makes it available for testing. That is used to gather the
output from TestRunner to ensure that it is as expected.

This adds an UndeprecatedMethodRule to isolate the fact that
MethodRule is deprecated in JUnit 4.10 but has been
undeprecated in JUnit 4.11 from the other code and to allow the
deprecation warning to be suppressed without affecting any other
code. It will be removed once we have upgraded to 4.11 or above.

Bug: 26125352
Change-Id: Ib3788c2d9fb7809ec2b3829a510168c90874f0c8
/external/vogar/test/vogar/android/VogarArgsRule.java
728771c453dcc68636ebb5944deccd843aceba0c 27-Nov-2015 Paul Duffin <paulduffin@google.com> Add a mechanism to allow tests to specify arguments for Vogar

Vogar supports dozens of different flags and via Run it is tied
in quite tightly into most of the code. Until such time as the
code had been refactored it is necessary when writing tests to
specify some arguments to Vogar. That tight coupling makes it
difficult to provide test specific arguments to Vogar in a clean
way because at the time the test method itself runs Vogar and a
number of other classes have already been created.

Fortunately, JUnit 4 provides a mechanism (MethodRule) to allow
a test method (or an @Before method) access to annotations on
the test method itself. That provides a nice clean way for a
test method to specify the arguments for Vogar.

This adds VogarArgs annotation to specify the arguments and
VogarArgsRule to retrieve them.

Change-Id: I8252d1b00b436f9f9e7e315e3cf2831c3b735cfa
/external/vogar/test/vogar/android/VogarArgsRule.java