Skip to content

Content&report test#9

Merged
rogargon merged 15 commits into
mainfrom
Content&ReportTest
Mar 19, 2026
Merged

Content&report test#9
rogargon merged 15 commits into
mainfrom
Content&ReportTest

Conversation

@mariaazcona

Copy link
Copy Markdown

No description provided.

report.setContent(content);
report.setReason(reason);

Report saved = reportRepository.save(report);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the When steps, as you are testing the API to check if it can create reports, you should be using the API instead of directly creating the intance into de database.

content.setName(name);
content.setDescription(description);

Content saved = contentRepository.save(content);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the When steps, as you are testing the API to check if it can create Contents, you should be using the API instead of directly creating the intance into de database.

For an example: https://github.com/UdL-EPS-SoftArch/spring-template/blob/c846b30f32b9e1a5d9477616de14edf84e7ae737/src/test/java/cat/udl/eps/softarch/demo/steps/ManageRecordStepDefs.java#L33

@github-project-automation github-project-automation Bot moved this from 📋 Backlog to 🏗 In progress in MyPortfoliosGEIADE Mar 3, 2026
@mariaazcona mariaazcona moved this from 🏗 In progress to 👀 In review in MyPortfoliosGEIADE Mar 3, 2026
@mariaazcona mariaazcona moved this from 👀 In review to 🏗 In progress in MyPortfoliosGEIADE Mar 3, 2026
@mariaazcona mariaazcona requested a review from rogargon March 10, 2026 14:50
Comment thread src/test/resources/features/ContentCreate.feature

Scenario: Create a new Content
Given there are no Contents in the system
And I login as "admin" with password "admin"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the user admin with password admin doesn't exists. You need a background step (or a Given step before this one) that creates the user used for authentication. For isntance:

Given There is a registered user with username "user" and password "password" and email "user@sample.app"

Assertions.assertEquals(0, contentRepository.count());
}

@Given("^There is a registered user with username \"([^\"]*)\" and password \"([^\"]*)\" and email \"([^\"]*)\"$")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to reimplement this step; it is already implemented. Remove the implementation from here because now the issue is that it is detecting that the same step definition is implemented twice

@mariaazcona mariaazcona moved this from 🏗 In progress to 👀 In review in MyPortfoliosGEIADE Mar 17, 2026
@mariaazcona mariaazcona requested a review from rogargon March 18, 2026 08:05
@rogargon rogargon merged commit b9c7dd7 into main Mar 19, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in MyPortfoliosGEIADE Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants