Skip to content

About

Trident consumed from Maven Central, testing Conduit (RealWorld) - a second target with nothing in common with ParaBank.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trident-showcase

A test suite built with Trident, resolving it from Maven Central, testing an application Trident has never seen.

That last part is the point. Trident is developed against ParaBank, a 2005 JSP banking app with session cookies and no specification. This project tests Conduit, the RealWorld reference API: modern JSON REST, JWT authentication, a published spec. If the framework only worked on the target it was written against, this repository would not build.

Nothing here was hand-written from a template. The project was generated:

mvn archetype:generate \
  -DarchetypeGroupId=dev.ozgurcetintas.trident \
  -DarchetypeArtifactId=trident-archetype \
  -DarchetypeVersion=1.0.0 \
  -DgroupId=dev.ozgurcetintas.showcase -DartifactId=trident-showcase \
  -Dpackage=dev.ozgurcetintas.showcase -Dprefix=Conduit

Six seconds from that command to a passing suite, with no editing. Adding Conduit — the container, the fixtures, the six scenarios — is the rest of this repository.

Run it

mvn -Psmoke verify    # fast, no Docker
mvn -Papi verify      # starts Conduit in a container, ~25 seconds

CI runs both, and asserts that the smoke run never touches a container.

What it covers

Six scenarios, each registering its own user and creating its own articles:

Scenario What it proves
Registering a user returns a token The JWT round-trips and identifies its owner
An article belongs to the user who wrote it Authenticated writes are attributed
A published article appears in the article list Reads see what writes produced
Favouriting an article raises its count State changes are visible and correct
A request without a token is rejected 401, not a silent success
A request with a malformed token is rejected The token is validated, not merely present

What this proved about Trident

Two gaps, both of which Trident fixed rather than this project working around:

trident-api could not send a JSON request body. It shipped REST Assured but no JSON provider, so the first POST failed with "no JSON serializer found in classpath". ParaBank takes form parameters and query parameters and never a JSON body, so nobody had noticed. Fixed in Trident 0.2.2 — see its ADR 0015.

Asserting a rejection looked like it needed an HTTP client of its own. REST Assured appeared to throw on every non-2xx rather than returning it, and both this project and Trident's own demo wrote a JDK client to work around it. It was a misdiagnosis: the throw happens only under a Turkish locale, where REST Assured's internal handler key lowercases to faılure and is never found. Every measurement behind the original conclusion had run on one machine. The workaround was removed before 1.0.0 froze it, and both projects pin the test locale instead — ADR 0016.

What did not need changing is worth naming too. Conduit authenticates with a JWT in an Authorization: Token header; ParaBank uses a session cookie. RequestSpecFactory makes no assumption about an auth scheme, so the difference is one line in this repository and nothing in Trident.

Notes on the target

The Conduit image is pinned by digest. It is a personal build — the RealWorld project publishes no container of its own — so pinning is what makes this reproducible rather than dependent on someone's tag moving. It is linux/amd64 only, which costs nothing in CI and means emulation on an Apple Silicon machine.

It also serves the API at the root rather than under /api as the specification says. The paths here reflect what the application does, not what the spec says it should.

About

Trident consumed from Maven Central, testing Conduit (RealWorld) - a second target with nothing in common with ParaBank.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages