Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Agile Web Development (CITS3403).
RSS cloud
Jump to:

Unit Testing

1 of 419 articles shown, currently no other people reading this forum.
From: Timothy F.
Date: Thu 21st May 2020, 11:22am


"Elise Rattigan" <22*5*7*[email protected]*u*e*t*u*a*e*u*a*> wrote:

> Just a question about unit testing.  In the workshop from last week, in the 
> __init__.py file, app.config.from_object(Config) was changed to 
> app.config.from_object(TestConfig). Does this mean that we need to do that every time 
> we decide to run tests and then change it back to Config when we're done? Or we 
> should be running the test config as we build and then changing it back when we're 
> finished?
I think that depends on how you develop. If you're doing test driven development, then 
probably TestConfig would be the defualt mode. However, alot of people prefer to work 
with DevConfig, where you use the the database as a kind of scratchpad: you enter data 
and manually inspect etc. 
The you switch to Test config before every commit and after every merge, to confirm 
nothings broken.

> Also, in terms of what to test, for unit testing we should choose one model and run 
> unit tests for all the routes.  What should we be doing system testing on? Obviously 
> in practice, it would be ideal to do everything, but just in the context of this 
> project?

You typically run unit tests for methods which could be the routes, but can also be 
targetted at helper methods in the model.
In practise you should aim for 100% coverage, but as that is time consuming and 
repetitive, just aim to cover one nontrivial model (e.g. try to test all model methods 
and controller methods related the question class).

To test routes properly you should probably be sending http requests, so system testing 
with selenium may be more appropriate.

Related articles

Unit Testing (both) RSS
├─ original   Wed 20th May 2020, 4:18pm, Elise R.
└─ THIS   Thu 21st May 2020, 11:22am, Timothy F.
This Page

Program written by: [email protected]
Feedback welcome
Last modified: 11:27am Sep 21 2020