levibostian / AndroidBlanky

Create a new Android app fast. Comes pre-installed with libraries you already use.
7 stars 0 forks source link

Reuseable fake data objects for UI tests. #39

Closed levibostian closed 2 years ago

levibostian commented 6 years ago

Check out MainFragmentTest. You will notice this line: private val repo1 = RepoModel(1, "name1", repoOwner). I want to pull this out and not require having to construct a new RepoModel in each test file. I would like 1 central place that fake RepoModels get constructed.

Ideas for API:

Get a friend by identifier:

# Generic, fake friend object number 1. 
FakeData.getFriend(Fake.FRIEND_1)

# if you want to test UI with a long username
FakeData.getFriend(Fake.FRIEND_LONG_USERNAME)

Get a list of friends:

val numberOfFriendsToGet = 5
FakeData.getFriends(numberOfFriendsToGet)
# FakeData might have a set of 10 fake friend objects constructed ready to go. 
levibostian commented 2 years ago

Going to close this. Thinking about raw JSON files that initialize objects from it using real-world data.