coderedcorp / coderedcorp/coderedcms

Unit Test Generator

Aperta
#473 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Type: Enhancement
Lingua principale
Python
Stelle
765
Fork
154
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia esaminando project_template e requirements-dev.txt, quindi confronta i due approcci proposti: un test generico per i modelli basati su CoderedPage oppure un comando di gestione maketests modellato su makemigrations. Conferma l’ambito e gli strumenti di test prima dell’implementazione; il lavoro è completato quando esiste un punto di partenza documentato e utilizzabile per i test dei modelli, con la copertura del comportamento di base previsto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
django, python
Ambito
backend, testing, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.