How to run only failed tests (protractor+jasmine) - automation

We have ~150 e2e tests and executing in multiple browsers like chrome, firefox, IE, Edge & Safari. Few tests are failing on different reasons. Is it possible to execute only failed tests using protractor?

Yes, You can use protractor-flake => https://www.npmjs.com/package/protractor-flake
It's able to rerun whole spec files. You actually can provide a parser which receives all test output. We use this and it's very helpful.

Related

Automatically disable browser cache in chrome while running tests using protractor

I am trying to run tests using protractor but i need to disable the browser cache in order to test some things. I do not want chrome to load the resources from browser cache instead i want it it to send the requests to server and download them. I have tried the following options as part of protractor capabilities but nothing seems to be working,
'--disable-cache',
'--disable-application-cache',
'--disable-offline-load-stale-cache',
'--disk-cache-size=0'```
what if you just run the tests in incognito? that shouldn't save nor reuse the cache
you can do it by passing --headless to chrome args

Is it possible to run all the tests using mocha even if there are some failures?

I am working on a node.js application and would like to know if there is a way I can run all the unit tests from all the sub modules even if there are some test failures to know how many tests are failing in total to start putting the fixes for them. We use mocha for our tests on the back-end and jest for the ui.
Thanks.
The default behavior for mocha is to run all the tests. If it is exiting after the first test failure, that would suggest that you are using the "bail" option typically enabled on the command line with either --bail or -b.
Relevant docs: https://mochajs.org/#-bail-b
It can also be caused by passing the option { bail: true } to mocha.setup(). Look in your test runner and in your package.json.
Lastly, the least likely of these possibilities is that it could also be caused by using this.bail() somewhere in the Mocha test runner.

How to run tests sequentially in Testcafe one browser?

I would like to see a better way to run tests sequentially in Testcafe one browser, I have more than 30 tests.
Currently I'm using numbers for each test:
List item
test1register.ts,
test2login.ts,
Just pass the directory in command line, it will run tests sequentially.
testcafe chrome ./tests/

serenity jbehave multiple browsers

I am trying to setup a test project that uses serenity and jbehave
I am noticing that all examples use serenity.properties that define a browser in it
I would like to structure my tests in a way so that same test can be executed in IE/firefox/chrome etc
How do I do this?
You can pass in properties as command line properties, so you can rerun the same tests with different browsers by passing in different settings for webdriver.driver, e.g.
$ mvn verify -Dwebdriver.driver=firefox
$ mvn verify -Dwebdriver.driver=chrome
etc.
I think you are able to get this to work by creating multiple Junit test classes with each its own driver and execute them all in a single run.
Every test class should be able to assign a specific 'managed' driver (e.g. PhantomJS, Chrome, Firefox). This is documented here: http://www.thucydides.info/docs/serenity/#_serenity_webdriver_support_in_junit
I don't know what the impact this would have on the generated report, hopefully you are still able to identify the feature/driver combination.

Is there console.log output support to terminal/command-line with intern-runner?

I have a dependency with Intern where we have to spin up a Selenium server and use PhantomJS for our tests. We use Jenkins and may need some more inspection/debug output to console but the console.log's get suppressed from the test files to terminal/command-line
Is console.log to terminal/command-line supported yet?
How console.log works with intern-runner depends on where your test code is running. Unit tests (specified with suites) run in the browser, so that's where console.log output ends up. There isn't currently a way to get console output out of a browser for unit tests.
Functional tests (specified with functionalSuites) control a browser, but actually run in Node.js, so output from console.log statements in functional tests generally goes to intern's stdout. The exceptions are log statements in execute and executeAsync blocks; since those blocks run in the browser, that's where the log output ends up. You can retrieve browser logs in functional tests using getLogsFor('browser'), but WebDriver log support is inconsistent between browsers.