Building automated tests with the Screenplay Pattern of Serenity, Cucumber, Junit, Java and Gradle to test a REST and a SOAP
The following exposed services are used for this automation:
- User creation
- Send a number for the service and have it return the number in English
- Java JDK 1.8
- Gradle 3.2.0 or higher
- GIT
.
├── src
│ ├── main # Source files
│ │ └── com.serenity.restassured
│ │ ├── exceptions # Custom exceptions
│ │ ├── models # Package where the models are located - Object
│ │ │ └── builder # Builder pattern classes
│ │ │
│ │ ├── questions # Package where classes are stored to obtain data from the service, response from the service, etc.
│ │ │ ├── rest # Specific classes for REST
│ │ │ └── soap # Specific classes for SOAP
│ │ │
│ │ ├── tasks # Package where the tasks that perform the consumption of the service are stored, etc.
│ │ │ ├── rest # Specific classes for REST
│ │ │ └── soap # Specific classes for SOAP
│ │ │
│ │ └── utils # Utilities developed
│ │
│ ├── test # Files for the execution of the tests
│ │ ├── com.serenity.restassured
│ │ │ ├── runners # Test execution classes
│ │ │ │ ├── rest # Execution classes for REST services
│ │ │ │ └── soap # Execution classes for SOAP services
│ │ │ │
│ │ │ └── stepdefinitions # Classes with the Java method with an expression that links it to one or more Gherkin steps
│ │ │ ├── rest # StepDefinitions classes for REST services
│ │ │ └── soap # StepDefinitions classes for SOAP services
│ │ │
│ │ └── resources
│ │ ├── features # Package where the scenarios are stored in Gherkin language
│ │ │ ├── rest # Gherkin language scenarios for REST services
│ │ │ └── soap # Gherkin language scenarios for SOAP services
│ │ │
│ │ └── request # Package where xml or json file is stored with the service request
│ │ └── soap # Package where xml file is stored with the request of the SOAP service
│ └── ···
│
└── ···
Once the project has been downloaded, import it into the IDE of preference.
It is important to compile the project for this, execute one of the following commands. Run by console
gradle clean build -x test
gradle compileJava
Execution All tests
To run all the project tests and generate the report you can use.
gradle clean test aggregate
NOTE: The report generated from the tests is generated in the route /target/site/serenity/index.html
Contributions are what make the open source community such an amazing place to learn, inspire, and create. ** Any contribution you make will be greatly appreciated. **
- Fork the project
- Create your feature branch (
git checkout -b feature / AmazingFeature
) - Commit your changes (
git commit -m 'Adding something to AmazingFeature branch'
) - upload the branch (
git push origin feature / AmazingFeature
) - Open a Pull Request
Distributed under the Apache-2.0 license. See LICENSE
for more information.