简体   繁体   English

如何从 spring rest 文档中排除一些测试?

[英]How to exclude some tests from spring rest docs?

I'm working on integrating spring-rest-doc inside my project in order to generate API documentation based on my test.我正在将 spring-rest-doc 集成到我的项目中,以便根据我的测试生成 API 文档。 Although sometimes I tend to test something that is not worthed documenting for instance I test a wrong rest call and I want it to give me the correct error code.虽然有时我倾向于测试一些不值得记录的东西,例如我测试了一个错误的 rest 调用,我希望它给我正确的错误代码。 Spring rest doc generates documentation for this test too. Spring rest doc 也为此测试生成文档。

Is there a way to say spring-rest-doc "skip this one"?有没有办法说 spring-rest-doc “跳过这个”? It seems I can't find it on the documentation.我似乎在文档中找不到它。 I'd like to avoid to split my test in two separate classes, one with basic cruds (documented) and one with more complex testing logic.我想避免将我的测试分成两个单独的类,一个具有基本的 cruds(已记录),另一个具有更复杂的测试逻辑。

REST Docs won't document anything if it isn't integrated with MockMvc, REST Assured, or WebTestClient.如果 REST Docs 未与 MockMvc、REST Assured 或 WebTestClient 集成,则不会记录任何内容。 If you have two separate instances of whichever of those testing clients you're using – one with REST Docs integrated and one without – you'll be able to control which tests generate documentation and which do not.如果您有两个单独的实例,无论您使用的是哪种测试客户端——一个集成了 REST Docs,一个没有集成——您将能够控制哪些测试生成文档,哪些不生成文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM