ArunBharath
ArunBharath

Reputation: 153

I'm not getting JUnit HTML report in Karate

I have followed the steps in Karate documentation to create a project, I ran the example test cases given in the default archifect , My cases got passed but i'm not getting any report

my pom.xml

<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>com.poc.karate</groupId>
<artifactId>interacKarate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
    <maven.compiler.version>3.6.0</maven.compiler.version>
</properties>    

<dependencies>    
    <dependency>
        <groupId>com.intuit.karate</groupId>
        <artifactId>karate-junit4</artifactId>
        <version>0.2.7</version>
        <scope>test</scope>
    </dependency>       
</dependencies>

<build>
    <testResources>
        <testResource>
            <directory>src/test/java</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </testResource>
    </testResources>
    <plugins>
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.10</version>
            <configuration>
            <argLine>-Dfile.encoding=UTF-8</argLine>
            </configuration>
     </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>${java.version}</source>
                <target>${java.version}</target>
                <compilerArgument>-Werror</compilerArgument>
            </configuration>
        </plugin>
    </plugins>        
</build>       

RunnerClass

package examples.users;

import com.intuit.karate.junit4.Karate;
import org.junit.runner.RunWith;

@RunWith(Karate.class)
public class UsersRunner {

}

my feature file is

Feature: sample karate test script

Background: * url 'https://jsonplaceholder.typicode.com'

Scenario: get all users and then get the first user by id

Given path 'users' When method get Then status 200

Given path 'users', first.id When method get Then status 200

Scenario: create a user and then get it by id

Given url 'https://jsonplaceholder.typicode.com/users' And request user When method post Then status 201

What else I'm missing here?

Upvotes: 1

Views: 1967

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

This is a really old version of Karate and I'm sure you are following outdated instructions. I suggest you follow the quick-start: https://github.com/intuit/karate#quickstart

mvn archetype:generate \
-DarchetypeGroupId=com.intuit.karate \
-DarchetypeArtifactId=karate-archetype \
-DarchetypeVersion=0.8.0 \
-DgroupId=com.mycompany \
-DartifactId=myproject

Upvotes: 2

Related Questions