Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added testcases for can signal and pages #385

Open
wants to merge 46 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8c3033b
Added testcases for can signal and pages
SamaVinod Sep 17, 2020
3d1ba91
removed testcases
SamaVinod Sep 22, 2020
7b4e1ab
added test case
SamaVinod Sep 22, 2020
35fbc5f
changes to test case
SamaVinod Sep 22, 2020
fc9eed1
corrected syntax
SamaVinod Sep 22, 2020
6b2b1fd
changes to test case
SamaVinod Sep 22, 2020
7c20cbd
re added test case
SamaVinod Sep 23, 2020
38bcb17
changes to test case
SamaVinod Sep 23, 2020
a3b02ea
change inflate class
SamaVinod Sep 23, 2020
8542bfe
checking failed test
SamaVinod Sep 23, 2020
5dac648
readded testcase
SamaVinod Sep 23, 2020
29c33a5
modifications to test case
SamaVinod Sep 24, 2020
81a014d
readded logic for test cases
SamaVinod Sep 24, 2020
432493f
changes in logic
SamaVinod Sep 24, 2020
ca2839c
changes to testcase
SamaVinod Sep 28, 2020
eff7872
Added class in xml
SamaVinod Sep 28, 2020
fb4acad
changes to testcase
SamaVinod Sep 28, 2020
59317cb
changes to testcase
SamaVinod Sep 28, 2020
5d67a2c
changes to test case
SamaVinod Sep 28, 2020
7fc989d
changes to test cases
SamaVinod Oct 5, 2020
a36f55a
changes to testcase
SamaVinod Oct 5, 2020
81d089f
Update .travis.yml
pjt0620 Dec 9, 2020
dfcadf4
Update .travis.yml
pjt0620 Dec 9, 2020
43d764d
Update .travis.yml
pjt0620 Dec 9, 2020
905fb0f
Update .travis.yml
pjt0620 Dec 9, 2020
97d8a5d
Update .travis.yml
pjt0620 Dec 9, 2020
e34aa2c
Update .travis.yml
pjt0620 Dec 9, 2020
390f993
Update .travis.yml
pjt0620 Dec 9, 2020
295b6b0
Update .travis.yml
pjt0620 Dec 9, 2020
9b74f52
Update .travis.yml
pjt0620 Dec 9, 2020
fa6b4da
Update .travis.yml
pjt0620 Dec 9, 2020
4b8ce81
Update .travis.yml
pjt0620 Dec 9, 2020
825b385
Update .travis.yml
pjt0620 Dec 9, 2020
191b5bb
Update .travis.yml
pjt0620 Dec 9, 2020
5513f4d
Update .travis.yml
pjt0620 Dec 9, 2020
3289b11
Update .travis.yml
pjt0620 Dec 9, 2020
9788186
Update .travis.yml
pjt0620 Dec 9, 2020
2404b73
Update TestUtils.java
pjt0620 Dec 10, 2020
27429c2
Update AndroidManifest.xml
pjt0620 Dec 10, 2020
d187440
Update AndroidManifest.xml
pjt0620 Dec 10, 2020
a3e0008
Update TestUtils.java
pjt0620 Dec 10, 2020
b892192
Update TestUtils.java
pjt0620 Dec 10, 2020
d123d30
Update TestUtils.java
pjt0620 Dec 10, 2020
308d50f
Update .travis.yml
pjt0620 Dec 10, 2020
c3ae8f4
Update .travis.yml
pjt0620 Dec 10, 2020
a6728a2
Updated testcases
SamaVinod Dec 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ android:
- extra-android-m2repository
- sys-img-armeabi-v7a-android-22
before_script:
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a -c 100M
- emulator -avd test -no-boot-anim -no-window &
- echo y | android update sdk -a --no-ui --filter android-22
- echo y | android update sdk -a --no-ui --filter sys-img-armeabi-v7a-android-22
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- mksdcard -l testSdCard 1024M testSdCardFile.img
- emulator -avd test -no-skin -sdcard testSdCardFile.img -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- './gradlew build test && ./gradlew testDebug'
- './gradlew build test' # && ./gradlew testDebug'
- './gradlew connectedCheck'
deploy:
- provider: releases
Expand Down
2 changes: 2 additions & 0 deletions enabler/src/androidTest/java/com/openxc/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public static void pause(int millis) {

public static URI copyToStorage(Context context, int resource,
String filename) {
File openxcDirectory = new File("/sdcard/com.openxc/");
openxcDirectory.mkdirs();
URI uri = null;
try {
uri = new URI("file:///sdcard/com.openxc/" + filename);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.openxc.ui;

import android.test.suitebuilder.annotation.LargeTest;
import android.view.LayoutInflater;
import android.view.View;

import com.android21buttons.fragmenttestrule.FragmentTestRule;
import com.openxc.enabler.OpenXcEnablerActivity;
import com.openxcplatform.enabler.R;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.fragment.app.Fragment;
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
import androidx.test.rule.ActivityTestRule;
import static org.junit.Assert.assertNotNull;

@LargeTest
@RunWith(AndroidJUnit4ClassRunner.class)
public class CanMessageViewFragmentUITests {

@Rule
public FragmentTestRule<?, Fragment> mActivityTestRule = new FragmentTestRule<>(OpenXcEnablerActivity.class,Fragment.class);

@Test
public void check_for_view_layout_data(){
View v= LayoutInflater.from(mActivityTestRule.getActivity()).inflate(R.layout.can_message_details,null);
assertNotNull(v);
View vv= LayoutInflater.from(mActivityTestRule.getActivity()).inflate(R.layout.can_message_list_fragment,null);
assertNotNull(vv);
View vvv= LayoutInflater.from(mActivityTestRule.getActivity()).inflate(R.layout.can_message_list_item,null);
assertNotNull(vvv);
}

@Test
public void check_elements_presence() {
View v= LayoutInflater.from(mActivityTestRule.getActivity()).inflate(R.layout.can_message_details,null);
assertNotNull(v.findViewById(R.id.bus));
assertNotNull(v.findViewById(R.id.timestamp));
assertNotNull(v.findViewById(R.id.id));
assertNotNull(v.findViewById(R.id.data));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.openxc.ui;

import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.android21buttons.fragmenttestrule.FragmentTestRule;
import com.openxc.enabler.OpenXcEnablerActivity;
import com.openxcplatform.enabler.R;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.fragment.app.Fragment;
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;


import static org.junit.Assert.assertNotNull;

@LargeTest
@RunWith(AndroidJUnit4ClassRunner.class)
public class SendCanMessageFragmentUITests {

@Rule
public FragmentTestRule<?, Fragment> mActivityTestRule = new FragmentTestRule<>(OpenXcEnablerActivity.class,Fragment.class);

@Test
public void check_for_view_layout_data(){
Log.i("Android version", Build.VERSION.RELEASE);
Handler handler = new Handler(Looper.getMainLooper());

handler.postDelayed(new Runnable() {
@Override
public void run() {
// Run your task here
if (mActivityTestRule.getActivity() != null) {
View v = LayoutInflater.from(mActivityTestRule.getActivity()).inflate(R.layout.send_can_message_fragment, null);
assertNotNull(v);
}
}
}, 1000 );


}

@Test
public void check_elements_presence() {

Handler handler = new Handler(Looper.getMainLooper());

handler.postDelayed(new Runnable() {
@Override
public void run() {
if (mActivityTestRule.getActivity() != null) {
View v= LayoutInflater.from(mActivityTestRule.getActivity()).inflate(R.layout.send_can_message_fragment,null);
assertNotNull(v.findViewById(R.id.message_id));
assertNotNull(v.findViewById(R.id.message_payload));
assertNotNull(v.findViewById(R.id.message_payload2));
assertNotNull(v.findViewById(R.id.message_payload3));
assertNotNull(v.findViewById(R.id.message_payload4));
assertNotNull(v.findViewById(R.id.message_payload5));
assertNotNull(v.findViewById(R.id.message_payload6));
assertNotNull(v.findViewById(R.id.message_payload7));
assertNotNull(v.findViewById(R.id.message_payload8));
assertNotNull(v.findViewById(R.id.bus_spinner));
v.findViewById(R.id.send_request).performClick();
}
}
}, 1000 );
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.openxc.ui;

import android.test.suitebuilder.annotation.LargeTest;

import com.android21buttons.fragmenttestrule.FragmentTestRule;
import com.openxc.enabler.OpenXcEnablerActivity;
import com.openxcplatform.enabler.R;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.fragment.app.Fragment;
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
import androidx.test.rule.ActivityTestRule;

Expand All @@ -24,7 +27,7 @@
public class StatusFragmentUITests {

@Rule
public ActivityTestRule<OpenXcEnablerActivity> mActivityTestRule = new ActivityTestRule<>(OpenXcEnablerActivity.class);
public FragmentTestRule<?, Fragment> mActivityTestRule = new FragmentTestRule<>(OpenXcEnablerActivity.class,Fragment.class);

@Test
public void check_elements_presence() {
Expand Down
3 changes: 3 additions & 0 deletions enabler/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-feature android:name="android.hardware.usb.host" android:required="true"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

Expand All @@ -24,7 +25,9 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:theme="@android:style/Theme.Holo">


<service android:name="com.openxc.enabler.preferences.PreferenceManagerService"/>

Expand Down
3 changes: 2 additions & 1 deletion enabler/src/main/res/layout/send_can_message_fragment.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/EnablerFragment"
android:orientation="vertical" >
android:orientation="vertical"
class="com.openxc.enabler.SendCanMessageFragment">

<LinearLayout
android:layout_width="wrap_content"
Expand Down