Fixed the order of tests

This commit is contained in:
Batuhan Berk Başoğlu 2018-11-01 21:09:22 -04:00
parent 94e4bb4286
commit a9f26d7261
7 changed files with 124 additions and 0 deletions

View file

@ -29,10 +29,13 @@ dependencies {
implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test:core:1.0.0'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.robolectric:robolectric:4.0-alpha-3-SNAPSHOT' testImplementation 'org.robolectric:robolectric:4.0-alpha-3-SNAPSHOT'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2' androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
implementation 'com.jaredrummler:material-spinner:1.2.5' implementation 'com.jaredrummler:material-spinner:1.2.5'
implementation 'com.android.support:design:28.0.0-alpha3' implementation 'com.android.support:design:28.0.0-alpha3'
implementation 'com.rengwuxian.materialedittext:library:2.1.4' implementation 'com.rengwuxian.materialedittext:library:2.1.4'

View file

@ -0,0 +1,22 @@
package com.uottawa.olympus.olympusservices;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class LogInTest {
@Rule
public ActivityTestRule<LogIn> mActivityTestRule = new ActivityTestRule<LogIn>(LogIn.class);
@Test
public void checkSignIn() throws Exception{
}
}

View file

@ -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<ServiceProvider> mActivityTestRule2 = new ActivityTestRule<ServiceProvider>(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{
}*/
}

View file

@ -0,0 +1,4 @@
package com.uottawa.olympus.olympusservices;
public class ServiceTest {
}

View file

@ -0,0 +1,4 @@
package com.uottawa.olympus.olympusservices;
public class ServiceTest2 {
}

View file

@ -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<SignUp> mActivityTestRule = new ActivityTestRule<SignUp>(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;
}
}