question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature request] Support for `#notpresent` keyword

See original GitHub issue

Use case: I’m writing tests for Spring Boot Repository. It supports “projections” so user can request different detalization, e.g.

  • “default” projection: Fields A,B,C
  • “more-data” projection: Fields A,B,C and array D (it is loaded from separate table)
  • “complete-data” projection: Fields A,B,C and arrays D,E,F,G (each is loaded from separate table)

I cannot check contains/!contains with single JSON so right now my tests look like

Scenario "default"
 <request>
 then match response contains 
  """
  {
    A : '#string', 
    B : '#string' , 
    C : '#string'
  }
  """
  and match response !contains 
  """
  {
    D : '#array', 
    E : '#array', 
    F : '#array', 
    G : '#array' 
  }
  """

Scenario "more-data"
 <request>
 then match response contains 
  """
  {
    A : '#string', 
    B : '#string' , 
    C : '#string',
    D : '#array' 
  }
  """
  and match response !contains 
  """
  {
    E : '#array', 
    F : '#array', 
    G : '#array' 
  }
  """

Scenario "complete-data"
 <request>
 then match response contains 
  """
  {
    A : '#string', 
    B : '#string' , 
    C : '#string',
    D : '#array', 
    E : '#array', 
    F : '#array', 
    G : '#array' 
  }
  """

With new keyword added my scenarios will be cleaner and easier to read

Scenario "default"
 <request>
 then match response contains 
  """
  {
    A : '#string', 
    B : '#string' , 
    C : '#string'
    D : '#undefined', 
    E : '#undefined', 
    F : '#undefined, 
    G : '#undefined' 
  }
  """

Scenario "more-data"
 <request>
 then match response contains 
  """
  {
    A : '#string', 
    B : '#string' , 
    C : '#string',
    D : '#array', 
    E : '#undefined', 
    F : '#undefined, 
    G : '#undefined' 
  }
  """

Scenario "complete-data"
 <request>
 then match response contains 
  """
  {
    A : '#string', 
    B : '#string' , 
    C : '#string',
    D : '#array', 
    E : '#array', 
    F : '#array', 
    G : '#array' 
  }
  """

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
avpavlovcommented, Dec 22, 2017

I agree, Karate tests output/protocol not how this output could be interpreted by consumer

0reactions
ptrthomascommented, Oct 12, 2022

@Shaileshz204 use stack overflow for questions like this please: https://stackoverflow.com/a/71522605/143475

Read more comments on GitHub >

github_iconTop Results From Across the Web

[feature request] Support for #notpresent keyword #270 - GitHub
Use case: I'm writing tests for Spring Boot Repository. It supports "projections" so user can request different detalization, e.g. "default" ...
Read more >
How to say no to product feature requests - Canny Blog
Figuring out how to say “no” to a customer is never easy. It's especially hard to say no to product feature requests. Many...
Read more >
Karate | Test Automation Made Simple.
Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automation into a single, unified framework.
Read more >
`.gitlab-ci.yml` keyword reference - GitLab Docs
A public URL accessible by an HTTP/HTTPS GET request: Authentication with the remote URL is not supported. The YAML file must have the...
Read more >
Feature suggestions & requests - Skylum Community
Help us understand what you need most - share your detailed use cases and upvote other users' suggestions to inform the Skylum Product...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found