coderedcorp / coderedcorp/coderedcms

Unit Test Generator

オープン
#473 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: Enhancement
主要言語
Python
スター
765
フォーク
154
PR マージ指標
30日以内にマージされた PR はありません

説明

As part of the project_template, I think it would be beneficial to also create a template for unit tests, to instantly provide some minimal coverage and to make it as easy as possible for developers to get started writing more advanced tests.

The biggest barrier to entry is often times just setting all the test framework up, and remembering how to do it.

Two ideas here, not necessarily mutually exclusive:

1. A generic test which loads all known models based on CoderedPage (we already have this list). Loops through them and creates an object with a title and some other basic fields, and asserts a successful GET response. The advantage is that you get free unit tests; the disadvantage is that it would still require writing custom unit tests for actual functionality.

2. Similar to `makemigrations`, a management command `maketests` which creates a boilerplate unit test file for each model that doesn't already have a test file. This would be super easy to implement as it could essentially just copy a python template into the folder. The result would be a basic unit test similar to 1 above, but with the intention that the developer can start customizing it to do more.

As part of this we would also need to provide test tooling in `requirements-dev.txt`, similar to how the sass template works.

While 1 above is a bit "cooler", I think 2 is a more useful approach, as it would give the same coverage as 1, but be a lot easier to understand and add to over time.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず project_template と requirements-dev.txt を確認し、次に提案されている2つのアプローチを比較します。CoderedPage に基づくモデル向けの汎用テスト、または makemigrations をモデルにした maketests 管理コマンドです。実装前にスコープとテストツールを確認してください。モデルテストのための、意図した基本動作をカバーする文書化された実用的な出発点が用意されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
django, python
領域
backend, testing, tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。