test: Add Cucumber BDD coverage for the Articles API - #286
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Cucumber layer on top of the existing suite: 51 scenarios across
create-article,article-feedandfavorite-article, driving the real HTTP API (security filters, MyBatis, SQLite) rather than mocks../gradlew testnow runs 119 tests (68 before);./gradlew cucumberTestruns the scenarios alone.Infrastructure, all under
src/test/java/io/spring/cucumber:RunCucumberTest—@Suite+@IncludeEngines("cucumber"), glueio.spring.cucumber, features atsrc/test/resources/features.CucumberSpringConfiguration—@CucumberContextConfiguration+@SpringBootTest(RANDOM_PORT)on a newcucumberprofile (build/cucumber.db, Flyway stops atV1so scenarios own their data). Its beans live in a nested@TestConfigurationon purpose: the app component-scansio.spring, and a@Componenthere would leak into every other Spring test context.ApiClientresolves the port lazily (environment.getRequiredProperty("local.server.port")) — injecting it as a constructor@Valuefails, the property does not exist yet when the bean is created.Hookswipes every table before each scenario, so scenarios are order-independent and reruns are clean.Steps build the request from the columns actually present in the table, which is what makes the missing-field outline data-driven:
Two API behaviors constrained the scenarios and are worth knowing:
"title": null(or omitting it) returns 500, not 422:DuplicatedArticleValidatorcallsArticle.toSlug(value)on a null value before@NotBlankcan reject it. The feature therefore sends[empty]for the fields under test; a blank Gherkin cell is null, which is why onlydescription/bodyappear in the second Examples table. Not fixed here — this PR only adds tests./articles/feedappliesLIMITto the tag-joined rows (findArticlesOfAuthorsjoinsarticle_tagswithout a distinct id subquery), so a tagged article consumes several rows of the page. The global feed does not have this problem (selectArticleIds). The user-feed pagination outline uses untagged articles to stay meaningful.Not addressed: the pre-existing JaCoCo gate still fails (0.34 vs 0.80) as
AGENTS.mdinstructs — run with-x jacocoTestCoverageVerification.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/ced6e245b02a49059d54e07f1b07ca25