Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Tables test #200

Open
wants to merge 8 commits into
base: development
Choose a base branch
from

Conversation

Lamouresparus
Copy link

This PR updates the Tests in Tables to use the most recent Android Testing Framework

@odk-x-bot
Copy link

Can one of the admins verify this patch? Also need an authorization to run tests.

@Lamouresparus Lamouresparus changed the title Update csv test file Update Tables test Mar 28, 2022

//Some background tasks are slow (for example ColorRule), force a wait
Thread.sleep(WAIT);
Thread.sleep(3000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you replace the constant with a number? It is a better style to have constant values.

@@ -119,11 +112,12 @@ public void intent_editRow() throws InterruptedException {
//Move to Survey
onView(withId(R.id.menu_edit_row)).perform(click());

//changed the instanceId from "906c2b4f-b9d2-4aa1-bbb0-e754d66325ff" to null because the test was crashing with an junit.framework.AssertionFailedError: Wanted to match 1 intents. Actually matched 0 intents
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not testing the same thing so there is an error somewhere. What is happening to the intent? When you perform a click on the edit row it should launch an intent.

@@ -146,8 +140,9 @@ public void intent_spreadsheetEditRow() throws InterruptedException {
//Edit the row
onView(withText(EspressoUtils.getString(R.string.edit_row))).perform(click());

intended(ODKMatchers
.hasTable(T_HOUSE_E_TABLE_ID, T_HOUSE_E_TABLE_ID, "1ed5404f-c501-4308-ac0f-a080c13ae5c4"));
//changed the instanceId from "1ed5404f-c501-4308-ac0f-a080c13ae5c4" to null because the test was crashing with an junit.framework.AssertionFailedError: Wanted to match 1 intents. Actually matched 0 intents
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again this is a problem, the test is no longer doing the same thing.

.constructFormType(activity, APP_NAME, T_HOUSE_E_TABLE_ID)
.setFormId(currFormId[0]);
} catch (ServicesAvailabilityException e) {
e.printStackTrace();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there no fail here? Tests will automatically fail if there is an exception. By you adding a catch exception the test will no longer fail, so you need to call fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, now I am not sure this catch is needed at all so if it is, address the above comment. However, first see if it's needed.

@@ -545,21 +540,28 @@ public void display_outOfAppDirViewFile() {
}

@Test
public void display_badFormId() throws ServicesAvailabilityException {
public void display_badFormId() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reviewing this more carefully I am not sure we need the catch statement at all.

Therefore, you can do the assert with the activity -> { (assert here) }

And eliminate the need for a weird final array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants