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 app module tests for Roboelectric #973

Closed
24 tasks done
rt4914 opened this issue Apr 13, 2020 · 48 comments
Closed
24 tasks done

Fix app module tests for Roboelectric #973

rt4914 opened this issue Apr 13, 2020 · 48 comments
Labels
Priority: Essential This work item must be completed for its milestone. Z-ibt Temporary label for Ben to keep track of issues he's triaged.

Comments

@rt4914
Copy link
Contributor

rt4914 commented Apr 13, 2020

Currently, the app module test cases are passing on Espresso but they should also pass on Robolectric. Fix these below mentioned files to make sure that the tests pass on Robolectric.

You can run robolectric tests by following these steps: https://github.com/oppia/oppia-android/wiki/Oppia-Android-Testing#running-roboelectric-tests

Also, make sure that you assign yourself one task only at a time, which you can mention in the comments below.

Fixing test cases will need to introduce TextApplicationComponent. This can be seen here.

@rt4914 rt4914 added Priority: Essential This work item must be completed for its milestone. mini-project labels Apr 13, 2020
@abhinavraj23
Copy link
Contributor

@rt4914 please assign me one of these tasks.

@SayantanBanerjee16
Copy link
Contributor

@rt4914 Can you assign me some of this task. Also, this task means that we would be running the previously written tests in Roboelectric, or writing new tests based on previous tests?

@rt4914
Copy link
Contributor Author

rt4914 commented Apr 17, 2020

@rt4914 Can you assign me some of this task. Also, this task means that we would be running the previously written tests in Roboelectric, or writing new tests based on previous tests?

You can just run the previously written test cases in Roboelectic and which every test fails, fix them and make sure that it passes on Espresso as well as Roboelectric

@SayantanBanerjee16
Copy link
Contributor

SayantanBanerjee16 commented Apr 17, 2020

@rt4914 So I followed the steps given in the link above and all the tests in AppVersionActivityTest.kt passed. Now can you please assign me files 4,5,6 in the list above. Thanks :)

Screenshot (101)

@virajpatel2411
Copy link
Contributor

@rt4914 Assign me any one of these tasks. Thanks.

@SayantanBanerjee16
Copy link
Contributor

@rt4914 FAQSingleActivityTest Roboelectric tests passed.
I am assigning myself the next two files in the list.

Screenshot (105)

@virajpatel2411
Copy link
Contributor

@rt4914 In CompletedStoryListActivityTest, 8 out of 9 tests are failing for Roboelectric and all of then are passing in Espresso. The failed tests show the error of PerformException, so maybe there seems to be an issue with the perform() method. So, what do you suggest to change, because I am not getting what is wrong with the method if all the tests are passing for Espresso.

@abhinavraj23
Copy link
Contributor

@rt4914 for the tests concerning dialog-box opening or navigation-bar opening, it would not work with roboelectric in the same way as it works in espresso, thus for these we may need to write separate tests, I have been able to successfully write tests for dialogBoxes in roboelectric but those don't work in espresso, thus we may need to write separately for these tests

@Sarthak2601
Copy link
Contributor

Sarthak2601 commented Apr 20, 2020

All Robolectric tests pass in FAQListFragmentTest

FAQListFragmentRoboelectricTest

@rt4914
Copy link
Contributor Author

rt4914 commented Apr 21, 2020

@rt4914 for the tests concerning dialog-box opening or navigation-bar opening, it would not work with roboelectric in the same way as it works in espresso, thus for these we may need to write separate tests, I have been able to successfully write tests for dialogBoxes in roboelectric but those don't work in espresso, thus we may need to write separately for these tests

@abhinavraj23 Its write to add new test cases as per requirement but each and every test case should pass on both espresso and roboelectric. So you can just create a PR and we can figure out from that.

@rt4914
Copy link
Contributor Author

rt4914 commented Apr 21, 2020

@rt4914 In CompletedStoryListActivityTest, 8 out of 9 tests are failing for Roboelectric and all of then are passing in Espresso. The failed tests show the error of PerformException, so maybe there seems to be an issue with the perform() method. So, what do you suggest to change, because I am not getting what is wrong with the method if all the tests are passing for Espresso.

@virajpatel2411 It can happen that tests pass on espresso and fails on roboelectic and that's why we have this issue to track everything. Have you tried searching for solutions for those errors on internet?

@virajpatel2411
Copy link
Contributor

