## Problem

• how to test GraphQL queries
• how to ensure that our tests are reliable
• how to ensure that our implementation would work after a couple of weeks
• how to simulate user interaction with API

## How it was solved?

• static files tests
• no tests

#### What problems has this solution?

• stability and immutability of tests
• escalation of changes in implementation in tests
• basin on data in database
• relaying on spotting everything in a pr

## How we can solve them?

• tests to all new/added functionalities
• stop basin on concrete data
• good distinction of unit/it/acceptance tests

## What is FsCheck?

• Port of QuickCheck
• Integrated with NUnit, XUnit, Expecto etc.
• Written in F#

• difference from unit tests
• how to test a + b method
• silver bullet?

## Random testing?

• Are FsCheck tests tottaly random?

## Test

• Attribute

### How shrinker works #1

For query which fails because model is not resolved correctly, the first input to the test looks like this:

 1: 2: 3: 4: 5: 6: 7: 8:  car(name: "name of a car") { name model engine { power } } 

### How shrinker works #2

Then shrinker in a couple of iterations generates inputs without some data, we could see it as "in every iteration remove a single property" (in our example)

### How shrinker works #3

So in a first iteration inputs would look like this:

  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:  car(name: "name of a car") { model engine { power } } car(name: "name of a car") { name engine { power } } car(name: "name of a car") { name model } 

### How shrinker works #4

and in second iteration it would generate following inputs:

 1:  car(name: "name of a car") { model } 

### How to spot problem when test fails?

• outputwindow
• Replay value of Property attribute