---
title: "Legacy BlogEngine Project Overview"
url: "https://courses.osherove.com/courses/tdd-in-net-in-hebrew/legacy-blogengine-project-overview.md"
canonical: "https://courses.osherove.com/courses/tdd-in-net-in-hebrew/legacy-blogengine-project-overview/"
tags: []
author: "Roy Osherove"
description: "Lesson 20 of 22 in TDD in .NET in Hebrew (Day 3 - Legacy Code), 8:02. Free video by Roy Osherove."
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Legacy BlogEngine Project Overview

1. [Courses](https://courses.osherove.com/#courses)
2. [TDD in .NET in Hebrew](https://courses.osherove.com/courses/tdd-in-net-in-hebrew/)
3. Day 3 - Legacy Code

Lesson 20 of 22

Duration: 8:02 [Watch on YouTube](https://www.youtube.com/watch?v=yS87tH70uvg) Spoken in Hebrew

## In this lesson

Roy Osherove introduces the [legacy project](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-12 "Working with legacy code (The Art of Unit Testing, 3rd ed., ch. 12)") for the third day, the BlogEngine.NET blog engine, which has no [unit tests](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-1#sigil_toc_id_17 "Defining unit testing, step by step (The Art of Unit Testing, 3rd ed., ch. 1)") but has integration and [acceptance tests](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-10#sigil_toc_id_178 "E2E/UI isolated tests (The Art of Unit Testing, 3rd ed., ch. 10)"). Some are written with WatiN, which is based on Ruby's Watir and works mainly with Internet Explorer, and others in a framework whose tests are written in Razor pages that run in the browser; of 20 tests, five fail. The exercise is to understand why and make all the tests pass, get to know the code and its dependencies, and try writing a new test [before refactoring](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-12#sigil_toc_id_225 "Writing integration tests before refactoring (The Art of Unit Testing, 3rd ed., ch. 12)").

## Transcript

916 words

[\[00:07\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=7s) BlogEngine.NET הוא מנוע של בלוגים שמאפשר לנו לעשות כל מיני דברים, כולל לכתוב ולוג, קומנטים, טקבק, פינבק וכל מיני דברים מעניינים אחרים. אנחנו הולכים לעשות לכתוב לו טestטים. עכשיו הפרויקט הזה מעניין מכמה בחינות. א' יש בו המון, אין לו בכלל [unit testing](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-1#ch01lev1sec1 "Defining unit testing, step by step (The Art of Unit Testing, 2nd ed., ch. 1)"), אבל ב' יש לו כמה integraation test אוceptance test מאוד נחמדים. בעצם אם אני לוקח את הפרויקט אני עושה לו קונטרול F5 כדי להריץ אותו ואז אני עושה קליק ימני run test

[\[00:39\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=39s) יש לי פרויקט של testing שמריץ לי את הal את הארט exporer ובעצם מפעיל כל מיני פונקציות בceptance test האcest פה כתובים בכמה frameworים אחד הפרamewורקים שזה כתוב בהם זה אם אתם מכירים זה web application testing in.net אז מרוסס על פרויקט ברובי שנקרא Watir או Watir שזה web application testing in ru

[\[01:13\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=73s) הפרw הזה בעיקר מכיר אתנט expפור ו יש פה עוד כמה פיצ'רים נחמדים א' הטestטים וואו כתובים בnitט אז טן in זה סתם פריימורק שמשתמשים בו איך אני אראה לכם את הטestטים פה בעצם הטestטים רצים בזמן שאני מדבר תשימו לב כמה זמן לוקח להם לרוץ אבל יש פה עוד טים בעוד פרימוק שנאק קישות או קיחות קישות שזה פרימוק שנכתב על ידי בחור בשם rקרי עוד איזה altגי

[\[01:47\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=107s) שעבר לרובי ואז חזרה לדוטנט ולקח כמה רעיונות משם וממשימש אותם בדוטנט ובין השר מה שהוא מימש זה framewורק שנקרא קוט שזה מאפשר לך לרשום testive ברזור שזה השפת templליטנing של שאפשר לכתוב ב-ASP.NET ‏viw ומאפשרים לך לעשות אסרטים שנראים קצת כמוספקים משהו צריך להראות כמו משהו אחר להריץ את הטestטים כביכול בפרודקשן אפשר להריץ את הטestטים האלה גם בפרודקש אז פה אתם רואים בינתיים הטestטים רצים

[\[02:19\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=139s) בודקים את הפינס שאפשר לעלות comמנטים כל מיני דברים כאלה לעשות לogגן אם אני אעשה פה בינתיים view outpט כל הטestטים האלה רצים עם TestDriven.NET זאת אומרת זה כתוב ב-NUnit אתם רואים שהטestטים רצים בינתיים דיברתי ובעברו איזה כמה דקות סך הכל את כמות הטestטים שרצה פה זה 15 טestטים אבל כל טestט מורכב מהרבה דברים הטestטים עצמם

[\[02:54\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=174s) יש פה בעצם שני פרויקטים של טestטים למרות שנראה שיש רק אחד הטest הראשון הוא זה והטestטים פה כתובים בnitוס שזה שזה בעצם לוקח את והולך לכל מיני דפים אבל יש גם טestטים שכתובים בכיחוטה שיהיה לכם גם לינק בתרגילים כי זה בעצם אתה כותב את הטestטים אתה יכול לכתוב אותם או בקונסול או ב שנייה בוא נראה איפה זה

[\[03:28\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=208s) כן נכון אני אסגור את זה זה לא מתחת לאדמין זה לא מתחת לוין זה מתחת את הטestטים האלה זה בעצם בספרי הטestס כאשר הטestטים כתובים בריזור כל הטestטים של הCHML הם טestטים שבעצם גם הטestטים שלIT של מבקשים מוטין ללכת לדפים האלה ולהריץ את הטestטים שכתובים פה טוב יש פה איזשהי בעיה עם הסנטeקס הייט אבל בגדול זה rיזור כאשר הסנטקס של הטest פה נראה ככה

[\[04:01\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=241s) Following שימו לב avatar test ואת השם של האly לא חייבים את השם שלא רוצים ואז יש it should כן it should שזה בעצם המילה שבה משמשים בדרך כלל ואז יש פה איזשהו סטרינ שזה בעצם בא מעולם הרובי שימוש בסטרינג ככה ואז יש לנו בעצם איזשהו למדה כי צריך להחזיר פה איזשהו

[\[04:31\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=271s) משתנה מסוגד delegate ופה כתוב ממש test תפתח את הlog settings instance avatar get avatar image return שמשהו true force שזה מתחיל בככה וזה ends with ככה ואז תשימו לב שבסוף יש עוד משהו מאוד מעניין

[\[05:09\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=309s) יש כל מיני דברים כמו שבי שימו לב יש פה כל מיני דברים אין שבינ שביטול שזה מאוד דומה לאסטים של [NUnit](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-2#ch02lev1sec3 "First steps with NUnit (The Art of Unit Testing, 2nd ed., ch. 2)") אבל זה בעצם חלק מהפריורק של כיפות n עכשיו הפריורק הזה הוא כולו בסך הכל פייל אחד שבוקחים ושמים בפרויקט כל הפריורק הוא בפייל אחד זאת אומרת הוא מאוד פשוט והוא כבר נמצא בפרויקט שלכם המשימה שלכם כרגע היא לפתוח את ה בוא נראה דרך אגב אם הכל כבר נגמר או לא outpט

[\[05:40\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=340s) אוקיי אתם רואים 15 פסחמישה פיל אז יש סך הכל 20 טestטים ויש חמישה שנכשלים עכשיו תחתרו לכם אתם המפתחים אתם באים עושים גטליס מריצים את כל הטestטים חמישה טestטים נכשלים אם אם זה test יכול להיות שזה עניין של קונפיגורציה ודרך אגב יש פה כל מיני עניינים שצריך לסדר המטרה שלכם היא קודם כל לגרום לכל הטestטים פה לעבור כדי שנוכל אחרי זה לעשות ריפקטורים

[\[06:10\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=370s) לפרויקט הזה בסדר זאת אומרת להבין למה הם לא עוברים לתקן את הטestינג אם צריך יכול להיות שיש פה כל מיני דברים שעובדים על מערכת מרוחקת ולא עובדים על המערכת הלוקלית להבין מה קורה פה מכיוון שמדובר פה בעיקר בcept ‏test. ברגע שיש לנו בלגסי קוד סדרה של testים שעוטפת את הקוד אפשר להתחיל לעשות משהו עם הקוד הזה. אני יכול להגיד לכם מראש שהטestטים שנכשלים גם קשורים לקיקוטה. צריך להבין מה קורה שם.

[\[06:41\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=401s) אפשר גם את הקירות האלה להריץ ישירות מפה. אני יכול ללכת ללוקל הוסט איפה שאני מריף את הפרויקט לכתוב test ופשוט ללכת לאחד הדפים ותשימו לב שאם אני הולך אליהם ישירות אני רואה אותם והם עוברים. אוקיי, ככה אפשר להריץ את כל הטסטים ידנית אפילו בפרודקש.

[\[07:12\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=432s) שאתם צריכים להשתמש בו נמצא פה pitl. Labacy legגy doc יש פה האפרק casס משנה אחרת ביטלי לא עובד תשימו לב אז זה פשוט casי סטנדרטי. אז מה שאנחנו נעשה עד ארוחת הצהריים זה את החלק הראשון של הדוקיומנט הזה. בסדר? כתוב לכם שם איפה עוצרים לצהריים. כתבתי במיוחד שלא תעשו יותר מדי חס וחלילה. זה להבין את הפרויקט הזה קצת להיכנס אליו, להכיר את הקוד שלו, להבין את הדפendנenנy שלו, לגרום לכל הטestטים לעבור ואפילו לנסות לכתוב טest חדש,

[\[07:42\]](https://www.youtube.com/watch?v=yS87tH70uvg&t=462s) Test חדש עם אחד מהטרימוקים האלה שנמצאים פה. פשוט להתחיל לשחק עם הדבר הזה ולראות איך זה מרגיש להתנסות איתו וגם לראות איך זה מרגיש להיכנס לידי הסיקות שלא כתבתו בסדר שאלות אוקיי בהצלחה פגש פה ‏Yeah.

## Related

- [Writing integration tests before refactoring](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-10#ch10lev1sec3) · The Art of Unit Testing, 2nd ed., ch. 10

    Writing integration tests before refactoring, the role BlogEngine's existing integration and acceptance tests play.

- [Where do you start adding tests?](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-10#ch10lev1sec1) · The Art of Unit Testing, 2nd ed., ch. 10

    Where to start adding tests in legacy code, the first question when approaching an untested project like this one.

- [The Testing Feasibility Matrix](https://osherove.com/blog/2005/7/25/the-testing-feasibility-matrix.html) · osherove.com

    Roy's formula for deciding where to start unit testing legacy code, useful when mapping BlogEngine's dependencies.

### Also linked in this lesson

#### The Art of Unit Testing, 3rd ed.

- [Working with legacy code](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-12), ch. 12
- [Defining unit testing, step by step](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-1#sigil_toc_id_17), ch. 1
- [E2E/UI isolated tests](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-10#sigil_toc_id_178), ch. 10
- [Writing integration tests before refactoring](https://livebook.manning.com/book/the-art-of-unit-testing-third-edition/chapter-12#sigil_toc_id_225), ch. 12

#### The Art of Unit Testing, 2nd ed.

- [Defining unit testing, step by step](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-1#ch01lev1sec1), ch. 1
- [First steps with NUnit](https://livebook.manning.com/book/the-art-of-unit-testing-second-edition/chapter-2#ch02lev1sec3), ch. 2

[Previous lesson Readability Practices](https://courses.osherove.com/courses/tdd-in-net-in-hebrew/readability-practices/) [Next lesson Refactoring- Introduce Instance Delegator](https://courses.osherove.com/courses/tdd-in-net-in-hebrew/refactoring-introduce-instance-delegator/)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