@rt4914 In CompletedStoryListActivityTest, 8 out of 9 tests are failing for Roboelectric and all of then are passing in Espresso. The failed tests show the error of PerformException, so maybe there seems to be an issue with the perform() method. So, what do you suggest to change, because I am not getting what is wrong with the method if all the tests are passing for Espresso.

@virajpatel2411 It can happen that tests pass on espresso and fails on roboelectic and that's why we have this issue to track everything. Have you tried searching for solutions for those errors on internet?

Yes, but I didn't find anything helpful. Imk, there resides some issue with perform() method as in every test case in Roboelectric the PerformException is thrown. Now, what should I do?

@rt4914
Copy link
Contributor Author

rt4914 commented Apr 23, 2020

@rt4914 In CompletedStoryListActivityTest, 8 out of 9 tests are failing for Roboelectric and all of then are passing in Espresso. The failed tests show the error of PerformException, so maybe there seems to be an issue with the perform() method. So, what do you suggest to change, because I am not getting what is wrong with the method if all the tests are passing for Espresso.

@virajpatel2411 It can happen that tests pass on espresso and fails on roboelectic and that's why we have this issue to track everything. Have you tried searching for solutions for those errors on internet?

Yes, but I didn't find anything helpful. Imk, there resides some issue with perform() method as in every test case in Roboelectric the PerformException is thrown. Now, what should I do?

@virajpatel2411 You can either prepare a document of what all things you have tried and the errors you have faced so that we can have a look.
2. You can pick a new issue to work on from this list.

But the main point is that you will need to give information in detail so that we can have a look at the problem.

@virajpatel2411
Copy link
Contributor

@rt4914 In CompletedStoryListActivityTest, 8 out of 9 tests are failing for Roboelectric and all of then are passing in Espresso. The failed tests show the error of PerformException, so maybe there seems to be an issue with the perform() method. So, what do you suggest to change, because I am not getting what is wrong with the method if all the tests are passing for Espresso.

@virajpatel2411 It can happen that tests pass on espresso and fails on roboelectic and that's why we have this issue to track everything. Have you tried searching for solutions for those errors on internet?

Yes, but I didn't find anything helpful. Imk, there resides some issue with perform() method as in every test case in Roboelectric the PerformException is thrown. Now, what should I do?

@virajpatel2411 You can either prepare a document of what all things you have tried and the errors you have faced so that we can have a look.
2. You can pick a new issue to work on from this list.

But the main point is that you will need to give information in detail so that we can have a look at the problem.

Okay...Will share the details once I have prepared it. Thanks.

@virajpatel2411
Copy link
Contributor

@rt4914 https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing.
This is the link of the document I prepared. Hope it helps you understand the problem faced.

@virajpatel2411
Copy link
Contributor

@rt4914 https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing.
This is the link of the document I prepared. Hope it helps you understand the problem faced.

@rt4914 Any updates for further work?

@rt4914
Copy link
Contributor Author

rt4914 commented Apr 24, 2020

@rt4914 https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing.
This is the link of the document I prepared. Hope it helps you understand the problem faced.

@veena14cs PTAL at this issue.

@virajpatel2411
Copy link
Contributor

@rt4914 https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing.
This is the link of the document I prepared. Hope it helps you understand the problem faced.

@veena14cs PTAL at this issue.

@veena14cs This is the link to document.
https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing
Thanks.

@virajpatel2411
Copy link
Contributor

@rt4914 https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing.
This is the link of the document I prepared. Hope it helps you understand the problem faced.

@veena14cs PTAL at this issue.

@veena14cs This is the link to document.
https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing
Thanks.

@rt4914 @veena14cs Any updates?

@veena14cs
Copy link
Contributor

veena14cs commented Apr 28, 2020

https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing

@virajpatel2411 I checked the document will figure this out, till then you can pick out some new issue and start working on it. Once we figure out, I will update you on this.

@virajpatel2411
Copy link
Contributor

https://docs.google.com/document/d/12vTSL8eW9LMtPmxSGFnWvmQfJumJ4BOdBduqeUm8vmw/edit?usp=sharing

@virajpatel2411 I checked the document will figure this out, till then you can pick out some new issue and start working on it. Once we figure out, I will update you on this.

@veena14cs Okay.

@anandwana001
Copy link
Contributor

anandwana001 commented May 15, 2020

