question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests are way too slow when this preprocessor is used

See original GitHub issue

Tried a simple button test

  1. button.spec.ts - finishes in 4s
  2. button.feature - finishes in 40s

button.spec.ts

describe('Button - vanilla', () => {
  it('should launch button page', () => {
    cy.visit('/components/ui/button');
    cy.contains('Examples').click();
    cy.contains('Secondary Buttons').click();
    cy.get('#button-secondary').should('be.visible');
  });
});

button.feature

Feature: Button

  TRQ-XXXXX

  Background:
    Given button page is open

  Scenario: Default Button
    When I click on examples tab
    And I click on secondary-buttons example
    Then I should see secondary button

button.steps.ts

import { Given, When, And, Then } from 'cypress-cucumber-preprocessor/steps';

Given(`button page is open`, () => {
  cy.visit('/components/ui/button');
});

When(`I click on examples tab`, () => {
  cy.contains('Examples').click();
});

And(`I click on secondary-buttons example`, () => {
  cy.contains('Secondary Buttons').click();
});

Then(`I should see secondary button`, () => {
  cy.get('#button-secondary').should('be.visible');
});

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
rodrigo-vazquezcommented, Jun 23, 2021

Hi! Are there any news on this? We recently migrated from stock Cypress Mocha to cucumber using the preprocessor and the Suite of 10 somewhat long tests we have currently is taking double the time it used to with Mocha.

We’re using Cypress 7.5.0 and cypress-cucumber-preprocessor 4.1.2.

Things we already tried…

  1. Using or not using Data Tables
  2. Using global Steps or Feature Steps
  3. Going back versions of both Cypress and the Cucumber Preprocessor
  4. Turning the ‘numTestsKeptInMemory’ to 0

Thanks!!

0reactions
badeballcommented, Apr 18, 2022

I did some investigating myself and unfortunately found no performance overhead associated with using the preprocessor (note: using latest version, see https://github.com/badeball/cypress-cucumber-preprocessor/issues/689). I took one of the tests that are auto-generated when opening Cypress for the first time, duplicated and re-wrote it using steps. This can be found at badeball/cypress-cucumber-performance-comparison. Then I ran everything ten times. Below are the results.

todo.feature todo.spec.js
1. run 03:04 03:00
2. run 03:02 03:00
3. run 03:06 03:01
4. run 03:03 02:59
5. run 03:05 03:01
6. run 03:04 02:58
7. run 03:02 02:58
8. run 03:02 02:58
9. run 03:02 03:01
10. run 03:02 03:01

As you can see, there was little to no difference.

Unless anyone can show me otherwise, I’m considering this a non-issue. That’s not so say that you’re not experiencing any issues, but I can’t investigate and fix something that I can’t observe myself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests are way too slow when this preprocessor is used #336
Tried a simple button test button.spec.ts - finishes in 4s button.feature ... Tests are way too slow when this preprocessor is used #336....
Read more >
9 Ways To Make Slow Tests Faster - Semaphore CI
Making slow tests fast again​​ Here are the nine most common performance problems and their solutions: My tests are too large: break them...
Read more >
Angular 4 Unit Tests (TestBed) extremely slow - Stack Overflow
There I use fixture.detectChanges() only when I need to check/test the changed values, but the test take 15 seconds to run (on avarage...
Read more >
c++ - Do preprocessor defines slow down build times?
It seems like the build time would be faster if the preprocessor didn't need to scan and replace the defines for files that...
Read more >
How to preprocess Cypress tests with Vite - Adam Lynch
The preprocessor hook I'll be using isn't supported for component tests. However, the Cypress team have created a @cypress/vite-dev-server ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found