RichardWarburton / lambda-behave

A modern testing and behavioural specification framework for Java 8
http://richardwarburton.github.io/lambda-behave/
MIT License
254 stars 52 forks source link

No output for ran tests with junit + maven #82

Open lefou opened 9 years ago

lefou commented 9 years ago

After trying the little example ("a pair of numbers") from the README.md page in a Maven project, I can't see the expected output:

a pair of numbers
  2 / 4 is two
  8 / 4 is two

but instead this:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.example.BehaveTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.391 sec - in org.example.BehaveTest

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

How to enable the expected output from above (at least one line for each ran test)?

lefou commented 9 years ago

This ticket resp. the answer to this question isn't that important to me anymore. (I started a very simple project (Poor Mans Lambda Test, here on GitHub) based on TestNG, which does exactly what I wanted (tests as lambdas, nice colored output, ...) for Java.)

But, can it be you just overlooked this issue or is it the question? Is the expectation to see some nice output per test (e.g. the test name, as said on the Readme) wrong?

Best regards

RichardWarburton commented 9 years ago

Hi Tobias,

My apologies for not getting back to you earlier - slipped through my radar.

The amount/type of output that you get depends on what runner you're using. If you're running in an IDE you'll see a nice report and if you're running the tests through the scala-test runner you'll get a nice printed output on the commandline.

Unfortunately if you're using junit + maven as your runner harness you get what junit + maven offers - which is very little in the way of output. I'm going to leave this issue open but rename it to be a bit more precise. I will look into this issue - but its on the backlog as of now. Pull requests welcome.

lefou commented 9 years ago

Thanks for your reply. As I told you above, I decided to not use LambdaBehave (for now) but created my own project, a really simple Layer on top of TestNG which actually prints these nice messages in all existing runners (Ant, Maven, standalone). As I use simple STDOUT printing (as I said, very simple) while the tests gets executed, I guess it should not be that hard to add such an output to LambdaBehave too. Feel free to borrow what you need: https://github.com/lefou/poor-mans-lambda-test/blob/master/src/main/java/de/tobiasroeser/lambdatest/testng/FreeSpec.java

I'd argue, that requiring a Maven user to configure a scalatest runner is already too inconvenient. Also, AFAIK you would still have to write an XML test suite or something like that, to get your tests executed with scalatest, don't you?

At least for me as a long time Scala and ScalaTest user, I was searching for something comparable to ScalaTest but for a pure Java8 project (to avoid all the extra non-default configuration in Maven).

Edit: I just fixed the mistaken name "JBehave" with "LambdaBehave"

RichardWarburton commented 9 years ago

Thanks for your reply, but just to clarify: