Opened on 06/22/2016 at 07:54:38 AM

Closed on 10/23/2018 at 10:26:06 AM

#4180 closed defect (fixed)

Fix NotificationTest.testMarkAsShown test

Reported by: asmirnov Assignee: asmirnov
Priority: P3 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: rjeschke Blocked By: #4031
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29347202/

Description (last modified by asmirnov)

The test is about marking notifications as shown and making sure it's not shown any more.
However it's not stable - it can succeed or fail almost randomly and this should be fixed (it should succeed permanently).

Started the testing 2 times in a row without any changed.
it succeed and failed:

test:
     [echo] Running tests ...
     [exec] WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
     [exec] 
     [exec] org.adblockplus.libadblockplus.tests.NotificationTest:.....
     [exec] Test results for InstrumentationTestRunner=.....
     [exec] Time: 1.283
     [exec] 
     [exec] OK (5 tests)
     [exec] 
     [exec] 

BUILD SUCCESSFUL
Total time: 15 seconds
MBA-Anton:libadblockplus-android-tests asmirnov$ ant test
Buildfile: /Users/asmirnov/Documents/dev/src/libadblockplus-android.ssh/libadblockplus-android-tests/build.xml

-check-env:
 [checkenv] Android SDK Tools Revision 24.4.1
 [checkenv] Installed at /softdev/android-sdk-r22_3-2

-setup:
     [echo] Project Name: Adblock Plus Library Tests
  [gettype] Project Type: Test Application

-test-project-check:

test:
     [echo] Running tests ...
     [exec] WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
     [exec] 
     [exec] org.adblockplus.libadblockplus.tests.NotificationTest:...
     [exec] Failure in testMarkAsShown:
     [exec] junit.framework.AssertionFailedError
     [exec] 	at org.adblockplus.libadblockplus.tests.NotificationTest.testMarkAsShown(NotificationTest.java:147)
     [exec] 	at java.lang.reflect.Method.invokeNative(Native Method)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
     [exec] 	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
     [exec] 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
     [exec] .
     [exec] Test results for InstrumentationTestRunner=....F.
     [exec] Time: 0.197
     [exec] 
     [exec] FAILURES!!!
     [exec] Tests run: 5,  Failures: 1,  Errors: 0
     [exec] 
     [exec] 

BUILD SUCCESSFUL

According c++ test (https://hg.adblockplus.org/libadblockplus/file/tip/test/Notification.cpp#l186) works as expected (adding id:'id' does not affect testing), i've compiled and tested it:

[ RUN      ] NotificationTest.MarkAsShown
[       OK ] NotificationTest.MarkAsShown (310 ms)

revision used:

changeset:   348:031f392dda1c
bookmark:    master
user:        Sergei Zabolotskikh <serggzz@gmail.com>
date:        Mon May 23 15:28:30 2016 +0200
summary:     Issue #3593, #1197- fix isolate management

Attachments (0)

Change History (6)

comment:1 Changed on 06/22/2016 at 07:57:28 AM by asmirnov

  • Description modified (diff)

comment:2 Changed on 06/22/2016 at 09:15:48 AM by asmirnov

everything seems to be ok in jni code but still getting a notification.
(modified jni code for debug output)

06-22 05:13:50.015    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ evaluate "(function()
    {
    require('notification').Notification.addNotification({ type:'question', message:'msgToHide' });
    })();"
06-22 05:13:50.015    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ showNextNotification for url=""
06-22 05:13:50.015    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ notification callback fired with message "msgToHide"
06-22 05:13:50.015    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ showNextNotification for url=""
06-22 05:13:50.015    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ notification callback fired with message "msgToHide"
06-22 05:13:51.025    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ markAsShown for "msgToHide"
06-22 05:13:51.025    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ showNextNotification for url=""
06-22 05:13:51.025    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ notification callback fired with message "msgToHide"
06-22 05:13:51.055    4991-5006/org.adblockplus.libadblockplus.tests D/abp﹕ showNextNotification for url=""

06-22 05:13:51.025    4991-5006/org.adblockplus.libadblockplus.tests I/TestRunner﹕ junit.framework.AssertionFailedError: Expected: <null> but was:  - msgToHide
            at junit.framework.Assert.fail(Assert.java:50)
            at junit.framework.Assert.assertTrue(Assert.java:20)
            at junit.framework.Assert.assertNull(Assert.java:237)
            at junit.framework.Assert.assertNull(Assert.java:230)
            at org.adblockplus.libadblockplus.tests.NotificationTest.testMarkAsShown(NotificationTest.java:159)

Last edited on 06/22/2016 at 09:18:08 AM by asmirnov

comment:3 Changed on 07/01/2016 at 02:18:32 PM by asmirnov

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:4 Changed on 09/16/2016 at 10:18:24 AM by abpbot

A commit referencing this issue has landed:
Issue 4180 - Fix NotificationTest.testMarkAsShown test

comment:5 Changed on 10/23/2018 at 10:21:42 AM by asmirnov

For some reason after marking the issue as resolved it's not closed (Trac issue/hook?)

comment:6 Changed on 10/23/2018 at 10:26:06 AM by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from asmirnov.
 
Note: See TracTickets for help on using tickets.