Opened 8 years ago

Closed 7 years ago

#10232 closed Feature Requests (fixed)

Accessing test units in test_suite by index

Reported by: ch0kee@… Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost 1.55.0 Severity: Problem
Keywords: boost test test_suite Cc:

Description

We need a way to walk over all the test units in a test_suite, even if they are not p_enabled.

Currently, Boost.Test lets you access elements in a test tree using either traverse_test_tree which skips disabled test suites, or by test unit name.

test_suite already has a public method, that gives back the number of test units members (test_suite::size()).

It would be nice, if we could access any element in the vector by index, like this:

// access methods
...
    test_unit_id    get( std::size_t idx ) const { return m_members[idx]; } 
...

I need this, because our test program selects and runs tests multiple times (through an interactive console), and we filter them every time, so I want to reset the p_enabled flag to false before filtering them again.

Now I think the only way to do this is by modifying boost itself. Either adding a new friend traverse function, that doesn't skip disabled members, or by adding the aforementioned get function.

Change History (1)

comment:1 by Gennadiy Rozental, 7 years ago

Resolution: fixed
Status: newclosed

This part of the framework is completely rewritten in new release. You now have an ability to visit all test units ignoring the status

Note: See TracTickets for help on using tickets.