1. Wonderful
We use Groovy to write Java tests. Why? Because it provides the following functions:
Loose Java syntax: This is Java syntax, but some other rules, such as semicolons, variable types and access modifiers, are optional. The latter is of great significance for testing. Because the access modifier is not strict, your test can read and assert the state inside the class.
2. Support REST style
Our backend provides RESTAPI services to create and manage accounts. Among many SDKs, our JavaSDK provides a language-specific client model for simple interaction. Some of these SDKs also provide web pages that interact with the back end, so you don't have to write code.
In order to ensure the interoperability of network frameworks, they must behave consistently. So we need to create a series of tests based on HTTP. This is our compatibility testing tool. This project is maintained by SDK engineers who are proficient in many languages. Therefore, we need cross-language testing tools. Thank god you're relieved.
REST-assured is a DSL domain-specific language for testing rest services. It is simple and easy to use, and even very powerful for developers who have never used Java. It provides advanced functions such as detailed configuration, filters, customized analysis, cross-site request forgery (CSRF) and OAuth2.0. It provides a very simple syntax: given-when-then
3. Cargo Plug-ins
In order for our JavaSDK to check according to TCK, we need to open one of our Web services so that we can perform tests on it. It is reasonable to say that we need automatic testing every time we build, and GargoPlugin is born for this.
Cargo just encapsulates various application containers in a standard way. With Cargo for computer training, we can easily run our code in different Servlet containers (such as Jetty and Tomcat). We just need to configure CargoMaven2Plugin in our pom file to start a Servlet container (Tomcat7) and compile the latest War package in the testing phase. You can see the configuration in our Servlet plug-in example.