Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test using maven #86

Closed
tcho16 opened this issue Jan 23, 2017 · 3 comments
Closed

How to test using maven #86

tcho16 opened this issue Jan 23, 2017 · 3 comments

Comments

@tcho16
Copy link

tcho16 commented Jan 23, 2017

Hi I've currently written tests using the lua busted framework but turns out there isn't any maven plugins for busted. I came across luaunit and you claim that I can use luaunit in maven. I tried looking for the luaunit maven plugin but couldn't find any. Could you tell me how I could incorporate this luaunit test on maven. Thank you.

@n1tehawk
Copy link
Contributor

Hi tcho16!

DISCLAIMER: I have no personal experience with configuring/running Maven at all.

First of all, it's important to realize that neither LuaUnit nor busted offer direct out-of-the-box support for Maven (i.e. provide a suitable plugin).

Instead, they both allow output of test results as XML in a JUnit-compatible format ("xUnit"). For LuaUnit you would use options like --output junit --name myresults.xml, and a quick check shows that busted has a similar outputHandler.

If I understand it correctly, Maven integration thus consists of two steps:

  1. Execute the (Lua) script that does the actual testing using LuaUnit (or busted), and creates corresponding JUnit output.
  2. Make the test results available/meaningful to Maven by parsing the XML resulting from step 1.

Questions related to step 1. have been asked several times on StackOverflow - here's an answer that I found useful. If you are content with a simple BUILD SUCCESSFUL vs. BUILD FAILED result, this might already be all that is required.

Step 2. seems to be the more interesting one. While searching for a solution, I came across https://github.com/qqilihq/maven-test-parser-plugin which seems very helpful.

Regards, NiteHawk

@tcho16
Copy link
Author

tcho16 commented Jan 28, 2017

@n1tehawk Thanks for the input. Showed me some light in finding my answer but got there in the end :)

Ended up using the TAP output from busted alongside the tap4j maven plugin and incorporated them into my JUnit test cases.

@n1tehawk
Copy link
Contributor

You're welcome! It was an interesting question, and this information might help others in the future. The tap4j route could also be useful in conjunction with LuaUnit, as it supports TAP output too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants