Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Switch off Stacktrace output #696

Closed
Mikrovolnovka opened this issue Apr 10, 2014 · 9 comments
Closed

Switch off Stacktrace output #696

Mikrovolnovka opened this issue Apr 10, 2014 · 9 comments

Comments

@Mikrovolnovka
Copy link

Is there way to switch off the Stacktrace output into console on failures?
e.g.
Current behavior:

Failures:

  1) Components.js Validate Tag Component tutorial on frontend page Element tag
component number 1 has item Text234234
   Message:
     Expected 0 to be greater than 0.
   Stacktrace:
     Error: Expected 0 to be greater than 0.
    at new jasmine.ExpectationResult (c:\Users\dyaroshenko\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:137:32)

    at null.toBeGreaterThan (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modul
es\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:1339:29)
    at d:\work\wmg\js-framework-examples\bower_components\factory-testing-framew
ork\modules\helper.js:63:32
    at c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protractor\node_mod
ules\selenium-webdriver\lib\goog\base.js:1178:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (c:\Users\dyaroshenko\AppDat
a\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdri
ver\promise.js:1598:20)
    at notify (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protractor\
node_modules\selenium-webdriver\lib\webdriver\promise.js:428:12)
    at notifyAll (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protract
or\node_modules\selenium-webdriver\lib\webdriver\promise.js:397:7)
    at resolve (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protractor
\node_modules\selenium-webdriver\lib\webdriver\promise.js:375:7)
    at fulfill (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protractor
\node_modules\selenium-webdriver\lib\webdriver\promise.js:493:5)
    at Object.webdriver.promise.asap (c:\Users\dyaroshenko\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:
732:5)

  2) Components.js Validate Tag Component tutorial on frontend page Element tag
component number 2 has item Lisa Simpson
   Message:
     Expected 0 to be greater than 0.
   Stacktrace:
     Error: Expected 0 to be greater than 0.
    at new jasmine.ExpectationResult (c:\Users\dyaroshenko\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:137:32)

    at null.toBeGreaterThan (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modul
es\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:1339:29)
    at d:\work\wmg\js-framework-examples\bower_components\factory-testing-framew
ork\modules\helper.js:63:32
    at c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protractor\node_mod
ules\selenium-webdriver\lib\goog\base.js:1178:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (c:\Users\dyaroshenko\AppDat
a\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdri
ver\promise.js:1598:20)
    at notify (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protractor\
node_modules\selenium-webdriver\lib\webdriver\promise.js:428:12)
    at notifyAll (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protract
or\node_modules\selenium-webdriver\lib\webdriver\promise.js:397:7)
    at resolve (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protractor
\node_modules\selenium-webdriver\lib\webdriver\promise.js:375:7)
    at fulfill (c:\Users\dyaroshenko\AppData\Roaming\npm\node_modules\protractor
\node_modules\selenium-webdriver\lib\webdriver\promise.js:493:5)
    at Object.webdriver.promise.asap (c:\Users\dyaroshenko\AppData\Roaming\npm\n
ode_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:
732:5)

Finished in 23.552 seconds
7 tests, 3 assertions, 2 failures

Expected behavior:

Failures:

  1) Components.js Validate Tag Component tutorial on frontend page Element tag
component number 1 has item Text234234
   Message:
     Expected 0 to be greater than 0.

  2) Components.js Validate Tag Component tutorial on frontend page Element tag
component number 2 has item Lisa Simpson
   Message:
     Expected 0 to be greater than 0.

Finished in 23.552 seconds
7 tests, 3 assertions, 2 failures

Investigated a bit.

Found that --stackTrace false CLI argument seems not to work

protractor-conf.js options don't work too:

exports.config = {
    ...
    jasmineNodeOpts: {
        ...
        includeStackTrace: false,
        ...
    }
    ...
};

Thanks in advance

@lynndylanhurley
Copy link

+1

Too much noise. A simple error takes up like 7 screens. 100 consecutive lines of at <annonymous> does not help me.

@Mikrovolnovka
Copy link
Author

Yes, me too. Maybe there can be super-improvement to get something like this:

Failures:

  1) Components.js Validate Tag Component tutorial on frontend page Element tag
component number 1 has item Text234234
   Message:
     "Expected 0 to be greater than 0"
     at line XX in file/where/expect/found.js

  2) Components.js Validate Tag Component tutorial on frontend page Element tag
component number 2 has item Lisa Simpson
   Message:
     Expected 0 to be greater than 0.
     at line XY in file/where/expect2/found.js

Finished in 23.552 seconds
7 tests, 3 assertions, 2 failures

@juliemr
Copy link
Member

juliemr commented Apr 11, 2014

