Skip to content

Commit

Permalink
Add in sample validations for HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
pflooky committed Jan 22, 2025
1 parent 1dc9cf5 commit e8aa318
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class HttpJavaPlanRun extends PlanRun {
{
var httpTask = http("my_http", Map.of(Constants.ROWS_PER_SECOND(), "1"))
var httpTask = http("my_http", Map.of(Constants.ROWS_PER_SECOND(), "1", Constants.VALIDATION_IDENTIFIER(), "POST/pets"))
.fields(
field().httpHeader("Content-Type").staticValue("application/json"),
field().httpHeader("Content-Length"),
Expand All @@ -33,6 +33,13 @@ public class HttpJavaPlanRun extends PlanRun {
)
)
)
.validations(
validation().field("request.method").isEqual("POST"),
validation().field("response.statusCode").isEqual(200),
validation().field("response.timeTaken").lessThan(100),
validation().field("response.headers.Content-Length").greaterThan(0),
validation().field("response.headers.Content-Type").isEqual("application/json")
)
.count(count().records(2));

var conf = configuration()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class HttpPlanRun extends PlanRun {
validation.field("request.method").isEqual("POST"),
validation.field("request.method").isEqualField("response.statusText"),
validation.field("response.statusCode").isEqual(200),
validation.field("response.timeTaken").lessThan(100),
validation.field("response.headers.Content-Length").greaterThan(0),
validation.field("response.headers.Content-Type").isEqual("application/json"),
)
Expand Down

0 comments on commit e8aa318

Please sign in to comment.