1. 程式人生 > >Android 使用Instrumentation進行自動化測試

Android 使用Instrumentation進行自動化測試

mButton.setOnClickListener(new OnClickListener(){  
            public void onClick(View v){  
                String msg = mEditText.getText().toString();  
                if (msg.equals("1")) {  
                    Toast.makeText(getApplicationContext(), "hello_1", Toast.LENGTH_LONG).show();  
                } else if(msg.equals("2")){  
                    Toast.makeText(getApplicationContext(), "hello_2", Toast.LENGTH_SHORT).show();  
                } else {  
                    Toast.makeText(getApplicationContext(), "hello_nothing", Toast.LENGTH_SHORT).show();  
                }  
            }  
        });