usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
26.87k stars 1.23k forks source link

CLI does not respect tests in subfolders folder.bru #3002

Open Placeprom opened 2 months ago

Placeprom commented 2 months ago

I have checked the following:

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

berlingoqc commented 2 months ago

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 commented 2 months ago

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

Placeprom commented 2 months ago

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

berlingoqc commented 2 months ago

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