开发者

Where do I add my application source code in the CTS?

http://i-miss-erin.blogspot.com/2010/04/android-cts-compatibility-test-suite.html

I did according to the instructions mentioned in the above link, but I got some errors about the source code of the SimpleCalculator application. I wrote a SimpleCalculator application and I wrote testcases for that SimpleCalculator application. Then I added my test code as described above, but where do I have to add my SimpleCalculator applications source code? Without adding the SimpleCalculator application source code I tried to execute make cts but it gives me some error.

My test program is:

package com.example.SimpleCalculator.test;

import android.test.ActivityInstrumentationTestCase2;
import android.text.method.KeyListener;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.example.SimpleCalculator.Calculator;

public class SimpleCalculatorTest extends
        ActivityInstrumentationTestCase2<Calculator> {
    private Calculator mActivity;
    private EditText myEditText;
    private Button b1,b2;
    int operand1=0,operand2=0;char operator;

    public  SimpleCalculatorTest(){

        super("com.example.SimpleCalculator",Calculator.class);

        }

    @Override
    protected void setUp() throws Exception{
        super.setUp();
        mActivity=this.getActivity();

        myEditText=(EditText)mActivity.findViewById(com.example.SimpleCalculator.R.id.editText1);
        b1=(Button)mActivity.findViewById(com.example.SimpleCalculator.R.id.digit1_button);

        b2=(Button)mActivity.findViewById(com.example.SimpleCalculator.R.id.digit2_button);
    }
    /*public void testPressButton1()
    {

         System.out.println(operand1);
         System.out.println(operand2);
        assertEquals(1,Integer.parseInt((String)b1.getText()));
    }*/
    public void testPressButton2()
    {
        //Calculator cal=new Calculator();
        //b1.setOnClickListener((OnClickListener) cal.b1);
        //System.out.println(Integer.parseInt((String)b2.getText()));
        //System.out.println(Integer.parseInt((String)b1.getText()));
        assertEquals(2,Integer.parseInt((String)b2.getText()));
    }
    public void testcompute(){
        Calculator cal=new Calculator();
        int expectres=cal.compute(2,9,'+');
        System.out.println(expectres);
        assertEquals(11,expectres);
        int expectres1=cal.compute(2,9,'*');
        System.out.println(expectres1);
        assertEquals(18,expectres1)开发者_JAVA技巧;

    }


}

My error messages are:

target Java: SimpleCalculatorTests (out/debug/target/common/obj/APPS/SimpleCalculatorTests_intermediates/classes)
cts/tests/tests/SimpleCalculator1/src/com/example/SimpleCalculator/test/SimpleCalculatorTest.java:9: cannot find symbol
symbol  : class Calculator
location: package com.example.SimpleCalculator
import com.example.SimpleCalculator.Calculator;
                                   ^
cts/tests/tests/SimpleCalculator1/src/com/example/SimpleCalculator/test/SimpleCalculatorTest.java:12: cannot find symbol
symbol: class Calculator
        ActivityInstrumentationTestCase2<Calculator> {
                                         ^
cts/tests/tests/SimpleCalculator1/src/com/example/SimpleCalculator/test/SimpleCalculatorTest.java:13: cannot find symbol
symbol  : class Calculator
location: class com.example.SimpleCalculator.test.SimpleCalculatorTest
    private Calculator mActivity;
            ^
cts/tests/tests/SimpleCalculator1/src/com/example/SimpleCalculator/test/SimpleCalculatorTest.java:20: cannot find symbol
symbol  : class Calculator
location: class com.example.SimpleCalculator.test.SimpleCalculatorTest
        super("com.example.SimpleCalculator",Calculator.class);
                                             ^
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