Opened 3 years ago

Closed 14 months ago

#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

Change History (6)

comment:1 Changed 3 years ago by asmirnov

  • Description modified (diff)

comment:2 Changed 3 years ago 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 3 years ago by asmirnov (previous) (diff)

comment:3 Changed 3 years ago by asmirnov

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

comment:4 Changed 3 years ago by abpbot

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

comment:5 Changed 14 months ago by asmirnov

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

comment:6 Changed 14 months ago by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.