Situation: We are currently running thousands of functional tests(FT) to test a web application. FTs are written in JVM based programming languages: Java, scala, and groovy with the help of cucumber, gherkin, and selenium. There are many Jenkins job created to run all the FTs on a different server. Jenkins job takes 3-4 hours. they fail many times with some unknown exceptions or timeout. At last, most of the builds are red all the time.

I was wondering if switching to Node.js can improve the situation.

  • Moving to NodeJS won't solve your Timeouts or other exception problems. If your code runs locally and fails on Jenkins, how will moving to NodeJS help? Rather you should handle these exceptions by giving more timeout or waiting for specific elements to load.
    – Shamanth
    May 2 '19 at 7:27
  • What do you mean by ' switching to nodeJS'? May 2 '19 at 9:15
  • Are you asking if you write your test cases in JavaScript than Java? May 2 '19 at 9:16
  • @VishalAggarwal Yes May 3 '19 at 1:03
  • @Shamanth I mean if I switch to nodejs can it make the tests faster to run. So I can avoid timeout issue. I'm also seeing SSL issues due to old version of JDK on server. And I also wanted to remove the possibility of using reflection in the implementation. May 3 '19 at 1:07

No, Nodejs will just complicate your life more, as JavaScript is async.

Brittle, Flickring tests is not a problem of the programming language used. It is about how the tests are coded/designed.

Another programming language will not make it faster probably, designing tests to be run in parallel is.

  • Make a list of flaky tests
  • Record info, logs, screenshots, memory dumps, etc
  • Fix or remove them!

Sometimes tests fail due to infrastructure issues, you could try a re-run strategy. E.g. rerun all failed tests, then rerun all failed tests again. The set of failed tests should get smaller and smaller. After three runs probably it is a real defect.

Interesting read: https://hackernoon.com/flaky-tests-a-war-that-never-ends-9aa32fdef359


After few experiments, we switched to a node js framework, Cypress. It solves our issue of flaky tests and gave us a few benefits of a11y testing etc. It also reduced the the tests complexity and totle code. However, since Cypress runs all the tests in sequence and their parallel run is a paid feature. The build is taking a lot of time to complete the all tests. So I'm working on that solution too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.