Open ochameau opened 9 years ago
Also, I'm wondering how can I see sucessful assertions in the command line output? I only see:
SUITE-START | Running 1 tests
TEST-START | test_sample.py TestSample.test_js
TEST-PASS | test_sample.py TestSample.test_js | took 643ms
whereas I would like to see message about "Assertion from a JS script!"
and "Assertion from setTimeout!"
.
I got it to work with something like this:
diff --git a/luciddream/__init__.py b/luciddream/__init__.py
index 6e144b0..91e757d 100644
--- a/luciddream/__init__.py
+++ b/luciddream/__init__.py
@@ -10,8 +10,9 @@ from marionette.marionette_test import MarionetteTestCase, MarionetteJSTestCase
from marionette.errors import ScriptTimeoutException
class LucidDreamTestCase(MarionetteTestCase):
- def __init__(self, marionette_weakref, browser=None, **kwargs):
+ def __init__(self, marionette_weakref, browser=None, foo=None, **kwargs):
self.browser = browser
+ self.logger = foo
MarionetteTestCase.__init__(self, marionette_weakref, **kwargs)
def run_js_test(self, filename, marionette):
diff --git a/luciddream/runluciddream.py b/luciddream/runluciddream.py
index 241dc61..761d504 100644
--- a/luciddream/runluciddream.py
+++ b/luciddream/runluciddream.py
@@ -117,6 +117,7 @@ def main():
kwargs = {
'browser': browser,
'logger': logger,
+ 'foo': logger
}
if args.b2gPath:
kwargs['homedir'] = args.b2gPath
Running my local Luciddream against the marionette-client from m-c this works for me, maybe something got fixed when I refactored run_js_test there?
SUITE-START | Running 1 tests
TEST-START | test_sample.py TestSample.test_js
TEST-UNEXPECTED-FAIL | test_sample.py TestSample.test_js | test failure - false was false, expected true
TEST-UNEXPECTED-FAIL | test_sample.py TestSample.test_js | AssertionError: 1 tests failed
Traceback (most recent call last):
File "/build/mozilla-central/testing/marionette/client/marionette/marionette_test.py", line 289, in run
testMethod()
File "/build/luciddream/example-tests/test_sample.py", line 14, in test_js
self.run_js_test('test.js', self.marionette)
File "/build/luciddream/luciddream/__init__.py", line 31, in run_js_test
return MarionetteTestCase.run_js_test(self, script, marionette)
File "/build/mozilla-central/testing/marionette/client/marionette/marionette_test.py", line 576, in run_js_test
'%d tests failed' % len(results['failures']))
TEST-INFO took 556ms
TEST-START | test_sample.py TestSample.test_sample
TEST-PASS | test_sample.py TestSample.test_sample | took 137ms
SUMMARY
-------
passed: 1
failed: 1
todo: 0
FAILED TESTS
-------
test_sample.py test_sample.TestSample.test_js
SUITE-END | took 0s
Failing assertions in js files are throwing this assertion:
TEST-UNEXPECTED-ERROR | test_sample.py TestSample.test_js | AttributeError: 'TestSample' object has no attribute 'logger'
instead of something meaningful.You can easily reproduce that by uncommenting the failing assertion in
example-tests/test.js
.May be it is due to my env? Here is how I am running it:
runluciddream --b2g-desktop-path b2g/b2g-bin --browser-path ~/firefox64/firefox --gaia-profile ~/gaia
/profile/ example-tests/luciddream.ini`