Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run RoboElectric multiple times with different sdk version

Tags:

I have created a RoboElectric test class which i would like to run multiple times,

each time changing the @Config(sdk = Build.VERSION_CODES.{code}) sdk parameter,

Any ideas on how to make this happen without creating new test classes ?

like image 696
leon karabchesvky Avatar asked Jul 18 '16 07:07

leon karabchesvky


1 Answers

Found the solution, MultiApiRobolectricTestRunner will run the test class on multiple API level configurations,

The code should look like this:

@RunWith(MultiApiRobolectricTestRunner.class)
@Config(sdk = {20, 21, 22})
public class IntegrationTest {}
like image 81
leon karabchesvky Avatar answered Oct 06 '22 01:10

leon karabchesvky