sstephenson / bats

Bash Automated Testing System
MIT License
7.12k stars 518 forks source link

[Question] How to output submodule bats if it is called inside another bats? #214

Open ShahriyarR opened 7 years ago

ShahriyarR commented 7 years ago

Hi all, I would like to ask if it is possible to echo the run status of sub-bats files if they are called inside another bats. For eg.

$ instance_t="pxc" instance_c="3" bats ./percona-qa/pmm-tests/pmm-testsuite.bats 
✓ Wipe clients 
✓ Adding clients 
✓ Running linux metrics tests 
✓ Running generic tests 
✓ Running PS specific tests 
✓ Wipe clients 
6 tests, 0 failures

As you see,there are submodules(sub-bats) files called from pmm-testsuite.bats

For eg, Running generic tests will call generic-tests.bats, if you run it directly:

$ bats ./percona-qa/pmm-tests/generic-tests.bats
 ✓ run pmm-admin under regular(non-root) user privileges
 - run pmm-admin under root privileges (skipped: Skipping this test, because you are NOT running under root)
 ✓ run pmm-admin without any arguments
 ✓ run pmm-admin help
 ✓ run pmm-admin -h
 ✓ run pmm-admin with wrong option
 ✓ run pmm-admin ping
 ✓ run pmm-admin check-network
 ✓ run pmm-admin list to check for available services
 ✓ run pmm-admin info
 ✓ run pmm-admin show-passwords
 ✓ run pmm-admin --version
 ✓ run pmm-admin start without service type
 ✓ run pmm-admin stop without service type
 ✓ run pmm-admin restart without service type
 ✓ run pmm-admin purge without service type
 ✓ run pmm-admin config without parameters

17 tests, 0 failures, 1 skipped

So I am looking for something like:

$ instance_t="pxc" instance_c="3" bats ./percona-qa/pmm-tests/pmm-testsuite.bats 
✓ Wipe clients 
✓ Adding clients 
✓ Running linux metrics tests 
✓ Running generic tests:
            ✓ run pmm-admin under regular(non-root) user privileges
            - run pmm-admin under root privileges (skipped: Skipping this test, because you are NOT running under root)
            ✓ run pmm-admin without any arguments
            ✓ run pmm-admin help
            ✓ run pmm-admin -h
            ✓ run pmm-admin with wrong option
            ✓ run pmm-admin ping
            ✓ run pmm-admin check-network
            ✓ run pmm-admin list to check for available services
            ✓ run pmm-admin info
            ✓ run pmm-admin show-passwords
            ✓ run pmm-admin --version
            ✓ run pmm-admin start without service type
            ✓ run pmm-admin stop without service type
            ✓ run pmm-admin restart without service type
            ✓ run pmm-admin purge without service type
            ✓ run pmm-admin config without parameters
✓ Running PS specific tests 
✓ Wipe clients 
6 tests, 0 failures
ShahriyarR commented 7 years ago

@sstephenson @mislav Could you please share your ideas here? :) Thanks.