Skip to content
Learn with RV – Tech Blog
Learn with RV – Tech Blog

#testautomation #qa #programming #linux #devops

  • Home
  • RV Portfolio
  • 1 on 1 Mentoring & Workshops
  • YouTube
  • LinkedIn
  • Contact
Learn with RV – Tech Blog

#testautomation #qa #programming #linux #devops

tc-meta
August 7, 2023August 8, 2023

How to run specific tests using Tags in TestCafe

There are lots of situations when we need to run only some of our automated tests instead of the whole test suite (e.g. run only the smoke tests instead of the full regression suite; the entire suite grows and you might want to run only subsets of your tests, and so on).

This thing is possible in TestCafe using the metadata filters.

How do we apply this approach?

Step 1 – Include meta  in your test or fixture (key-value pairs, e.g. .meta(‘type’, ‘smoke’))

Personal use case: I used this approach for filtering tests using meta tags by ‘smoke’ and ‘regression’ values. On DEV environments I want to run only the tests marked with ‘smoke’ tag, and on STG environment I want to run all the tests (marked with ‘regression’ meta).

In the following test file, I included .meta(‘type’,’smoke’) in the title of test2 and test3, and .meta(‘type’,’regression’) for test 4.

tc-tests-filter
Step 2 – Run the tests from CLI, using the --test-meta type=smoke flag. The test execution will 
include only the tests that contain this meta tag value (e.g. test2 and test3).

Note: you can add meta on fixtures (test suites) as well, not only on individual tests. More information HERE

If you liked this article, then please subscribe to my YouTube Channel for Test Automation video tutorials. You can also find me on LinkedIn and Twitter.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Related

Share this article:
QA #testautomation#testcafe

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • ChanceJS – a Faker alternative for generating random realistic data?
  • Camel Case vs. Snake Case vs. Pascal Case vs. Kebab Case — Naming Conventions
  • How to scan your website to spot potential BROKEN LINKS
  • Selenium: Testing Framework or Tool?
  • Automated Tests for website Accessibility with Axe and TestCafe

Recent Comments

  1. Automated Tests for website Accessibility with Axe and TestCafe - Learn with RV - Tech Blog on How to generate E2E TestCafe Framework in seconds
  2. RV on Exploring Faker.js: A Powerful Tool for Generating Realistic Random Test Data
  3. Adrian Maciuc on Exploring Faker.js: A Powerful Tool for Generating Realistic Random Test Data
  4. Nick on Cypress vs Playwright vs Testcafe – which framework is faster?
  5. RV on Cypress vs Playwright vs Testcafe – which framework is faster?

Archives

  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023

Categories

  • Programming
  • QA
  • Tools
©2023 Learn with RV – Tech Blog | WordPress Theme by SuperbThemes