is controller testing functional testing?

General Tech QA/Testing 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on QA/Testing related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am really interested in different aspects of testing. I hope you can really read this and just give me your ideas if you have experience with this. Let's break down.

Fact 1: It's said that when we write a test from user perspective(going to uri, and getting results and if user sees the correct result, then test is right). They say this is called functional testing.

Sum up 1: So turns out when we write tests for controller, it's always functional as we must make the request to endpoint and observe the result. SO writing tests for controllers are always functional tests.Is that right?

==========================================================================

Fact 2: So, Integration testing is not controller testing. Let's imagine we have some functions (not controller functions) in our app. For example in our helper classes or models. and we want to test those functions like integration testing. So we won't mock anything and just test it.

Sum up 2: So, integration testing can be done on functions that are not controller functions, are written on other places(where request doesn't need to be done) and they must use external dependencies. By external dependencies, anything can be thought (such as file,database or another class itself) . Is that right?

==========================================================================

Sum up 3: what if I have just an api and instead of returning views, I return json and status codes from controllers. If i write test for controllers, it will still be called functional tests. right?

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.