# Chapter 6: Building Features - Search

**URL:** <https://forums.kodeco.com/t/chapter-6-building-features-search/188064>\
**Category:** Real-World iOS by Tutorials\
**Created:** [June 7, 2023, 7:35am UTC](https://forums.kodeco.com/t/chapter-6-building-features-search/188064 "2023-06-07T07:35:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wessoll](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@wessoll](https://forums.kodeco.com/u/wessoll)\
**Post date:** [June 7, 2023, 7:35am UTC](https://forums.kodeco.com/t/chapter-6-building-features-search/188064/1 "2023-06-07T07:35:02Z")

</div>

Besides testing whether the filters themselves work or not, it seems equally or even more important whether you get the search results you’re asking for. How would you unit test the filter/ searchText on the animals result?

---

<div class="post-metadata">

**Author:** ![renan.dias](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/renan.dias/32/108649_2.png) [@renan.dias](https://forums.kodeco.com/u/renan.dias)\
**Post date:** [June 8, 2023, 11:15pm UTC](https://forums.kodeco.com/t/chapter-6-building-features-search/188064/2 "2023-06-08T23:15:53Z")

</div>

Hi, @wessoll

You can unit test the different parts of the code. So, for example, if you want to test if `AnimalSearcher` does get the correct parameters from the view model (text, age and type), you can write a unit test where a mock struct implements `AnimalSearcher` and stores those parameters. You can then check in your unit test if they match what the view model sent.

You can also test if the values your mock object returns are being correctly stored in CoreData. You can use a mock object to return a set of animals, and then check the test database if they match those animals.

Now, if you want to test if the results you’re getting from the web server are being stored correctly depending on the filter parameters, then you’re need something more robust like an end-to-end test.
