is there any API in Rspec to get the examples we have already run?

21 views
Skip to first unread message

pku.xi...@gmail.com

unread,
Sep 7, 2015, 11:37:14 PM9/7/15
to rspec
We have a requirement to write a special test case to check what test cases have been run during this time rspec run. As now we have some CI pipelines which contain a step to run different set of test cases, so for each pipeline, we want to add a special test case at the end of the rspec run to check what set of test cases have been run, is there any Rspec API to help do this?

Jon Rowe

unread,
Sep 7, 2015, 11:54:09 PM9/7/15
to rs...@googlegroups.com
There’s a private api on world that allows you access to the filtered examples, because it’s private it’s subject to change in minor or patch level increases but you could probably use it for a proof of concept at least. `RSpec.world.filtered_examples`

Jon Rowe
---------------------------

On Tuesday, 8 September 2015 at 13:32, pku.xi...@gmail.com wrote:

We have a requirement to write a special test case to check what test cases have been run during this time rspec run. As now we have some CI pipelines which contain a step to run different set of test cases, so for each pipeline, we want to add a special test case at the end of the rspec run to check what set of test cases have been run, is there any Rspec API to help do this?

--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/3b8ac764-2037-49ed-9ebb-9289129c4ee2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pku.xi...@gmail.com

unread,
Sep 8, 2015, 1:37:19 AM9/8/15
to rspec
Thanks Jon, not sure if rspec consider to add some more interfaces like this in the future. Yeap, I think this private method is just ok for PoC things, we will try some other work around like adding some 'before' hooks for now.

在 2015年9月8日星期二 UTC+8上午11:54:09,Jon Rowe写道:

Jon Rowe

unread,
Sep 8, 2015, 1:44:26 AM9/8/15
to rs...@googlegroups.com
You can also use the reporter listener interface (which is public and used by the formatters) to build a completely custom report of what’s run, if you look at how the various formatters are put together you’ll see you can register for various events (like example passed, failed, pending etc) and capture all the information you need.

Jon Rowe
---------------------------

Reply all
Reply to author
Forward
0 new messages