Page MenuHomePhabricator

tbs: user-story 12: I want to easily run the tests for each of the codebases
Closed, ResolvedPublic

Description

As a Toolforge developer (toolforge contributor) I want to easily run the tests for each of the code bases

When do we know it's done?

Scenario: Testing the code for a tbs codebase

Given I am in the codebase root
When I run pre-commit
Then the linters are run

Scenario: Testing the code for a python tbs codebase

Given I am in the codebase root
When I run tox
Then the linters are run
And the tests are run

Scenario: Testing the code for a golang tbs codebase

Given I am in the codebase root
When I run make test
Then the linters are run
And the tests are run
This epic contains the following tasks:

This is a tracking task, so it will be closed once the tasks mentioned below are completed.

Event Timeline

dcaro triaged this task as High priority.Dec 14 2022, 3:28 PM
dcaro created this task.
dcaro added a project: Toolforge Build Service.

Stylistic suggestion: I would follow this pattern when using Given/When/Then keywords:

Describe an initial context (Given steps)
Describe an event (When steps)
Describe an expected outcome (Then steps)

Source: https://cucumber.io/docs/gherkin/reference/

Stylistic suggestion: I would follow this pattern when using Given/When/Then keywords:

Describe an initial context (Given steps)
Describe an event (When steps)
Describe an expected outcome (Then steps)

Source: https://cucumber.io/docs/gherkin/reference/

Can you rewrite the description to adapt to your suggestion? (will help me see the difference)

Something like this

Scenario: Testing the code for a tbs codebase
  Given I am in the codebase root # desired state before running the test
  When I run pre-commit           # atomic action that is easy to test (manually or automatically)
  Then the linters are run        # expected result (if TRUE, the scenario is verified)

Scenario: Testing the code for a python tbs codebase
  Given I am in the codebase root
  When I run tox
  Then the linters are run
  And the tests are run

Scenario: Testing the code for a golang tbs codebase
  Given I am in the codebase root
  When I run make test
  Then the linters are run
  And the tests are run

The "Given" steps could also be something like Given I am in the root of a Python codebase

To a large extent, this is a matter of personal preference. In my experience, this style is the most clear and effective for both manual and automated testing, but is definitely not the only "correct" one. Please take my comment as a suggestion and not as a prescription. :)

Something like this

Scenario: Testing the code for a tbs codebase
  Given I am in the codebase root # desired state before running the test
  When I run pre-commit           # atomic action that is easy to test (manually or automatically)
  Then the linters are run        # expected result (if TRUE, the scenario is verified)

Scenario: Testing the code for a python tbs codebase
  Given I am in the codebase root
  When I run tox
  Then the linters are run
  And the tests are run

Scenario: Testing the code for a golang tbs codebase
  Given I am in the codebase root
  When I run make test
  Then the linters are run
  And the tests are run

This looks way nicer :), I'll change the task/subtasks

dcaro updated the task description. (Show Details)
dcaro raised the priority of this task from High to Needs Triage.Mar 6 2023, 3:03 PM
dcaro claimed this task.
dcaro moved this task from Next Up to Done on the Toolforge Build Service (Iteration 17) board.