This framework tests weather conditions using Rest APIs.
* RestAssured test framework
* BDD cucumber
* Maven build
* TestNG integration
* Cucumber Json reports
* log4j
git clone https://github.com/sangeeta-chakalabbi/WeatherAPIAutomation.git
* JAVA 1.8 - Install Java and set the JAVA_HOME path on your machine.
* Rest Assured library
* Logging
* Maven
* Cucumber
* lombok
* TestNG
1. The test Scenarios are captured using BDD way under feature files
2. And then there are classes that implement or define each of the steps in feature files
3. In order to store JSON response and validate data, the test uses POJO classes,
that provide built in getters and setters needed by assertions of various fields of the Response.
4. The actual APIs themselves are invoked using RESTAssured library calls such as given(), when(), then() etc
-
From ide you can invoke the TestRunner file which has links to feature file and the corresponding step definition. 'TestRunner'
-
Or on indivisual scenarios you could right click and run
-
mvn command line
mvn clean verify -PRegression
mvn clean verify -PSmoke
mvn clean verify -PWeatherbitio
Reporting Path
./target/report/cucumber-html-reports/
Logging Path
./src/test/java/logs/ApplicationLog
1- Is provided under feature file
Scenario: Get weather data for multiple cities based on city ids
Given As a frequent flyer, I want to get current weather data for following cities in the world
| 4487042 |
| 4494942 |
| 4504871 |
Then I can verify the weather data for different cities
2- Sometimes it is provided as external csv file.
**src/test/resources/testData/australiaCapitalCities.csv**
**src/test/resources/testData/states.csv**
- Since we are covering just the happy paths at the moment.
- The assumption is that API does not fail and comes back with data everytime
1. As a frequent flyer, I want to get current weather data for following cities in the world
2. As a frequent flyer, I want to get current weather data for the city at -33.865143, 151.209900
1. API may fail to return data
1. To come up with Step definitions and Helpers which can be re-used
2. Efficient way of storing input data and test data during execution
https://github.com/sangeeta-chakalabbi/WeatherAPIAutomation
1. To run tests in Parallel by using cucumber testNG options. And using TestNG xml file in pom build
Sample code snippet which could be placed in TestRunner
import cucumber.api.testng.AbstractTestNGCucumberTests;
public class TestRunner extends AbstractTestNGCucumberTests {
@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}
}
2. Include negative and edge case scenario
3. Incorporate methods to check most of the JSON response using lesser lines of code.
For instance, use of libraries such as **jsonassert**