This is the 11th day of my participation in the More text Challenge. For more details, see more text Challenge
Ydoc1.0.5 supports Swagger pages and mail and Web reports
In 1.0.3, swagger pages can only be displayed when Swagger-native is enabled. In 1.0.5, we can use yDoc-style annotations to generate the contents of swagger documents.
How is it generated?
Source code has been open source to Github welcome to contribute source code, like a Star support
Download the source code from Github and install it in your local repository. There is a delay when uploading to the central repository.
<dependency> <groupId>com.github.nobugboy</groupId> <artifactId>ydoc-spring-boot-starter</artifactId> The < version > 1.0.6 < / version > < / dependency >Copy the code
We’re all familiar with swagger. For example, if we want to generate documentation information for an interface, just define it as follows
@restController @api (tags = "user related ") public class TestController {@apiOperation (" user related ") @postMapping (value = "/get") public User test1(@RequestBody User user){ System.out.println(user); return user; }}Copy the code
Since my project does not have the configuration scan package to enable native mode to generate Swagger, so let’s take a look at how YDoc supports generating Swagger page, just a simple transformation, is it much simpler than the native swagger annotation way
@restController (value = "User related ") public class TestController {@postMapping (value = "/get",name =" User related ") public User test1(@RequestBody User user){ System.out.println(user); return user; }}Copy the code
Then we modify the configuration class and configuration file
# Add ydoc.enable=true to config fileCopy the code
Then let us start the program, check whether the document is generated, I this is port 8080, so visit http://localhost:8080/doc.html, the document is born, requires no additional package and a lot of notes, can also be generated as documentation and swagger
Automated test mail and Web pages (you can’t use automated tests without YApi)
Let’s go to YApi and create a test collection called devTest and import some interfaces
There are more configurations associated with automated tests
Ydoc. [email protected] #YAPI login m password Ydoc. yapi-user-password=admin # yapi automated test set name, Ydoc. test-name=devtest # to enable automatic test ydoc.auto-test=true #yapi-user-email pop3SMTP password ydoc.email-password= XXXXXX There are multiple [email protected],[email protected]. The email domain name is ydoc.email-host=smtp.163.comCopy the code
After the configuration is complete, we launch the program directly and can see that the console has printed the information
12:00:43 2021-06-25. 90109-952 the INFO [task - 1]. Com. Making ydoc. Config. YapiApi: ydoc test automation/devtest as follows: 12:00:43 2021-06-25. 90109-952 the INFO [task - 1]. Com. Making ydoc. Config. YapiApi: API: [user information] path: / / get the 2021-06-25 12:00:43. 90109-952 the INFO] [task - 1 com. Making. Ydoc. Config. YapiApi: a total of 1 test case, all validation through the elapsed time: 0.03 sCopy the code
Look at the mailbox, there is no HTML inline style support in the mail, so all you see is not very nice
At the same time we support way using the web to see, visit http://localhost:8080/test-page, this page is better