I’m using Robotium to do some simple UI tasks on my unit testing project. I noticed Solo being significantly slower, I dont know why. I’m new to it.
This code is done with Robotium:
solo.clearEditText(editTextLogin);
solo.clearEditText(editTextSenha);
solo.enterText(editTextLogin, "tecnico@mail.com");
solo.enterText(editTextSenha, "12345");
solo.clickOnButton(0);
This is done with native code:
m_Activity.runOnUiThread(new Runnable() {
@Override
public void run() {
editTextLogin.setText("tecnico@mail.com");
editTextSenha.setText("12345");
loginButton.performClick();
}
});
The code performed with Robotium is much slower when compared to the second one. I can figure easily that Robotium is actually mechanically doing all the stuff, while the native code is just setting values to objects, which can explain the difference, but my question best explained would be, when to use Robotium, the way it should be, the way the real performance gain can be achieved.
My apologize for any mistakes.
It calls my attention you are so worried about test performance.
Android UI testing methods are quite complicated and leaves you with a test case that’s hard to follow. Robotium is not focused on performance, it’s focus in making an API accesible by developers to make their tests easier to write and read.
I wouldn’t try to determine what’s the most performant way to do a test. I would do it in Robotium, since it’s easier to code and afterwards porting to native if necessary.
In my personal case I don’t care Robotium making my tests slower. If that’s the price I have to pay to avoid using the native UI testing tool, I am cool with that.
If the test takes too much time you can always run in your CI.