{
  "testcases": [ {
    "name": "Update Article",
    "teststeps": [ {
      "name": "Set up database data",
      "type": "DB",
      "endpoint": {
        "type": "DB",
        "url": "jdbc:h2:${atb.data.dir}/database/sample;AUTO_SERVER=TRUE",
        "username": "user"
      },
      "apiRequest": {
        "@type": "DbRequest",
        "sqlScript": "-- Clear the table\ndelete from article;\n\n-- Create two article records\ninsert into article (id, title, content) values (1, 'article1', 'content1');\ninsert into article (id, title, content) values (2, 'article2', 'content2');"
      }
    }, {
      "name": "Invoke the API to update article",
      "type": "HTTP",
      "endpoint": {
        "type": "HTTP",
        "url": "http://localhost:8090/api/articles/2"
      },
      "apiRequest": {
        "@type": "HttpRequest",
        "method": "PUT",
        "headers": [ {
          "name": "Content-Type",
          "value": "application/json"
        } ],
        "body": "{\n  \"id\": 2,\n  \"title\": \"article2\",\n  \"content\": \"Once upon a time ...\"\n}"
      },
      "assertions": [ {
        "name": "StatusCodeEqual",
        "type": "StatusCodeEqual",
        "otherProperties": {
          "statusCode": "200"
        }
      } ]
    }, {
      "name": "Check database data",
      "type": "DB",
      "endpoint": {
        "type": "DB",
        "url": "jdbc:h2:${atb.data.dir}/database/sample;AUTO_SERVER=TRUE",
        "username": "user"
      },
      "apiRequest": {
        "@type": "DbRequest",
        "sqlScript": "select id, title, content from article;"
      },
      "assertions": [ {
        "name": "JsonEqual",
        "type": "JsonEqual",
        "otherProperties": {
          "expectedJSON": "[\n    {\n        \"ID\": 1,\n        \"TITLE\": \"article1\",\n        \"CONTENT\": \"content1\"\n    },\n    {\n        \"ID\": 2,\n        \"TITLE\": \"article2\",\n        \"CONTENT\": \"Once upon a time ...\"\n    }\n]"
        }
      } ]
    } ]
  } ]
}