locked
Testing functionalities of a web application RRS feed

  • Question

  • User1185448985 posted

    I’m starting the testing phase for my web application and i’m confused where to start or what method is the best.

    I fineshed develpoing a web application using asp.net core mvc which contains multiple of controllers, models, view models etc. and has functionalies such as, personal accounts, roles and prevlages, create, remove, lock accoonts crud functions on multiple objects.

    i’ve read about unit tests but couldn’t fully understand how it works on my project which is not a calculater or wheather degree converter :)

    i would like to know how test if all functionalities is working as expected

    any given opinions or articles with examples/demo is highly appreciated 

    Tuesday, January 26, 2021 3:24 PM

All replies

  • User1120430333 posted

    I think you can unit test if you are following SoC principles in developing the solution. If you have not followed SoC, then your solution will be hard to unit test.

    Separation of concerns - Wikipedia

    Understanding Separation Of Concern in ASP.NET MVC (c-sharpcorner.com)

    Architectural principles | Microsoft Docs

    Understanding Models, Views, and Controllers (C#) | Microsoft Docs

    <copied>                                                                                                                                       

    An MVC model contains all of your application logic that is not contained in a view or a controller. The model should contain all of your application business logic, validation logic, and database access logic. For example, if you are using the Microsoft Entity Framework to access your database, then you would create your Entity Framework classes (your .edmx file) in the Models folder.

    A view should contain only logic related to generating the user interface. A controller should only contain the bare minimum of logic required to return the right view or redirect the user to another action (flow control). Everything else should be contained in the model.

    In general, you should strive for fat models and skinny controllers. Your controller methods should contain only a few lines of code. If a controller action gets too fat, then you should consider moving the logic out to a new class in the Models folder.

    <end>

    Tuesday, January 26, 2021 7:20 PM