A repository for the age-old example use-case of a To-Do or Task application written in Microsoft's .Net framework using Clean Coding practices and Extreme Programming (XP) principles.
Here's how this project is getting started.
- ✅ Initial Red-Green-Refactor
- ✅ Build Pipeline
- ✅ Visualize Test Results
- ⏸️ Visualize Code Coverage (holding off until can expand on how this can be used)
- 🔲 API Red-Green-Refactor
- 🔲 Task: API Red-Green-Refactor
- 🔲 Task: Create Task Red-Green-Refactor
- ✅ Add .vscode folder with
extensions.json
file to contain a list of recommended VSCode extensions for this project. - ✅ Update
.gitignore
file withdotnet new gitignore --force
- ✅ Create folder
src
and navigate in terminal. - New solution file
dotnet new sln
. - ✅ Add library to expose as an API, ex:
dotnet new xunit -o Tasks
(see xUnit.net getting started) - Add library to the solution ex:
dotnet sln add tasks/tasks.csproj
- ✅ Navigate to
src/Tasks/
- ✅ Build the solution
dotnet build
- ✅ Test the solution
dotnet test
- ✅ Run
dotnet watch test
, start doing some TDD - ✅ Rename
UnitTest1
toTaskService.Tests
and start coding - ✅ Check Probelms tab in VSCode for any issues.
Make sure to update README.md as nyou are moving through the tasks.
- Go to the GitHub Actions tab and create a new workflow for .Net. Reference the GitHub Actions for .Net documentation.
- Create new workflow file in
.github/workflows/tasks-ci.yml
- Check Problems tab in VSCode for any issues.
Using dorny/test-reporter to visualize test results. Looked at other actions, but this one has support for multiple tests.
- name: Test
run: dotnet test $PROJECT --no-build --verbosity normal -c $RELEASE --logger "trx;LogFileName=test-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: .Net Unit Tests
path: "**/test-results.trx"
reporter: dotnet-trx
fail-on-error: true
Need to add permissions section to the workflow file to let it provide an update via GitHub Checks API.
permissions:
statuses: write
checks: write
Holding off until can expand on how this can be used. If code coverage exposes uncovered code paths, that could be pointing to a potential gap. If code coverage shows 100% code coverage, however, it does not mean the tests are effective. Putting the code into production will be needed to identify any gaps in coverage.
- 🔲 Add capability (playwright)
- 🔲 Sanity Test (local)
- 🔲 Sanity Test (pipeline)
npm init playwright@latest
Using TypeScript, tests
directory, add GitHub workflow playwright.yml
.
Update playwright.config.ts
and removed Safari and Firefox (for now).
npx playwrght test
(all passes)
Clean-up playwright.yml
branch names, spacing, and add workflow dispatch.
Clean-up .gitignore
.
Push too branch and open PR 🤞.
Note: After running on new machine,
$ npm run tasksapi:test
> [email protected] tasksapi:test
> npx playwright test --project=TasksAPI-E2E
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
Please install @playwright/test package to use Playwright Test.
npm install -D @playwright/test
$ npm run tasksapi:test
$ npm install -D @playwright/test
added 4 packages, and audited 5 packages in 2s
found 0 vulnerabilities
- 🔲 UI Test for Developer Portal (local)
- 🔲 UI Integration Test (red)
- 🔲 Add API Project locally (green)
- 🔲 Refactor locally
- 🔲 UI Test for Developer Portal (production)
- 🔲 UI Integration Test (red)
- 🔲 Deploy Developer Portal (green)
- 🔲 Refactor
- 🔲 API Test (red-green-refactor)
- 🔲 UI Integration Test (red)
- 🔲 Expose endpoint locally (green)
- 🔲 Refactor locally
- 🔲 Publish & production tests should pass
- 🔲 Refactor
The following is a set of guidelines for contributing to this repository. These are just guidelines, not rules, so use your best judgment and feel free to propose changes to this document in a pull request.
An idea that XP applies to not just coding, but to projects as well. After the first iteration of Red-Green-Refactor, establish an automated build pipeline, publish test results, and code coverage results.
Basic Process:
- Using Test-Driven Development (TDD), complete first Red-Green-Refactor; push to changes.
- Create initial pipeline to build project; push changes;
- Require successful build for Pull Requests into Main branch.
- Add unit test results to pipeline.
- Add test coverage to pipeline.
- Deploy application or publish package.
- Continue TDD.
Here are some items to help guide coding efforts:
- Clean Coding
- focus on topic, not tech
- well-written prose
- fast feedback
- Extreme Programming
- Test-Driven Development (TDD)
- Continuous Refactoring
- Pairing
- Simple Design
- Only build what changes
- Dave Farley-land (expand later)