-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
200 additions
and
136 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/jieqoo/android/KASS/integration/test/IntegrationBaseTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package jieqoo.android.KASS.integration.test; | ||
|
||
import jieqoo.android.KASS.Main; | ||
import android.test.ActivityInstrumentationTestCase2; | ||
|
||
import com.jayway.android.robotium.solo.Solo; | ||
|
||
public abstract class IntegrationBaseTests extends ActivityInstrumentationTestCase2<Main> { | ||
|
||
protected Solo solo; | ||
|
||
public IntegrationBaseTests(String name) { | ||
super(Main.class); | ||
setName(name); | ||
} | ||
|
||
protected void setUp() throws Exception { | ||
super.setUp(); | ||
solo = new Solo(getInstrumentation(), getActivity()); | ||
} | ||
|
||
protected void tearDown() throws Exception { | ||
super.tearDown(); | ||
try { | ||
solo.finishOpenedActivities(); | ||
} catch (Throwable e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/jieqoo/android/KASS/integration/test/UserBrowsesOffersTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package jieqoo.android.KASS.integration.test; | ||
|
||
import static jieqoo.android.KASS.test.Factory.*; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
public class UserBrowsesOffersTests extends IntegrationBaseTests { | ||
|
||
public UserBrowsesOffersTests(String name) { | ||
super(name); | ||
} | ||
|
||
public UserBrowsesOffersTests() { | ||
this("UserBrowsesOffersTests"); | ||
} | ||
|
||
public final void testBrowsesOffers() throws JSONException { | ||
createUser(); | ||
JSONObject listing = createListing(); | ||
signoutUser(); | ||
createUser(); | ||
createOffer(listing.getString("id")); | ||
solo.clickOnButton("我的活动"); | ||
solo.clickOnText("我要卖"); | ||
assertTrue(solo.searchText(listing.getString("title"))); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/jieqoo/android/KASS/integration/test/UserBrowsesWantsTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package jieqoo.android.KASS.integration.test; | ||
|
||
import static jieqoo.android.KASS.test.Factory.createListing; | ||
import static jieqoo.android.KASS.test.Factory.createUser; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
public class UserBrowsesWantsTests extends IntegrationBaseTests { | ||
|
||
public UserBrowsesWantsTests(String name) { | ||
super(name); | ||
} | ||
|
||
public UserBrowsesWantsTests() { | ||
this("UserBrowsesWantsTests"); | ||
} | ||
|
||
public final void testBrowsesListings() throws JSONException { | ||
createUser(); | ||
JSONObject listing = createListing(); | ||
|
||
solo.clickOnButton("浏览"); | ||
solo.clickOnButton("我的活动"); | ||
assertTrue(solo.searchText(listing.getString("title"))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/jieqoo/android/KASS/integration/test/UserPostsListingTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package jieqoo.android.KASS.integration.test; | ||
|
||
public class UserPostsListingTests { | ||
|
||
} |
33 changes: 6 additions & 27 deletions
33
...id/KASS/integration/test/SignInTests.java → ...SS/integration/test/UserSignsInTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/jieqoo/android/KASS/integration/test/UserSignsUpTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* | ||
*/ | ||
package jieqoo.android.KASS.integration.test; | ||
|
||
import jieqoo.android.KASS.models.Account; | ||
import static jieqoo.android.KASS.test.Factory.*; | ||
|
||
/** | ||
* @author linhe | ||
* | ||
*/ | ||
public class UserSignsUpTests extends IntegrationBaseTests { | ||
|
||
public UserSignsUpTests() { | ||
this("SignUpTests"); | ||
} | ||
|
||
public UserSignsUpTests(String name) { | ||
super(name); | ||
} | ||
|
||
public final void testSignup() { | ||
signoutUser(); | ||
|
||
solo.clickOnButton("登录"); | ||
solo.clickOnButton("注册"); | ||
solo.enterText(0, "kass" + System.currentTimeMillis()); | ||
solo.enterText(1, "secret"); | ||
solo.enterText(2, "kass" + System.currentTimeMillis() + "@example.com"); | ||
solo.enterText(3, "12345678910"); | ||
solo.clickOnButton("注册"); | ||
solo.waitForText("发布"); | ||
assertTrue(Account.getInstance().isAuthenticated()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.