jeudi 28 juillet 2016

Android testing menu content

I create menu just like tutorial says.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.game_menu, menu);
    return true;
}

I want to write a JUnit test that checks if menu items strings are correct. However I don't know how can I do something like getMenu() from outside MainActivity class and then get menu items to strings or a list. Also I can't declare field 'menu'. Thanks for help.

Aucun commentaire:

Enregistrer un commentaire