Added comments
This commit is contained in:
parent
ff0418d4cd
commit
611cf2934c
4 changed files with 36 additions and 112 deletions
Binary file not shown.
|
@ -1,22 +0,0 @@
|
||||||
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{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void checkSignUp3() throws Exception{
|
|
||||||
onView(withId(R.id.UsernameInput)).perform(typeText(""), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.PasswordInput)).perform(typeText(""), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.FirstNameInput)).perform(typeText(""), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.LastNameInput)).perform(typeText(""), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.SignUp)).perform(click());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void checkSignUp4() throws Exception{
|
|
||||||
onView(withId(R.id.UsernameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.PasswordInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.FirstNameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.LastNameInput)).perform(typeText("$$$$$$"), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.SignUp)).perform(click());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkSignUp5() throws Exception{
|
|
||||||
onView(withId(R.id.UsernameInput)).perform(typeText("user"), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.PasswordInput)).perform(typeText("pass"), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.FirstNameInput)).perform(typeText("Honda"), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.LastNameInput)).perform(typeText("Gokuchi"), closeSoftKeyboard());
|
|
||||||
onView(withId(R.id.SignUp)).perform(click());
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
public void tearDown() throws Exception {
|
|
||||||
mActivity=null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,6 +11,9 @@ public class BookingTest {
|
||||||
Booking book = new Booking(13, 30, 16, 0, 0, 0, 2019,
|
Booking book = new Booking(13, 30, 16, 0, 0, 0, 2019,
|
||||||
serviceprovider, user, service);
|
serviceprovider, user, service);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests starth input and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStarth() {
|
public void testStarth() {
|
||||||
assertEquals(13, book.getStarth());
|
assertEquals(13, book.getStarth());
|
||||||
|
@ -18,6 +21,9 @@ public class BookingTest {
|
||||||
assertNotEquals(13, book.getStarth());
|
assertNotEquals(13, book.getStarth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests startmin input and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStartmin() {
|
public void testStartmin() {
|
||||||
assertEquals(30, book.getStartmin());
|
assertEquals(30, book.getStartmin());
|
||||||
|
@ -25,6 +31,9 @@ public class BookingTest {
|
||||||
assertNotEquals(30, book.getStartmin());
|
assertNotEquals(30, book.getStartmin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests Endh input and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEndh() {
|
public void testEndh() {
|
||||||
assertEquals(16, book.getEndh());
|
assertEquals(16, book.getEndh());
|
||||||
|
@ -32,6 +41,9 @@ public class BookingTest {
|
||||||
assertNotEquals(16, book.getEndh());
|
assertNotEquals(16, book.getEndh());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests Endmin input and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEndmin() {
|
public void testEndmin() {
|
||||||
assertEquals(0, book.getEndmin());
|
assertEquals(0, book.getEndmin());
|
||||||
|
@ -39,6 +51,9 @@ public class BookingTest {
|
||||||
assertNotEquals(0, book.getEndmin());
|
assertNotEquals(0, book.getEndmin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests Day input and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDay() {
|
public void testDay() {
|
||||||
assertEquals(0, book.getDay());
|
assertEquals(0, book.getDay());
|
||||||
|
@ -46,6 +61,9 @@ public class BookingTest {
|
||||||
assertNotEquals(0, book.getDay());
|
assertNotEquals(0, book.getDay());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests Month input and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMonth() {
|
public void testMonth() {
|
||||||
assertEquals(0, book.getMonth());
|
assertEquals(0, book.getMonth());
|
||||||
|
@ -53,6 +71,9 @@ public class BookingTest {
|
||||||
assertNotEquals(0, book.getMonth());
|
assertNotEquals(0, book.getMonth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests Year input and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testYear() {
|
public void testYear() {
|
||||||
assertEquals(2019, book.getYear());
|
assertEquals(2019, book.getYear());
|
||||||
|
@ -60,6 +81,9 @@ public class BookingTest {
|
||||||
assertNotEquals(2019, book.getYear());
|
assertNotEquals(2019, book.getYear());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests ServiceProvider in booking class and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServiceprovider() {
|
public void testServiceprovider() {
|
||||||
assertEquals(serviceprovider, book.getServiceprovider() );
|
assertEquals(serviceprovider, book.getServiceprovider() );
|
||||||
|
@ -68,6 +92,9 @@ public class BookingTest {
|
||||||
assertNotEquals(serviceprovider, book.getServiceprovider());
|
assertNotEquals(serviceprovider, book.getServiceprovider());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests HomeOwner in booking class and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testHomeowner() {
|
public void testHomeowner() {
|
||||||
assertEquals(user, book.getHomeowner() );
|
assertEquals(user, book.getHomeowner() );
|
||||||
|
@ -76,6 +103,9 @@ public class BookingTest {
|
||||||
assertNotEquals(user, book.getHomeowner());
|
assertNotEquals(user, book.getHomeowner());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests Service in booking class and its functions.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testService() {
|
public void testService() {
|
||||||
assertEquals(service, book.getService() );
|
assertEquals(service, book.getService() );
|
||||||
|
@ -84,12 +114,18 @@ public class BookingTest {
|
||||||
assertNotEquals(service, book.getService());
|
assertNotEquals(service, book.getService());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests Status and its functions by setting it up.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStatus() {
|
public void testStatus() {
|
||||||
book.setStatus(Booking.Status.CONFIRMED);
|
book.setStatus(Booking.Status.CONFIRMED);
|
||||||
assertEquals(Booking.Status.CONFIRMED, book.getStatus());
|
assertEquals(Booking.Status.CONFIRMED, book.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tests Rating and its functions by setting it up.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRating() {
|
public void testRating() {
|
||||||
book.setRating(5);
|
book.setRating(5);
|
||||||
|
|
Loading…
Reference in a new issue