@virajpatel2411 I tried CompletedStoryListActivityTest running Robolectric test and yes, it passed only 1 out of 9 in my case. I annotated @LooperMode(PAUSED) annotation on the top of the class and it passed all the test cases under Robolectric Testing

added androidTestImplementation 'org.robolectric:annotations:4.3.1'

Documentation of Robolectric Looper

Reference to this Robolectric Issue

LooperMode class

Robolectric Result
Screenshot 2020-05-15 at 22 36 59

Espresso Result
Screenshot 2020-05-15 at 22 36 24

@virajpatel2411
Copy link
Contributor

@anandwana001 Okay. So, now is there anything to do from my side or the issue now is resolved?

@anandwana001
Copy link
Contributor

RevisionCardFragmentTest works fine

Robolectric

Screenshot 2020-09-20 at 19 01 57

Espresso

Screenshot 2020-09-20 at 19 04 22

prayutsu pushed a commit to prayutsu/oppia-android that referenced this issue Sep 21, 2020
…asswordActivityTest (oppia#1854)

* fix PinPasswordActivityTest for robolectric

* added todo
rt4914 pushed a commit that referenced this issue Sep 21, 2020
…onActivityTest (#1850)

* fix ExplorationActivityTest for robolectric

* max line fix

* nit changes

* aaded todo 1855
rt4914 pushed a commit that referenced this issue Sep 21, 2020
…picListActivityTest (#1863)

* fix OngoingTopicListActivityTest test for robolectric

* removed unnecessary functions
@prayutsu
Copy link
Contributor

I am taking up OptionsFragmentTest

@Sarthak2601
Copy link
Contributor

@rt4914 Since we are going to take this issue under SLoP, can we freeze its contributions for now ? It might lead to confusion otherwise.
@prayutsu Please wait on Rajat to reply.
/cc- @anandwana001

@anandwana001
Copy link
Contributor

@rt4914 Since we are going to take this issue under SLoP, can we freeze its contributions for now ? It might lead to confusion otherwise.
@prayutsu Please wait on Rajat to reply.
/cc- @anandwana001

Sounds good

@Sarthak2601
Copy link
Contributor

@BenHenning should we include StateFragementTest in the tests for the SLoP participants to fix or you're working on it ?

@BenHenning
Copy link
Member

BenHenning commented Sep 24, 2020

@Sarthak2601 StateFragmentTest is fixed & running (as of #1630). Thanks for checking.

That being said, #388 & https://github.com/oppia/oppia-android/blob/develop/app/src/sharedTest/java/org/oppia/app/player/state/StateFragmentTest.kt#L206 might be a great set of tests that could be split into starter issues for SLoP. Ditto for question player (#503). #1273 also needs to be done (hints & solutions tests for questions).

@rt4914 we talked about not adding missing test cases, but much of the above is already figured out & immediately high impact since it covers the core learner experiences. It seems worth finishing that work.

Another unrelated area of work that I thought of: creating common test dependencies for matchers, shared modules, and shared utility functions (especially the ones used between state & question players).

@rt4914
Copy link
Contributor Author

rt4914 commented Sep 24, 2020

Closing this issue as we have created separate issues:
#1868 #1869 #1870 #1871 #1872 #1873 #1874 #1877 #1878

@rt4914 rt4914 closed this as completed Sep 24, 2020
prayutsu pushed a commit to prayutsu/oppia-android that referenced this issue Sep 25, 2020
…rofileActivityTest (oppia#1842)

* fix AddProfileActivityTest for robolectric

* added todo
prayutsu pushed a commit to prayutsu/oppia-android that referenced this issue Sep 25, 2020
…asswordActivityTest (oppia#1854)

* fix PinPasswordActivityTest for robolectric

* added todo
prayutsu pushed a commit to prayutsu/oppia-android that referenced this issue Sep 25, 2020
…orationActivityTest (oppia#1850)

* fix ExplorationActivityTest for robolectric

* max line fix

* nit changes

* aaded todo 1855
prayutsu pushed a commit to prayutsu/oppia-android that referenced this issue Sep 25, 2020
…ingTopicListActivityTest (oppia#1863)

* fix OngoingTopicListActivityTest test for robolectric

* removed unnecessary functions
@BenHenning BenHenning added the Z-ibt Temporary label for Ben to keep track of issues he's triaged. label Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Essential This work item must be completed for its milestone. Z-ibt Temporary label for Ben to keep track of issues he's triaged.
Development

No branches or pull requests

9 participants