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
package myTestRunners; | |
import io.cucumber.junit.Cucumber; | |
import io.cucumber.testng.CucumberOptions; | |
import org.junit.AfterClass; | |
import org.junit.BeforeClass; | |
import org.junit.runner.RunWith; | |
@RunWith(Cucumber.class) |
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
package myTestRunners; | |
import io.cucumber.testng.AbstractTestNGCucumberTests; | |
import io.cucumber.testng.CucumberOptions; | |
import org.testng.annotations.AfterTest; | |
import org.testng.annotations.BeforeTest; | |
@CucumberOptions( | |
features = "src/test/resources/functionalTests", |
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
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"> | |
<suite thread-count="2" name="Example Project" parallel="tests"> | |
<test name="TestRunner1"> | |
<classes> | |
<class name="myTestRunners.TestRunner" /> | |
</classes> | |
</test> | |
<test name="TestRunner2"> | |
<classes> |
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
package myTestRunners; | |
import io.cucumber.testng.*; | |
import org.testng.IRetryAnalyzer; | |
import org.testng.ITestResult; | |
import org.testng.annotations.*; | |
@CucumberOptions( | |
features = "src/test/resources/functionalTests", | |
glue= {"myStepDefinitions" , "myHooks"}, | |
tags = "@chrome", |
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
<?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>Grocery-Karate-API-Automation</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<packaging>jar</packaging> |
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
function fn() { | |
var env = karate.env; // get system property 'karate.env' | |
karate.log('karate.env system property was:', env); | |
if (!env) { | |
env = 'dev'; | |
} | |
var config = { | |
env: env, | |
baseUrl: 'https://petstore.swagger.io' | |
} |
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
Feature: Grocery API | |
Background: The Request Body Configuration | |
# Set a configuration for the payload | |
* url baseUrl | |
Scenario: Get All Products from Grocery | |
Given header Content-Type = 'application/json' | |
And path '/allGrocery' | |
When method get |
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
{ | |
"id": 0, | |
"category": { | |
"id": 0, | |
"name": "string" | |
}, | |
"name": "hola", | |
"photoUrls": [ | |
"string" | |
], |
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
Feature: Create A new Pet | |
Background: The Request Body Configuration | |
# Set a configuration for the payload | |
* url baseUrl | |
* def requestPayload = read('classpath:payload/pet.json') #read the json file | |
* set requestPayload.id = Java.type('utils.TestDataCreator').getID() #get value from java class | |
* set requestPayload.category.id = Java.type('utils.TestDataCreator').getID() #get value from java class | |
* set requestPayload.category.name = Java.type('utils.TestDataCreator').getDogCategoryName() #get value from java class | |
* set requestPayload.name = Java.type('utils.TestDataCreator').getDogName() #get value from java class |
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
Feature: Petstore | |
Background: The Request Body Configuration | |
# Set a configuration for the payload | |
* url baseUrl | |
* def requestPayload = read('classpath:payload/pet.json') | |
* set requestPayload.id = Java.type('utils.TestDataCreator').getID() | |
* set requestPayload.category.id = Java.type('utils.TestDataCreator').getID() | |
* set requestPayload.category.name = Java.type('utils.TestDataCreator').getDogCategoryName() | |
* set requestPayload.name = Java.type('utils.TestDataCreator').getDogName() |
OlderNewer