ChefSpec and Test Kitchen
Asked Answered
G

2

12

I am investigating if ChefSpec report (with coverage) and Test Kitchen report can be generated as junit format so they can be parsed then by Jenkins to publish results. Or if there is some other friendly way those results could be published by Jenkins.

Thanks.

Edit 1: Sorry if I explain incorrectly, but I know that chefspec is for unittest and test kitchen is for integration test. What I meant in this question is how to get test result reports (for both, chefspec and in another hand test kitchen) in a format that can be parsed by Jenkins (such as junit format).

Global answered 8/5, 2014 at 18:31 Comment(1)
I don't see the connection to test-kitchen, yet. AFAIK you don't need t-k to run chefspec and vice versa.Guff
F
25

You are confusing unit testing and integration testing. ChefSpec is a unit testing framework. It does not perform a real converge and runs everything in memory. Test Kitchen is an integration framework. It uses VMs to actually run Chef on a real machine.

They are different parts of your build. You don't run ChefSpec from Test Kitchen or visa versa.

As far as getting machine-parseable output from the ChefSpec report, that's on my list of things to do. I want something that is more flexible than just JSON though, and I would like users to be able to supply their own templates as well.

Sources:

  • I wrote ChefSpec
  • I'm on Test Kitchen core
Fossette answered 9/5, 2014 at 14:2 Comment(2)
Hey @sethvargo, The rspec_junit_formatter gem allows rpsec to format its output in xunit format using the argument '--format RspecJunitFormatter'. I am not sure if this will work with the chefspec code coverage feature. I have not tried that feature yet. Soon, soon. :)Semester
Thanks a lot both for responses. Yes, I tried that feature --format RspecJunitFormatter and works ok with rspec unittest. But I haven't figured out yet how to get a Jenkins friendly parse for Coverage. Did you have success with Coverage? Thanks.Global
G
0

While it seems that there was such a functionality to at least output it as JSON, it looks like this feature was removed. See discussion here:

So, how can I get a coverage file report to raise to Jenkins for example?

You can parse the output as a table. I'm working on a way for users to supply "custom" formatters, but haven't come up with a good solution yet.

Guff answered 8/5, 2014 at 23:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.