Skip to content

Commit

Permalink
Merge pull request #3 from intuit/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
chaudharydeepak authored Dec 15, 2020
2 parents 598b922 + d562a64 commit 729a8d6
Show file tree
Hide file tree
Showing 788 changed files with 25,824 additions and 23,097 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: maven-build

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ develop ]

jobs:
build:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
- name: set up jdk 8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: cache maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: build with maven
run: mvn -B clean install -P pre-release -Djavacpp.platform=linux-x86_64
- name: build and test with docker
run: ./build-docker.sh
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ karate-demo/activemq-data/
karate-demo/*.pem
karate-demo/*.jks
karate-demo/*.der
karate-netty/*.pem
karate-netty/*.jks
karate-netty/*.der
karate-core/*.pem
karate-core/*.jks
karate-core/*.der
karate-robot/tessdata
karate-junit4/src/test/java/com/intuit/karate/junit4/dev
karate-robot/src/test/java/robot/dev
Expand Down
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <img src="karate-core/src/main/resources/res/karate-logo.svg" height="60" width="60"/> Karate
## Test Automation Made `Simple.`
[![Maven Central](https://img.shields.io/maven-central/v/com.intuit.karate/karate-core.svg)](https://mvnrepository.com/artifact/com.intuit.karate/karate-core) [![Build Status](https://travis-ci.org/intuit/karate.svg?branch=master)](https://travis-ci.org/intuit/karate) [![GitHub release](https://img.shields.io/github/release/intuit/karate.svg)](https://github.com/intuit/karate/releases) [![Support Slack](https://img.shields.io/badge/support-slack-red.svg)](https://github.com/intuit/karate/wiki/Support) [![Twitter Follow](https://img.shields.io/twitter/follow/KarateDSL.svg?style=social&label=Follow)](https://twitter.com/KarateDSL)
[![Maven Central](https://img.shields.io/maven-central/v/com.intuit.karate/karate-core.svg)](https://search.maven.org/artifact/com.intuit.karate/karate-core) [ ![build](https://github.com/intuit/karate/workflows/maven-build/badge.svg)](https://github.com/intuit/karate/actions?query=workflow%3Amaven-build) [![GitHub release](https://img.shields.io/github/release/intuit/karate.svg)](https://github.com/intuit/karate/releases) [![Support Slack](https://img.shields.io/badge/support-slack-red.svg)](https://github.com/intuit/karate/wiki/Support) [![Twitter Follow](https://img.shields.io/twitter/follow/KarateDSL.svg?style=social&label=Follow)](https://twitter.com/KarateDSL)

Karate is the only open-source tool to combine API test-automation, [mocks](karate-netty), [performance-testing](karate-gatling) and even [UI automation](karate-core) into a **single**, *unified* framework. The BDD syntax popularized by Cucumber is language-neutral, and easy for even non-programmers. Powerful JSON & XML assertions are built-in, and you can run tests in parallel for speed.

Expand Down
33 changes: 33 additions & 0 deletions build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -x -e

# assume that karate jars are installed in maven local repo
# mvn clean install -P pre-release -DskipTests

# copy only karate jars to a place where the docker image build can add from
KARATE_REPO=karate-docker/karate-chrome/target/repository/com/intuit
mkdir -p ${KARATE_REPO}
cp -r ~/.m2/repository/com/intuit/karate ${KARATE_REPO}

# create / copy the karate fatjar so that the docker image build can add it
mvn -f karate-core/pom.xml package -P fatjar -DskipTests
KARATE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
cp karate-core/target/karate-${KARATE_VERSION}.jar karate-docker/karate-chrome/target/karate.jar

# build karate-chrome docker image that includes karate fatjar + maven jars for convenience
docker build -t karate-chrome karate-docker/karate-chrome

# just in case a previous run had hung (likely only in local dev)
docker stop karate || true

# note that this command is run as a background process
docker run --name karate --rm --cap-add=SYS_ADMIN -v "$PWD":/karate -v "$HOME"/.m2:/root/.m2 karate-chrome &

# just ensure that the docker container named "karate" exists after the above command
# it does not have to have completed startup, the command / karate test below will wait
sleep 5

# run tests against chrome
docker exec -w /karate karate mvn test -f karate-e2e-tests/pom.xml -Dtest=driver.DockerRunner
docker stop karate
wait
7 changes: 1 addition & 6 deletions examples/gatling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@
<java.version>1.8</java.version>
<maven.compiler.version>3.6.0</maven.compiler.version>
<karate.version>2.0.0</karate.version>
<gatling.plugin.version>3.0.2</gatling.plugin.version>
<gatling.plugin.version>3.1.0</gatling.plugin.version>
</properties>

<dependencies>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>${karate.version}</version>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-gatling</artifactId>
Expand Down
7 changes: 2 additions & 5 deletions examples/gatling/src/test/java/mock/MockUtils.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package mock;

import com.intuit.karate.FileUtils;
import com.intuit.karate.core.MockServer;
import com.intuit.karate.PerfContext;
import com.intuit.karate.Runner;
import com.intuit.karate.netty.FeatureServer;

import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand All @@ -18,8 +16,7 @@
public class MockUtils {

public static void startServer() {
File file = FileUtils.getFileRelativeTo(MockUtils.class, "mock.feature");
FeatureServer server = FeatureServer.start(file, 0, false, null);
MockServer server = MockServer.feature("classpath:mock/mock.feature").build();
System.setProperty("mock.cats.url", "http://localhost:" + server.getPort() + "/cats");
}

Expand Down
14 changes: 4 additions & 10 deletions examples/jobserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.version>3.6.0</maven.compiler.version>
<karate.version>0.9.6</karate.version>
<maven.compiler.version>3.8.1</maven.compiler.version>
<karate.version>2.0.0</karate.version>
</properties>

<dependencies>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
<dependencies>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
Expand All @@ -30,7 +24,7 @@
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>3.8.0</version>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SimpleDockerJobRunner {
@Test
void testJobManager() {
MavenJobConfig config = new MavenJobConfig(2, "host.docker.internal", 0);
Results results = Runner.path("classpath:jobtest/simple").startServerAndWait(config);
Results results = Runner.path("classpath:jobtest/simple").parallel(1); //.startServerAndWait(config);
ReportUtils.generateReport(results.getReportDir());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class SimpleLocalJobRunner {

@Test
void testJobManager() {
MavenJobConfig config = new MavenJobConfig(-1, "127.0.0.1", 0) {
MavenJobConfig config = new MavenJobConfig(2, "127.0.0.1", 0) {
@Override
public void startExecutors(String uniqueId, String serverUrl) throws Exception {
int executorCount = 2;
Expand All @@ -35,7 +35,7 @@ public void startExecutors(String uniqueId, String serverUrl) throws Exception {
};
// export KARATE_TEST="foo"
config.addEnvPropKey("KARATE_TEST");
Results results = Runner.path("classpath:jobtest/simple").startServerAndWait(config);
Results results = Runner.path("classpath:jobtest/simple").jobManager(config);
ReportUtils.generateReport(results.getReportDir());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class SimpleRunner {

@Test
void test() {
Results results = Runner.path("classpath:jobtest/simple").tags("~@ignore").parallel(1);
Results results = Runner.path("classpath:jobtest/simple")
.outputCucumberJson(true).tags("~@ignore").parallel(1);
ReportUtils.generateReport(results.getReportDir());
assertEquals(0, results.getFailCount(), results.getErrorMessages());
}
Expand Down
10 changes: 1 addition & 9 deletions examples/jobserver/src/test/java/jobtest/simple/simple1.feature
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
Feature: simple 1

Background:
* configure responseDelay = 1000
* print 'in background 1'

Scenario: 1-one
* print '1-one'
* def karateTest = java.lang.System.getenv('KARATE_TEST')
* print '*** KARATE_TEST: ', karateTest

Scenario: 1-two
* print '1-two'

Scenario: 1-three
* print '1-three'
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,3 @@ Scenario: 3-one

Scenario: 3-two
* print '3-two'

Scenario: 3-three
* print '3-three'
Given url 'http://httpbin.org/get'
When method get
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WebDockerJobRunner {
void test() {
MavenChromeJobConfig config = new MavenChromeJobConfig(2, "host.docker.internal", 0);
System.setProperty("karate.env", "jobserver");
Results results = Runner.path("classpath:jobtest/web").startServerAndWait(config);
Results results = Runner.path("classpath:jobtest/web").parallel(1);
ReportUtils.generateReport(results.getReportDir());
}

Expand Down
2 changes: 1 addition & 1 deletion examples/jobserver/src/test/java/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<logger name="com.intuit" level="DEBUG"/>

<root level="info">
<root level="WARN">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
Expand Down
60 changes: 0 additions & 60 deletions karate-apache/pom.xml

This file was deleted.

Loading

0 comments on commit 729a8d6

Please sign in to comment.