karatelabs / karate

Test Automation Made Simple
https://karatelabs.github.io/karate
MIT License
8.25k stars 1.94k forks source link

Karate Framework Ignores the tests #241

Closed arunaousula9421 closed 7 years ago

arunaousula9421 commented 7 years ago

Hi @ptrthomas, I am new to Karate Framework. I have been trying to run a sample scenario on my environment but it is ignoring the tests. Can you please correct If I am doing something wrong here.

Feature file:

Feature: account end-point

  Scenario: Authenticate User account
    Given url 'url'
    And headers {Authorization: 'Basic ZGFmdDowYzU0MTRkMDA4YWZiMWIwMjI3ZDQ0MTUyZWJhOGY0ZjRhMTY0NWU5MmFiMDc3M2NjYmQ1OWEyYzc0MjBkMzdh', X-Daft-API-Key: '0059f8fe424c7b573ce02b620f3151f2b2b8bfcb', Accept: 'application/json; versions=1'}
    And form field username: 'arunaousula'
    And form field password: 'dist1234'
    When method post
    Then status 200

Runner Class

package examples.sample;

/**
 * Created by arun on 08/11/2017.
 */
import com.intuit.karate.junit4.Karate;
import org.junit.runner.RunWith;

@RunWith(Karate.class)
public class SamplesRunner {

}

Karate-config.js

function() {
  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,
    myVarName: 'someValue'
  }
  if (env == 'dev') {
    // customize
    // e.g. config.foo = 'bar';
  } else if (env == 'e2e') {
    // customize
  }
  return config;
}

Here are the logs

12:49:01.347 [main] INFO  com.intuit.karate - karate.env system property was: null 
Test ignored.
Test ignored.
Test ignored.
Test ignored.
Test ignored.
Test ignored.
Test ignored.
Test ignored.
Test ignored.
Test ignored.1 Scenarios (1 undefined)
6 Steps (3 skipped, 1 undefined, 2 passed)
0m0.760s
html report:
file:/Users/arun/Karate/KarateFramework/target/surefire-reports/TEST-examples.sample.sample.html
Process finished with exit code 0

I have tried different examples given in your demo project but nothing helped.

ptrthomas commented 7 years ago

there are so many things wrong. I suggest you use the quickstart command (refer to the doc) and create a project that way, then try to modify things.

Just in your feature, 'url' definitely looks wrong. Also it should be like this:

    And form field username = 'arunaousula'
    And form field password = 'dist1234'
ptrthomas commented 7 years ago

and for these kind of basic questions, please use Stack Overflow, thanks: https://stackoverflow.com/questions/tagged/karate