The command line option for setting something to false is --no-stackTrace - this is odd, but it's how optimist works. It should probably be better documented, sorry it's hard to find :(

Are you sure changing the config doesn't work though? It's working in Protractor's own tests.

@lynndylanhurley
Copy link

@juliemr - protractor protractor.conf.js --no-stackTrace and protractor protractor.conf.js both give me the same results:

screen shot 2014-04-11 at 2 16 57 pm

Here is my protractor config file:

exports.config = {
  // The address of a running selenium server.
  seleniumAddress: 'http://127.0.0.1:4444/wd/hub',

  capabilities: {
    'browserName': 'chrome'
  },

  // Spec patterns are relative to the current working directly when
  // protractor is called.
  specs: ['test/e2e/**/*.coffee'],

  framework: 'mocha',
  baseUrl:   'http://databox-admin.dev',
  stackTrace: false
};

Could this be because I'm using mocha instead of jasmine?

@juliemr
Copy link
Member

juliemr commented Apr 11, 2014

Yes, it's because of mocha. The stack traces option is specific to the test framework, because the test framework is what prints out the results.

It looks like Mocha always outputs stack traces. See mochajs/mocha#545 and openlayers/openlayers#391

@lynndylanhurley
Copy link

Ahh that makes sense. Thx @juliemr

@Mikrovolnovka
Copy link
Author

Thanks, @juliemr. I've realized it works fine without --verbose argument.
And is there way to make it work with --verbose?

$ protractor conf/protractor-conf.js --no-stackTrace --verbose

------------------------------------
PID: 14884 (capability: chrome #1)
------------------------------------

Using the selenium server at http://localhost:4444/wd/hub

Components.js


    Before feature: Validate Breadcrumb Component tutorial on frontend page
        Login and open page
        Open page
        Click on FRONTEND item

    Validate Breadcrumb Component tutorial on frontend page
        Click on breadcrumb next item
        Current url contains /component_library/breadddcrumb
        Component tutorial header is Breadcrumb
        tutorial subheader Usage is present
        tutorial subheader Dependencies is present

Failures:

  1) Components.js
    Before feature: Validate Breadcrumb Component tutorial on frontend page Logi
n and open page
   Message:
     Expected false to be true.
   Stacktrace:
     Error: Failed expectation
    at PageObject.login (d:\work\wmg\js-framework-examples\bower_components\fact
ory-testing-framework\pages\login.js:45:109)
    at null.<anonymous> (d:\work\wmg\js-framework-examples\tests\dev_portal\step
s\login.js:5:29)
    at flow.execute.then.e.stack (c:\Users\dyaroshenko\AppData\Roaming\npm\node_
modules\protractor\jasminewd\index.js:36:14)
    at webdriver.promise.ControlFlow.runInNewFrame_ (c:\Users\dyaroshenko\AppDat
a\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdri
ver\promise.js:1598:20)
    at webdriver.promise.ControlFlow.runEventLoop_ (c:\Users\dyaroshenko\AppData
\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriv
er\promise.js:1463:8)

  2) Components.js
    Before feature: Validate Breadcrumb Component tutorial on frontend page Clic
k on FRONTEND item
   Message:
     TypeError: Cannot read property 'ELEMENT' of undefined
   Stacktrace:
     Error
    at steps.components.itClickOnDocsCategory (d:\work\wmg\js-framework-examples
\tests\dev_portal\steps\components.js:9:13)
    at null.<anonymous> (d:\work\wmg\js-framework-examples\bower_components\fact
ory-testing-framework\modules\controller.js:70:32)
...

@juliemr
Copy link
Member

juliemr commented Apr 14, 2014

Nope, verbose overrides stacktrace. This is how jasmine-node set up its reporters - I added an issue to minijasminenode to track this. It will probably get taken care of in the update to Jasmine 2.0. juliemr/minijasminenode#15

Closing this issue, please add comments to the one for minijasminenode!

@juliemr juliemr closed this as completed Apr 14, 2014
@Shirish2015
Copy link

@juliemr.I am facing the following issue when I'm running my test
script at the time of validation.
Message:
Expected false to be true.
Stacktrace:
Error: Expected false to be true.
at WebdriverIO. (/Users/skumar/projects/reports/test/functional/jasmine-specs/testSuiteSpec.js:33:59)
at WebdriverIO. (/Users/skumar/projects/func-kit/node_modules/webdriverio/lib/utils/PromiseHandler.js:152:26)
at /Users/skumar/projects/func-kit/node_modules/webdriverio/node_modules/chainit/index.js:137:22
at /Users/skumar/projects/func-kit/node_modules/webdriverio/lib/commands/getAttribute.js:93:9
at /Users/skumar/projects/func-kit/node_modules/webdriverio/node_modules/async/lib/async.js:154:25
at WebdriverIO. (/Users/skumar/projects/func-kit/node_modules/webdriverio/lib/commands/getAttribute.js:64:21)
at WebdriverIO. (/Users/skumar/projects/func-kit/node_modules/webdriverio/lib/utils/PromiseHandler.js:152:26)
at /Users/skumar/projects/func-kit/node_modules/webdriverio/node_modules/chainit/index.js:137:22

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants