TodayDoneDone / donedone-android

던던 안드로이드 클라이언트 개발 공간
MIT License
3 stars 0 forks source link

Instrumentation 테스트에서 activity 대신 xml를 이용한 테스트 환경 만들기 #20

Open heesung6701 opened 1 year ago

heesung6701 commented 1 year ago

체크리스트

요약

Waffle 위젯 테스트에서 Test Activity를 만들지 않고 테스트 할 수 있는 환경을 고려 해본다.

필요한 이유

widget을 테스트 하기 위해서 매번 테스트 액티비티를 만드는 것을 불필요한 코드를 만들게 된다.

목표

XmlParser를 이용하여 Widget을 동적으로 생성하는 테스트 코드를 만든다.

추후 목표

No response

계획

논의 사항

참고 코드 CTS(AOSP 테스트 코드) 내 ButtonTest

[Context](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/content/Context.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=117) [context](https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;bpv=1;bpt=1;l=37?q=ButtonTest&ss=android&gsn=context&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fandroid.googlesource.com%2Fplatform%2Fsuperproject%3Flang%3Djava%3Fpath%3Dandroid.widget.cts.ButtonTest%2336c7a2ae2e8512d63b5e62d7762c6bfec28857b3701ed463abbf049163bab6ac) = [InstrumentationRegistry](https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;bpv=1;bpt=1;l=37?q=ButtonTest&ss=android&gsn=InstrumentationRegistry&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fandroid.googlesource.com%2Fplatform%2Fsuperproject%3Flang%3Djava%3Fpath%3Dandroidx.test.InstrumentationRegistry%23d1bd77fa5f1a100ef4ace5fdbc7559cfaa73d16c2e0fc7f7b9f90495408aca33).[getTargetContext](https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;bpv=1;bpt=1;l=37?q=ButtonTest&ss=android&gsn=getTargetContext&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fandroid.googlesource.com%2Fplatform%2Fsuperproject%3Flang%3Djava%3Fpath%3Dandroidx.test.InstrumentationRegistry%235204d3a0e6c081e9b51c60d144a18d618533acc79cc9f6b2cbd844e79a4f4713)();
        [XmlPullParser](https://cs.android.com/android/platform/superproject/+/refs/heads/master:libcore/xml/src/main/java/org/xmlpull/v1/XmlPullParser.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=141) [parser](https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;bpv=1;bpt=1;l=38?q=ButtonTest&ss=android&gsn=parser&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fandroid.googlesource.com%2Fplatform%2Fsuperproject%3Flang%3Djava%3Fpath%3Dandroid.widget.cts.ButtonTest%233b6b6bf46ec05e2fa332973a72df9dc9b8725bff3b0dabb4fa5a960e6d904f75) = [context](https://cs.android.com/android/platform/superproject/+/refs/heads/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=37?q=ButtonTest&ss=android).[getResources](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/content/Context.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=629)().[getXml](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/content/res/Resources.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=1311)([R](https://cs.android.com/android/platform/superproject/+/refs/heads/master:out/soong/.intermediates/cts/tests/tests/widget/CtsWidgetTestCases/android_common/xref/srcjars.xref/android/widget/cts/R.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=10).[layout](https://cs.android.com/android/platform/superproject/+/refs/heads/master:out/soong/.intermediates/cts/tests/tests/widget/CtsWidgetTestCases/android_common/xref/srcjars.xref/android/widget/cts/R.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=1309).[togglebutton_layout](https://cs.android.com/android/platform/superproject/+/refs/heads/master:out/soong/.intermediates/cts/tests/tests/widget/CtsWidgetTestCases/android_common/xref/srcjars.xref/android/widget/cts/R.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=1420));
        [AttributeSet](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/util/AttributeSet.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=62) [attrs](https://cs.android.com/android/platform/superproject/+/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;bpv=1;bpt=1;l=39?q=ButtonTest&ss=android&gsn=attrs&gs=KYTHE%3A%2F%2Fkythe%3A%2F%2Fandroid.googlesource.com%2Fplatform%2Fsuperproject%3Flang%3Djava%3Fpath%3Dandroid.widget.cts.ButtonTest%239a67eea4c40446ac9b0947aea2834a76a0ef0331d63056ad071a74c7b58a5390) = [Xml](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/util/Xml.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=54).[asAttributeSet](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/util/Xml.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=382)([parser](https://cs.android.com/android/platform/superproject/+/refs/heads/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=38?q=ButtonTest&ss=android));

        new [Button](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/widget/Button.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=140)([context](https://cs.android.com/android/platform/superproject/+/refs/heads/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=37?q=ButtonTest&ss=android), [attrs](https://cs.android.com/android/platform/superproject/+/refs/heads/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=39?q=ButtonTest&ss=android), 0);
        new [Button](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/widget/Button.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=116)([context](https://cs.android.com/android/platform/superproject/+/refs/heads/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=37?q=ButtonTest&ss=android), [attrs](https://cs.android.com/android/platform/superproject/+/refs/heads/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=39?q=ButtonTest&ss=android));
        new [Button](https://cs.android.com/android/platform/superproject/+/refs/heads/master:frameworks/base/core/java/android/widget/Button.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=95)([context](https://cs.android.com/android/platform/superproject/+/refs/heads/master:cts/tests/tests/widget/src/android/widget/cts/ButtonTest.java;drc=7346c436e5a11ce08f6a80dcfeb8ef941ca30176;l=37?q=ButtonTest&ss=android));
heesung6701 commented 1 year ago

이 Deep의 경우 MVP 프로젝트 보다는 하면 좋은 것들 기록하려고 등록 했는데

당장 급한건 아니지만 가져가면 좋은 액션 아이템 들에 대해서 따로 기록하면 좋을 거 같아서 만들었습니다! 개발 환경 개선에 대한 프로젝트를 새로 만드는게 좋을까요?

jisungbin commented 1 year ago

이 Deep의 경우 MVP 프로젝트 보다는 하면 좋은 것들 기록하려고 등록 했는데

너무 좋아요! 그냥 지금처럼 하고 New 레벨로 두면 좋을 거 같아요.