question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document how to separate REST documenting tests from 'real' Junit tests

See original GitHub issue

When following the http://docs.spring.io/spring-restdocs/docs/1.0.0.M1/reference/html5/#getting-started-build-configuration-gradle setup the documenting tests are in the same ‘scope’ as the normal junit tests.

I think this is a bad practice. When you have a fairly big project with a lot of ‘real’ junit tests it means when generating the docs all junit tests will be run as well. This is time consuming if you just want to work on documentation.

Further more the unit tests for the documentation are also included in the project’s test report, which is also not desired.

I haven’t looked into it but with Gradle I think I can setup different SourceSets to separate them. I think it would be good to add something like this to the docs or maybe even making it easier for users by providing a specific restdocs plugin which setups these SrouceSets automatically.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
leonard84commented, Oct 13, 2017

A separate sourceset is overkill IMHO, just use JUnit categories, or simple naming conventions with include-exclude rules. Just as maven surefire/failsafe use *Test/*IT. You could use *AT for ApiTest

0reactions
wilkinsonacommented, Oct 13, 2017

You make a good point, @leonard84. Thank you. Given that this is largely down to personal preference, and that exactly how you split things up depends on that preference, the build system you’re using, and the test framework that you’re using, I now think it is out of the scope of REST Docs’ own documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

REST-API documentation generation from unittests
I want to automatically document my REST-API. I know, there are many tools for that, but I want to generate the documentation from...
Read more >
JUnit 5 tutorial - Learn how to write unit tests - Vogella.com
We give it the name of the function(s) we want it to call to get it's test data. The function has to be...
Read more >
JUnit 5 User Guide
Overview. The goal of this document is to provide comprehensive reference documentation for programmers writing tests, extension authors, and ...
Read more >
Java Unit Testing with JUnit and TestNG
Copy all your classes into one folder (for simplicity). Set the CLASSPATH to include the JUnit jar-files: // Unix/Linux/Ubuntu/Mac (for this bash session...
Read more >
Testing Your Application - Quarkus
package org.acme.getting.started.testing; import io.quarkus.test.junit. ... This test uses HTTP to directly test our REST endpoint. When the test is run the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found