From a9f26d726100e5ef98c52237782406f367c58b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Berk=20Ba=C5=9Fo=C4=9Flu?= Date: Thu, 1 Nov 2018 21:09:22 -0400 Subject: [PATCH] Fixed the order of tests --- .../.idea/caches/build_file_checksums.ser | Bin 537 -> 537 bytes OlympusServices/app/build.gradle | 3 + .../olympus/olympusservices/LogInTest.java | 22 ++++++ .../olympusservices/ServiceProviderTest.java | 27 ++++++++ .../olympus/olympusservices/ServiceTest.java | 4 ++ .../olympus/olympusservices/ServiceTest2.java | 4 ++ .../olympus/olympusservices/SignUpTest.java | 64 ++++++++++++++++++ 7 files changed, 124 insertions(+) create mode 100644 OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/LogInTest.java create mode 100644 OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java create mode 100644 OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest.java create mode 100644 OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest2.java create mode 100644 OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java diff --git a/OlympusServices/.idea/caches/build_file_checksums.ser b/OlympusServices/.idea/caches/build_file_checksums.ser index ce93595522e51c97e902d0543c1a8348bdf6381c..38a3339a39a9f8bf319e0b21fe4cceff5dfb0cf4 100644 GIT binary patch delta 35 tcmV+;0NnqX1epYom;}-0dZ3Y mActivityTestRule = new ActivityTestRule(LogIn.class); + + @Test + public void checkSignIn() throws Exception{ + + } +} \ No newline at end of file diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java new file mode 100644 index 0000000..1e1e229 --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java @@ -0,0 +1,27 @@ +package com.uottawa.olympus.olympusservices; + +import android.support.test.annotation.UiThreadTest; +import android.support.test.rule.ActivityTestRule; +import android.widget.TextView; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class ServiceProviderTest { + /*@Rule + public ActivityTestRule mActivityTestRule2 = new ActivityTestRule(ServiceProvider.class); + private ServiceProvider mActivity2 = null; + private TextView text; + + @Before + public void setUp() throws Exception{ + mActivity2=mActivityTestRule2.getActivity(); + } + + @Test + @UiThreadTest + public void checkServices() throws Exception{ + + }*/ +} \ No newline at end of file diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest.java new file mode 100644 index 0000000..87aaa31 --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest.java @@ -0,0 +1,4 @@ +package com.uottawa.olympus.olympusservices; + +public class ServiceTest { +} diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest2.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest2.java new file mode 100644 index 0000000..9c035be --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest2.java @@ -0,0 +1,4 @@ +package com.uottawa.olympus.olympusservices; + +public class ServiceTest2 { +} diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java new file mode 100644 index 0000000..1b4af49 --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java @@ -0,0 +1,64 @@ +package com.uottawa.olympus.olympusservices; + +import android.support.test.rule.ActivityTestRule; +import android.support.test.runner.AndroidJUnit4; +import android.widget.TextView; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static android.support.test.espresso.Espresso.onData; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.action.ViewActions.click; +import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard; +import static android.support.test.espresso.action.ViewActions.typeText; +import static android.support.test.espresso.matcher.ViewMatchers.withId; +import static android.support.test.espresso.matcher.ViewMatchers.withSpinnerText; +import static java.util.regex.Pattern.matches; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.core.AllOf.allOf; +import static org.junit.Assert.*; + +@RunWith(AndroidJUnit4.class) +public class SignUpTest { + + @Rule + public ActivityTestRule mActivityTestRule = new ActivityTestRule(SignUp.class); + private SignUp mActivity=null; + private TextView text; + + @Before + public void setUp() throws Exception { + mActivity = mActivityTestRule.getActivity(); + } + + @Test + public void checkSignUp1() throws Exception{ + onView(withId(R.id.UsernameInput)).perform(typeText("John123"), closeSoftKeyboard()); + onView(withId(R.id.PasswordInput)).perform(typeText("1234567890"), closeSoftKeyboard()); + onView(withId(R.id.FirstNameInput)).perform(typeText("John"), closeSoftKeyboard()); + onView(withId(R.id.LastNameInput)).perform(typeText("Doe"), closeSoftKeyboard()); + onView(withId(R.id.SignUp)).perform(click()); + } + + @Test + public void checkSignUp2() throws Exception{ + onView(withId(R.id.RoleInput)).perform(click()); + onData(allOf(is(instanceOf(String.class)), is("Service Provider"))).perform(click()); + onView(withId(R.id.UsernameInput)).perform(typeText("Service123"), closeSoftKeyboard()); + onView(withId(R.id.PasswordInput)).perform(typeText("1234567890"), closeSoftKeyboard()); + onView(withId(R.id.FirstNameInput)).perform(typeText("Jane"), closeSoftKeyboard()); + onView(withId(R.id.LastNameInput)).perform(typeText("Doe"), closeSoftKeyboard()); + onView(withId(R.id.SignUp)).perform(click()); + } + + @After + public void tearDown() throws Exception { + mActivity=null; + } +} \ No newline at end of file