emjay
emjay

Reputation: 33

Unable to Run Karate Tests

I am unable to run the karate tests in my feature

package api;
import com.intuit.karate.junit4.Karate;
import org.junit.runner.RunWith;
@RunWith(Karate.class)
public class PagesRunner {
}

this is the report which gets generated

My Feature file:

Feature: some Adaptor Request Success

Background:
* def myUrl = baseURL
* configure headers = read('classpath:some-headers.js')
Scenario: Some Adaptor Success
* def someInitiate= read('classpath:requests/someRequest.json')
* url myUrl
Given path 'api/somerequest'
And request someInitiate
When method post
Then status 202

Not sure what I am missing here. Very new to api automation world. Any help is much appreciated.

Upvotes: 1

Views: 3981

Answers (3)

flor paucar silva
flor paucar silva

Reputation: 1

This resolved my problem:

    <testResources>
        <testResource>
            <directory>src/test/java</directory>
            <excludes>
                <exclude>**/*java</exclude>
            </excludes>
        </testResource>
    </testResources>
</build>

Upvotes: 0

VFXG
VFXG

Reputation: 11

copy and paste below to your pom.xml file after and reload.

enter image description here

Upvotes: 0

Peter Thomas
Peter Thomas

Reputation: 58088

May I suggest you follow the quick-start example to get started.

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

Then try to run the UsersRunner.java | users.feature without issues. Then you can build on that.

Upvotes: 1

Related Questions