bruno icon indicating copy to clipboard operation
bruno copied to clipboard

CLI does not respect tests in subfolders folder.bru

Open Placeprom opened this issue 1 year ago • 6 comments

I have checked the following:

  • [X] I use the newest version of bruno.
  • [X] I've searched existing issues and found nothing related to my issue.

Describe the bug

When I run my tests with cli from the root of my collection the tests inside collection.bru are run as expected. However tests which are inside the folder.bru inside the subfolders are never executed. I do not know if this is an expected behaviour but from my opinion it is not expected and differs from running the tests from the desktop app

.bru file to reproduce the bug

Collection bru:

tests {
  test("Status should be 200", function() {
    const data = res.getBody();
    expect(res.getStatus()).to.equal(200);
  });
}

folder.bru inside sub-folder:

meta {
  name: REST Endpunkte
}

tests {
  test("Response body should be JSON", function() {
    const data = res.getBody();
    expect(res.body).is.json;
  });
}

Screenshots/Live demo link

image

Placeprom avatar Sep 02 '24 15:09 Placeprom

indeed seems like it was designed to not run them but it's a bug still , the behaviour is expected.

From looking at the source code , it does not seem to load the folder.bru it just get all the file recursively and execute them one by one without checking the folder.bru

berlingoqc avatar Sep 02 '24 16:09 berlingoqc

i guess it was in the work at some point because there is a unused function to read the file

berlingoqc avatar Sep 02 '24 16:09 berlingoqc

Thanks for your reply! Do you have any recommendations on how to run the Tests of the subfolders in my ci/cd until there is a solution for this @berlingoqc ?

I am just getting started with bruno and I am trying to evaluate if it could replace Postman for us, therefore I am not that familiar with it yet

Placeprom avatar Sep 02 '24 19:09 Placeprom

No sorry

I'm in the same boat as you , new to the project and checking if the project can be used to replace our postman/newman.

But it seems to be a caveat that the client has its own code to execute requests, so every feature needs to be code for the cli and for the gui. So unaligned features are to be expected I think

berlingoqc avatar Sep 03 '24 13:09 berlingoqc

Hello,

We are using bruno to perform api tests. The requests are executed in a specific order using setNextRequest method. We also have request in different folders. To be clear, below is the kind of structure we have: |MyCollection |__ Collection.bru |__ | Folder A |__ |__ folder.bru |__ | Folder B |__ |__ folder.bru

When launching the runner from the UI it works nicely but in the CLI it seems the folder.bru scripts are not executed leading to only the request set up at Collection.bru file to be executed.

Has this bug been identified from your side? Where would it be located in your priorities? Do you have an expected date of fix?

Thanks

nparisse-coexya avatar May 19 '25 12:05 nparisse-coexya

@nparisse-coexya

I tested with a basic collection and ran it using the CLI. All scripts, including folder-level scripts, were executed as expected. I've attached the collection JSON for reference. I'm using CLI version 2.3.0 — let me know if I'm missing anything.

Image

my collection.json

anusree-bruno avatar May 21 '25 08:05 anusree-bruno