Transcripted Summary

In this lecture, we are going to be discussing grouping tests by suites.

Grouping your tests by suites makes it easier for you to run a suite of tests, versus running everything even though you may not need to run all your tests.

It also makes it easier for you to run a specific set of tests instead of specifying the path to the test.

The first thing that we need to do is to go into our package.json.

Under scripts, we then to say "actions": "wdio” (which is a command to run the test), then --suite using the suite command which is a command provided by WebriverIO when you want to run a suite of tests.

And then we're going to call it by a specific name, then we're going to say, “actions”.

  "scripts": {
    "test": "wdio",
    "actions": "wdio --suite actions",
    "login": "wdio --suite login"

Okay, let us in our test folder create a sub folder called actions.

And we're going to move our [elementActions.test.js]( to that folder.

So, our elementActions.test.js is now in the sub folder called actions.

We are then going to go into our wdio.conf.js file, and we are going to add our suites.

We can add this anywhere in our file.

So let us say suites: { and then the name of our suite, which is “actions”.

Then we're going to put the path for this actions suite, which is ./test/actions

Then we're going to use the asterisk, which is a catch all to say: “within actions, any file that ends with a js we are going to run it”.

    suites: {
        actions: [

And so now we can use 2 commands to run our suite.

We can say, npm run --suite actions.

Or we can just say npm run actions and it will run the elementActions.test.js. Let us just run that.

And it runs our elementActions test suite.

This is very useful if it is that you want to run a group of tests, it saves you the time of just calling npm run test, as that will run everything, even those that you don't want running at that time.



The quiz for this chapter can be found in Chapter 9.5.

© 2024 Applitools. All rights reserved. Terms and Conditions Privacy Policy GDPR