question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tutorial suggests a change in code, that makes the default tests fail

See original GitHub issue

📚 Docs or angular.io bug report

Description

When following “Tour of heroes” tutorial, I found out that tutorial suggests a change that immediately makes the tests fail. I found it, because i had ng test command running, which turned red immediately after I introduced the change. The tutorial says nothing about the failing tests, nor saying how to fix it.

🔬 Minimal Reproduction

What’s the affected URL?**

https://angular.io/tutorial/toh-pt0

Reproduction Steps**

Follow the “Tour of heroes” tutorial

Expected vs Actual Behavior**

I would expect that if tutorial suggest to go with ng new example (which creates default tests), and also suggests to change the structure of the app template, then it should also mention this change in test.

How to fix the tests, so they follow the tutorial:

Change this:

expect(compiled.querySelector('.content span').textContent).toContain('example app is running');

to this:

expect(compiled.querySelector('h1').textContent).toContain('Tour of Heroes!');

📷Screenshot

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
kapunahelewongcommented, Jul 23, 2020

This is such a helpful thread! And, as you two noticed, the testing info is undergoing some re-thinking.

Regarding the tutorials, we are in the process of identifying tutorials throughout the docs and moving them into a new tutorials section. Sometimes, it’s a little bit tricky because some of the current documentation has conceptual information mixed in with longer tutorials. Because of this, you’ll see some things being moved and then after the move someone goes in to sort out the actual content with a finer approach. We are doing it this way so that we can really see what’s present in the docs and what we need to add, or in some cases clear out. We’re also trying to keep docs PR scope really focused, so that’s why you’ll see incremental PRs.

cc @aikidave, our docs team lead for more context. 🌟

@s-gbz, regarding your question, Brandon has since left the docs and I miss him!

2reactions
aikithoughtscommented, Jul 23, 2020

@kapunahelewong, as is so often the case, correct!

I think adding testing to tour of heroes (and maybe the stackblitz-based tutorial as well?) would be a great thing to do. @Danon, I think both of your ideas are good: making sure the tests pass(!) and also looking into adding additional tutorials on testing. What’s the best way for us to connect to discuss this further?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best practices for writing unit tests - .NET - Microsoft Learn
Learn best practices for writing unit tests that drive code quality and resilience for .NET Core and .NET Standard projects.
Read more >
Java Unit Testing with JUnit and TestNG
Regression Test: Tests to ensure the a change (such as enhancement, patches or configuration change) does not break the system or introduce new...
Read more >
Advanced googletest Topics
When a test assertion such as EXPECT_EQ fails, googletest prints the argument values to help you debug. It does this using a user-extensible...
Read more >
Getting Started With Testing in Python
In this in-depth tutorial, you'll see how to create Python unit tests, ... Now, every time you make a change to your code,...
Read more >
Add a test - The Go Programming Language
Implement test functions in the same package as the code you're testing. Create two test functions to test the greetings.Hello function. Test function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found