Anyone used approvaltests with specflow?

366 views Asked by At

Has anyone used Specflow with ApprovalTests?

I find it limiting that you can only approve one file per NUnit test and therefore each scenario can only have one approved file. This is the case even if you use scenario outlines.

This means I usually have to concatenate files and approve one large file which repesents the results of lots of independent tests.

I wonder has anyone found a better way?

1

There are 1 answers

5
Llewellyn Falco On BEST ANSWER

I'm the creator of approvaltests. I haven't used specflow myself yet, but the solution you are looking for would reside in the Namer.

A little background: Approve() uses 3 pieces

  1. a namer - this gets the .. received & approved file
  2. a writer - this outputs to that said file
  3. a reporter - this is called on failure

Right now the namers only use the class & method name to determine the file name which is why they cause a problem when you want more than one file per method.

you need to extend the namer to use more inputs (i'm guessing here but) class, method & scenario.

I'd be happy to pair w/you via skype to create the namer.