taverna-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sagar15795 <...@git.apache.org>
Subject [GitHub] incubator-taverna-mobile pull request #89: Added Login Activity UI Test
Date Thu, 02 Aug 2018 05:04:20 GMT
Github user sagar15795 commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-mobile/pull/89#discussion_r207101956
  
    --- Diff: app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
---
    @@ -0,0 +1,112 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.taverna.mobile.login;
    +
    +import android.support.test.espresso.Espresso;
    +import android.support.test.filters.LargeTest;
    +import android.support.test.rule.ActivityTestRule;
    +import android.support.test.runner.AndroidJUnit4;
    +
    +import org.apache.taverna.mobile.R;
    +import org.apache.taverna.mobile.data.DataManager;
    +import org.apache.taverna.mobile.ui.login.LoginActivity;
    +import org.apache.taverna.mobile.ui.login.LoginPresenter;
    +import org.junit.Before;
    +import org.junit.Rule;
    +import org.junit.Test;
    +import org.junit.runner.RunWith;
    +
    +import static android.os.SystemClock.sleep;
    +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.assertion.ViewAssertions.matches;
    +import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
    +import static android.support.test.espresso.matcher.ViewMatchers.withId;
    +import static android.support.test.espresso.matcher.ViewMatchers.withText;
    +import static org.hamcrest.CoreMatchers.allOf;
    +import static org.mockito.Mockito.mock;
    +
    +@RunWith(AndroidJUnit4.class)
    +@LargeTest
    +public class LoginActivityTest {
    +
    +    private DataManager dataManager;
    +    private LoginPresenter loginPresenter;
    --- End diff --
    
    use this to mock the API response as you have done in jUnit testing.


---

Mime
View raw message