# Specs and Suite Labels

Specs and suites can be tagged with TestBox labels. Labels allow you to further categorize different specs or suites so that when a runner executes with `labels` attached, only those specs and suites will be executed; the rest will be skipped. You can alternatively choose to skip specific labels when a runner executes with `excludes` attached.

```javascript
describe(title="A spec", labels="stg,railo", body=function() {
     it("executes if its in staging or in railo", function() {
          coldbox = 0;
          coldbox++;

          expect( coldbox ).toBe( 1 );
     });
});

describe("A spec", function() {
     it("is just a closure, so it can contain any code", function() {
          coldbox = 0;
          coldbox++;

          expect( coldbox ).toBe( 1 );
     });

     it(title="can have more than one expectation and labels", labels="dev,stg,qa,shopping", body=function() {
          coldbox = 0;
          coldbox++;

          expect( coldbox ).toBe( 1 );
          expect( coldbox ).toBeTrue();
     });
});
```

## Direct Suite Name Matching

When using the `testSuites` filter (via a runner, the CLI, or `TestBox` directly), TestBox performs **direct suite name matching** at any nesting depth. This means if a suite's name exactly matches the filter value it will always be included — regardless of where it sits in the nesting hierarchy.

```javascript
// This suite will always be included when testSuites="My Integration Suite"
// even if it is nested 3 levels deep
describe("My Integration Suite", function() {
     it("runs when targeted by name", function() {
          expect( true ).toBeTrue();
     });
});
```

Targeting by name from the various runners:

```bash
# BoxLang CLI runner
./testbox/run --filter-suites="My Integration Suite"

# CommandBox CLI runner
testbox run testSuites="My Integration Suite"
```

```javascript
// Programmatically via TestBox
new testbox.system.TestBox(
    bundles    = "tests.specs",
    testSuites = "My Integration Suite"
).run();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://testbox.ortusbooks.com/getting-started/testbox-bdd-primer/specs-and-suite-labels.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
