-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
3,827 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: API Automation Capstone | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Build with Maven | ||
run: mvn --batch-mode --update-snapshots package | ||
test: | ||
name: Test API Capstone | ||
needs: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name : Test Restfull API | ||
run : mvn clean verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.example</groupId> | ||
<artifactId>API_ReproductionHealth_Dokter</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<serenity.version>2.6.0</serenity.version> | ||
<serenity.cucumber.version>2.6.0</serenity.cucumber.version> | ||
<rest.assured.version>4.4.0</rest.assured.version> | ||
<junit.version>4.13.2</junit.version> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version> | ||
<maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version> | ||
<maven.failsafe.plugin.version>3.0.0-M5</maven.failsafe.plugin.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Serenity --> | ||
<dependency> | ||
<groupId>net.serenity-bdd</groupId> | ||
<artifactId>serenity-core</artifactId> | ||
<version>${serenity.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>net.serenity-bdd</groupId> | ||
<artifactId>serenity-cucumber6</artifactId> | ||
<version>${serenity.cucumber.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>net.serenity-bdd</groupId> | ||
<artifactId>serenity-screenplay-rest</artifactId> | ||
<version>${serenity.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple --> | ||
<dependency> | ||
<groupId>com.googlecode.json-simple</groupId> | ||
<artifactId>json-simple</artifactId> | ||
<version>1.1.1</version> | ||
</dependency> | ||
|
||
|
||
<dependency> | ||
<groupId>net.serenity-bdd</groupId> | ||
<artifactId>serenity-rest-assured</artifactId> | ||
<version>${serenity.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<version>${rest.assured.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${maven.surefire.plugin.version}</version> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${maven.failsafe.plugin.version}</version> | ||
<configuration> | ||
<includes> | ||
<include>**/*.java</include> | ||
</includes> | ||
<parallel>methods</parallel> | ||
<useUnlimitedThreads>true</useUnlimitedThreads> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven.compiler.plugin.version}</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>net.serenity-bdd.maven.plugins</groupId> | ||
<artifactId>serenity-maven-plugin</artifactId> | ||
<version>${serenity.version}</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>net.serenity-bdd</groupId> | ||
<artifactId>serenity-single-page-report</artifactId> | ||
<version>${serenity.version}</version> | ||
</dependency> | ||
</dependencies> | ||
<executions> | ||
<execution> | ||
<id>serenity-reports</id> | ||
<phase>post-integration-test</phase> | ||
<goals> | ||
<goal>aggregate</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.example; | ||
|
||
// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`, | ||
// then press Enter. You can now see whitespace characters in your code. | ||
public class Main { | ||
public static void main(String[] args) { | ||
// Press Alt+Enter with your caret at the highlighted text to see how | ||
// IntelliJ IDEA suggests fixing it. | ||
System.out.printf("Hello and welcome!"); | ||
|
||
// Press Shift+F10 or click the green arrow button in the gutter to run the code. | ||
for (int i = 1; i <= 5; i++) { | ||
|
||
// Press Shift+F9 to start debugging your code. We have set one breakpoint | ||
// for you, but you can always add more by pressing Ctrl+F8. | ||
System.out.println("i = " + i); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package starter; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import net.serenitybdd.cucumber.CucumberWithSerenity; | ||
|
||
@RunWith(CucumberWithSerenity.class) | ||
@io.cucumber.junit.CucumberOptions(plugin = { "pretty" }, features = "src/test/resources/features") | ||
/** | ||
* Unit test for simple App. | ||
*/ | ||
public class CucumberTestSuite { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package starter.java; | ||
|
||
import net.serenitybdd.rest.SerenityRest; | ||
import net.thucydides.core.annotations.Step; | ||
import org.json.simple.JSONObject; | ||
import static net.serenitybdd.rest.SerenityRest.restAssuredThat; | ||
|
||
public class AIPage { | ||
protected String url = "https://dev.reprohealth.my.id/"; | ||
|
||
@Step("I set POST api endpoints Doctor Chatbot") | ||
public String setPOSTApiEndpointDoctorChatbot() { | ||
return url + "doctors/chatbot/health-recommendation"; | ||
} | ||
|
||
@Step("I send POST HTTP request Doctor Chatbot") | ||
public void sendPOSTHttpRequestDoctorChatbot() { | ||
JSONObject requestBody = new JSONObject(); | ||
requestBody.put("message", "Terimakasih atas nasihat anda dalam menjelaskan tentang kanker payudara"); | ||
requestBody.put("session_id", "f7613c10-29fd-4b82-bfea-1649ae41af98"); | ||
|
||
|
||
SerenityRest.given().header("Authorization", "Bearer " + Token_AuthenticationPage.authToken).post(setPOSTApiEndpointDoctorChatbot()).then().statusCode(200); | ||
} | ||
|
||
@Step("I receive valid HTTP response code 200 Chatbot") | ||
public void receiveValidHttp200DoctorChatbot() { | ||
restAssuredThat(response -> response.statusCode(200)); | ||
} | ||
|
||
//Positive GET Chatbot History From Doctor ID | ||
@Step("I set GET api endpoints Chatbot History From Doctor ID") | ||
public String setGetApiEndpointChatbotHistory() { | ||
return url + "doctors/chatbot/health-recommendation/f7613c10-29fd-4b82-bfea-1649ae41af98"; | ||
} | ||
|
||
@Step("I send GET HTTP request Chatbot History From Doctor ID") | ||
public void sendGetHttpRequestChatbotHistory() { | ||
|
||
SerenityRest.given().header("Authorization", "Bearer " + Token_AuthenticationPage.authToken).get(setGetApiEndpointChatbotHistory()).then().statusCode(200); | ||
} | ||
|
||
|
||
//Negative GET Chatbot History From Doctor ID invalid endpoint | ||
@Step("I set GET api endpoints Chatbot History From Doctor ID Neg1") | ||
public String setGetApiEndpointChatbotHistoryNeg1() { | ||
return url + "doctors/chatbot/health-recomendation/f7613c10-29fd-4b82-bfea-1649ae41af98"; | ||
} | ||
|
||
@Step("I send GET HTTP request Chatbot History From Doctor ID Neg1") | ||
public void sendGetHttpRequestChatbotHistoryNeg1() { | ||
|
||
SerenityRest.given().header("Authorization", "Bearer " + Token_AuthenticationPage.authToken).get(setGetApiEndpointChatbotHistoryNeg1()).then().statusCode(400); | ||
} | ||
|
||
@Step("I receive valid HTTP response code 400 ChatbotNeg1") | ||
public void receiveValidHttp400ChatbotHistoryNeg1() { | ||
restAssuredThat(response -> response.statusCode(400)); | ||
} | ||
|
||
|
||
|
||
//Positive GET Chatbot History From Session ID | ||
@Step("I set GET api endpoints Chatbot History From Session ID") | ||
public String setGetApiEndpointChatbotHistorySession() { | ||
return url + "doctors/chatbot/health-recommendation/session/88197ab8-5462-4821-8424-f4d7aa2223a3"; | ||
} | ||
|
||
@Step("I send GET HTTP request Chatbot History From Session ID") | ||
public void sendGetHttpRequestChatbotHistorySession() { | ||
|
||
SerenityRest.given().header("Authorization", "Bearer " + Token_AuthenticationPage.authToken).get(setGetApiEndpointChatbotHistorySession()).then().statusCode(200); | ||
} | ||
|
||
|
||
//Negative GET Chatbot History From Session ID invalid endpoint | ||
@Step("I set GET api endpoints Chatbot History From Session ID Neg1") | ||
public String setGetApiEndpointChatbotHistorySessionNeg1() { | ||
return url + "doctors/chatbot/health-recommendation/sesion/88197ab8-5462-4821-8424-f4d7aa2223a3"; | ||
} | ||
|
||
@Step("I send GET HTTP request Chatbot History From Session ID Neg1") | ||
public void sendGetHttpRequestChatbotHistorySessionNeg1() { | ||
|
||
SerenityRest.given().header("Authorization", "Bearer " + Token_AuthenticationPage.authToken).get(setGetApiEndpointChatbotHistorySessionNeg1()).then().statusCode(400); | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.