-4

I run Cypress UI tests locally and in a GitLab pipeline. I want to put them under performance measuring. I am not very experienced with that. What is the best way to do that?

I tried to launch k6 from my Cypress tests but it seems like Cypress prevented the browsers from delivering the results and deactivated plugins during runtime (separate issue -> How to run Cypress UI and API tests under k6 performance measuring control?). What do I have to do to do it correctly?

Could I do it the other way round – steering Cypress from k6? How? Would that be better?

I tried JMeter also. I set up Thread Groups, HTTP Requests, View Results … , launched my Cypress script with

npm run test:my-test && jmeter -n -t /c/tmp /apache-jmeter-5.6.3/test_plans/My\ Test\ Plan.jmx -l "C:\tmp \apache-jmeter-5.6.3\MyProject\results.jtl" 

but it did not write out the result files. How shall I do this properly?

7
  • What exactly do you want to test/measure? k6 already has a browser module to write and execute GUI tests, why do you think Cypress is needed too? Commented Sep 14 at 14:09
  • First, there are already many Cypress workflow tests existing in this project and they shall be used to simulate user behaviour. So k6 (or JMeter) shall run them in parallel and create user interaction that shall be measured how long it took before a feature change and how long after. Second, I haven't seen any k6 tests that simulate workflows themselves. If you can show them to me, I'll take a look at them. Commented Sep 14 at 18:20
  • I don't know what a "workflow" is in your case, but k6 can do browser automation with a Playwright-like API. It's unclear from your question what you want to test with k6 or jmeter – backend response times, UI latency, SLOs? The command in your question first executes your test:my-test task and after it has completed (successfully), it launches jmeter. Commented Sep 14 at 18:33
  • The team already has more than 80 workflows. They will not throw everything away just because another tool can also do something similar. Commented Sep 14 at 20:01
  • They have > 80 workflows. They will not throw all out just because another tool can also do something similar. A workflow is a sequence of steps that a user performs: log in, select x items, generate a report, check if all desired keys are in the report, delete a bunch of items from a cart, generate previews of locations on a map, and much more. They want to measure how long it took to generate the map view, to show the report to the user and all that. And I wrote that the jtl report was not written anywhere on the disk, so I don't know what your comment " it has completed" shall tell me. Commented Sep 14 at 20:07

1 Answer 1

0

Don't use real browsers for performance testing, for example here is the quote from documentation on Selenium - another browser automation framework

Performance testing using Selenium and WebDriver is generally not advised. Not because it is incapable, but because it is not optimised for the job and you are unlikely to get good results.

So instead of trying to launch multiple Cypress tests at the same time from JMeter I would rather recommend converting your Cypress tests into JMeter test plans

  1. Start JMeter proxy server
  2. Configure Cypress to use JMeter as the proxy
  3. Run your Cypress tests
  4. It will give you the "skeleton" of JMeter test plan, after doing correlation and parameterisation you will get a "pure" HTTP-protocol-based test plan
  5. Configure JMeter to behave more like a real browser
  6. Run your test, analyze results, raise issues, et.c
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.