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

Fix #3528: Setup Infrastructure to test using local dev server #3529

Merged
merged 82 commits into from
Aug 19, 2021

Conversation

FareesHussain
Copy link
Contributor

@FareesHussain FareesHussain commented Jul 26, 2021

Explanation

Fixes #3528
This pr introduces a Testing infrastructure that enables instrumentation tests for downloading explorations and loading images from the local dev server.

This introduces a TestNetworkModule, TestImageParsingModule, and a TestGcsResourceModule.
These modules are used by the OppiaTestApplication and added to a manifest used by the oppia_test android_binary.

oppia_test is similar to the oppia target but it uses the above three modules and a different AndroidManifest

Here I've used two different AndroidManifest in the instrumentation module
one under java directory used for the OppiaTestApplication
and under javatest directory used for InstrumentationTests

Build the test app using:

bazel build //instrumentation:oppia_test

Screenshot

image

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

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

Had a quick look here, will look into more detail.

@oppiabot
Copy link

oppiabot bot commented Jul 27, 2021

Unassigning @anandwana001 since the review is done.

@oppiabot
Copy link

oppiabot bot commented Jul 27, 2021

Hi @FareesHussain, it looks like some changes were requested on this pull request by @anandwana001. PTAL. Thanks!

@FareesHussain
Copy link
Contributor Author

FareesHussain commented Jul 27, 2021

@anandwana001 @BenHenning PTAL
Here I'm creating a whole separate application oppia_test which uses AndroidManifest from the instrumentation/src/java
This application uses the Test modules from the instrumentation module and this approach makes it easier to write tests with UiAutomator using uiautomatorviewer while running the app.

Here the AndroidManifest only as two changes compared to the app module.

android:name=".instrumentation.OppiaTestApplication"

and

tools:replace="android:name"

There are some pending kdoc need to be updated, I will update them once the approach is accepted.

@oppiabot oppiabot bot assigned anandwana001 and unassigned FareesHussain Jul 27, 2021
… checking-test-application

� Conflicts:
�	app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt
�	instrumentation/BUILD.bazel
�	instrumentation/src/java/org/oppia/android/instrumentation/testing/BUILD.bazel
�	scripts/assets/test_file_exemptions.textproto
�	scripts/src/javatests/org/oppia/android/scripts/ci/ComputeAffectedTestsTest.kt
@FareesHussain
Copy link
Contributor Author

@BenHenning can you check how to add a TestFile to get the target
//instrumentation/src/javatests/org/oppia/android/instrumentation/player:InstrumentationTest

if I use

    createBasicTests(
      "InstrumentationTest",
      subpackage = "instrumentation.src.javatests.org.oppia.android.instrumentation.player"
    )

I get the following target
//instrumentation.src.javatests.org.oppia.android.instrumentation.player:InstrumentationTest

@FareesHussain FareesHussain changed the title Fix #3528: Setup Infrastructure to test using local dev server [Blocked on #3505] Fix #3528: Setup Infrastructure to test using local dev server Aug 18, 2021
@FareesHussain
Copy link
Contributor Author

@BenHenning can you check how to add a TestFile to get the target
//instrumentation/src/javatests/org/oppia/android/instrumentation/player:InstrumentationTest

if I use

    createBasicTests(
      "InstrumentationTest",
      subpackage = "instrumentation.src.javatests.org.oppia.android.instrumentation.player"
    )

I get the following target
//instrumentation.src.javatests.org.oppia.android.instrumentation.player:InstrumentationTest

It is fixed now, not sure if it is the right way to do that

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @FareesHussain. Just had one comment, otherwise the PR LGTM.

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @FareesHussain. Given that the past CI run was green & all other comments are resolved, this LGTM. However, please make sure at least https://github.com/oppia/oppia-android/pull/3529/checks?check_run_id=3368705606 is passing before merging since we don't have a required check (yet) for these script tests (which means breakages can be checked in & merged).

@BenHenning BenHenning removed their assignment Aug 19, 2021
Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

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

LGTM, just waiting for all checks to pass and nothing was broken, before merging.

@oppiabot
Copy link

oppiabot bot commented Aug 19, 2021

Unassigning @anandwana001 since they have already approved the PR.

… checking-test-application

� Conflicts:
�	app/src/main/java/org/oppia/android/app/application/ApplicationComponent.kt
Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Latest changes LGTM.

@BenHenning BenHenning merged commit 000bbc4 into oppia:develop Aug 19, 2021
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.

Setup infrastructure to download explorations from the local dev server
5 participants