Question: I'm trying to learning TDD and I clone the Repo and in the right branch. However I'm using Visual Studio and when I try to run the test as you did I get this Error: Main method not found in the file, please define the main method as: public static void main(String[] args) any ideas
@@LaMarLP55 i had the same problem, my problem was when i click at checkout at branch 6-origin-test it got those same error, solution was new branch from selected, hope it works
Amigoscode you are one of the best teachers that I've ever learned from, not only that, you cover an absurd amount of topics. Thanks for always having my back!
36:34 This test code would fail if later the message was changed to something else (which is likely to happen). But it was not the original code needs to be fixed, but the test need to be fixed in this case. Maybe this is a problem with TDD, i.e., you may need to spend extra time refactoring your test code rather than the code to be tested. Also it seems to me that if you can take all possible conditions into account in your test code, you can actually ALREADY avoid bug in THESE scenarios. E.g. in the phone number validation example, you think of 2 conditions: phone number should start with +44 and it should have 12 digits and you put that in your test code. But if you're aware of these 2 conditions, you should already be able to put the check in your code to be tested. So in this sense the test code is redundant. On the other hand, if you don't take these 2 conditions into account, your code would still have bug although it can pass unit testing. It seems to me the test code would be more useful when later the original code to be tested is modified. So running the unit test can make sure the original functionality is not broken. But in reality it's not common to remove existing logic but more likely to add some new code over that. Take the phone number again for example, maybe later +441234567890Ext123 appears as a valid phone number. In this case the original code would be modified to add this possibility. But in this case the test code would fail because it also needs to be modified.
Good explanations and also a good video. Didn't you skip some parts or continue too quickly? In my opppinion the cycle of testdriven development is allways to create failing test, fix with the minimal amount of code possible and create the next failing test. So when you created the function returning just false and checking for true the minimal approach would be to change the returned value and than add a test checking for false...
I was looking for this comment, I think the same, in the first test he should make it return just true, and then create another test that force him to implement some part of the phone number validation logic
Great video as most you publish. Just one comment, what is the scenario for the case where you have a new public function, but inside it you have various private functions defined or private variables that call functions from other classes? How do you implement the unit test of each one? Regards.
I came back to this video after a year. Java is still not better looking but I now understand TDD better. This section of the course is not TDD. Sure, tests are being done before the actual coding but this does not mean TDD. TDD builds better code as it enables concentration on smaller segments of the code. Saying "I want to keep this video simple" is a total waste of time as there are many factors that need to be understood to do TDD. A side effect is that you can confidently release software just by having the tests pass. This means that you have to have confidence in the tests and doing this is hard. One of the great tragedies of our software age is that we spend more and more effort with rotting code bases, meaning the costs just spiral out of control. Done properly TDD will eliminate this. For a really good book on TDD get Clean Craftsmanship by Robert C Martin but be warned, you need to actually understand what is in the book to have any chance of proper TDD.
Good Evening at the end of the video you placed an @Service bean but how come you did that since you did not have a service package. or maybe i am overlooking something.
Hey Nelson nice work, well explained simple and straight. I want only to discuss the PhoneNumberValidator class, it's a utility class so for me it's not needed to declare it like a bean and put it in the constructor of various Service class. I think that it's better to make a utility class with static methods in it and use it like every other utility class, so no need to mock it in the test or pass it in the constructor, it's more flexible. Tell me what you think about this modification. Good work keep it up!
Can someone explain me why the public keyword wasn't necessary at the PhoneNumberValidatorTest? Is due to the fact that no other module will use the class?
Hey! First of all, congratz on an amazing video! I'd like to ask one question: Don't you think that parameterized test ruin the clean code idea of having one test for each assertion?
Hi Sir! You are doing a great job. I request you to make a video on Microservices and How to secure Microservices. Thank you so much for the knowledge that you are sharing with us. Assalamualaikum!!!
That's a fantastic crash course sir! I have a question. When you add PhoneNumberValidator into CustomerRegistrationService, shouldn't we rewrite the test first, make it fail, and then start writing the logic in CustomerRegistrationService? Thanks in advance
@@amigoscode Information:java: Errors occurred while compiling module 'testing' Information:javac 11.0.4 was used to compile java sources Information:02/06/2020 09:51 - Build completed with 4 errors and 0 warnings in 47 s 613 ms C:\software-testing\src\main\java\com\amigoscode\testing\customer\CustomerRegistrationService.java Error:(12, 19) java: cannot find symbol symbol: class CustomerRepository location: class com.amigoscode.testing.customer.CustomerRegistrationService Error:(15, 40) java: cannot find symbol symbol: class CustomerRepository location: class com.amigoscode.testing.customer.CustomerRegistrationService Error:(19, 37) java: cannot find symbol symbol: class CustomerRegistrationRequest location: class com.amigoscode.testing.customer.CustomerRegistrationService C:\software-testing\src\main\java\com\amigoscode\testing\customer\CustomerRegistrationController.java Error:(22, 26) java: cannot find symbol symbol: class CustomerRegistrationRequest location: class com.amigoscode.testing.customer.CustomerRegistrationController
Great video!!! I have a question regarding assertThat. In the current example (16:02) you import the assert from Assertions.assertThat(org.assertj.core.api). In another video th-cam.com/video/Geq60OVyBPg/w-d-xo.html (28:20) you import assertThat from AssertionsForClassTypes.assertThat(org.assertj.core.api). What is the difference between these 2 assertThat methods? How can we identify which one we will have to use? Thank you!!!
I have good knowledge and exposure on testing manual and automatio Knowledge of api testing and mobile testing I am searching for job here in uk if you have any connects can you plz share with me Thank you Regards Pranav
I recommend having a look at how CakePHP deals with fixtures using factories: th-cam.com/video/PNA1Ck2-nVc/w-d-xo.html github.com/vierge-noire/cakephp-fixture-factories
I can’t watch anymore..... what a horrible language java is. Thank goodness for Golang. BTW if you really want to learn TDD then get the book, Test Driven Development by Example written by Kent Beck.
► Clone repo here: github.com/amigoscode/software-testing
► Join Private Facebook Group - facebook.com/groups/45603...
Question: I'm trying to learning TDD and I clone the Repo and in the right branch. However I'm using Visual Studio and when I try to run the test as you did I get this Error: Main method not found in the file, please define the main method as: public static void main(String[] args) any ideas
@@LaMarLP55 i had the same problem, my problem was when i click at checkout at branch 6-origin-test it got those same error, solution was new branch from selected, hope it works
Amigoscode you are one of the best teachers that I've ever learned from, not only that, you cover an absurd amount of topics. Thanks for always having my back!
As usual, fantastic. Cheers from Brazil!
Thanks
Amazing tutorial :D ! Keep up the good work man!
I'm soooo happy that I found another treasure vlogger!!!
Wow! I like this post. Very good, I learned a lot of things. I'll watch the other videos! You are a good teacher
Excellent for something I'm not even paying for.
36:34 This test code would fail if later the message was changed to something else (which is likely to happen). But it was not the original code needs to be fixed, but the test need to be fixed in this case. Maybe this is a problem with TDD, i.e., you may need to spend extra time refactoring your test code rather than the code to be tested.
Also it seems to me that if you can take all possible conditions into account in your test code, you can actually ALREADY avoid bug in THESE scenarios. E.g. in the phone number validation example, you think of 2 conditions: phone number should start with +44 and it should have 12 digits and you put that in your test code. But if you're aware of these 2 conditions, you should already be able to put the check in your code to be tested. So in this sense the test code is redundant. On the other hand, if you don't take these 2 conditions into account, your code would still have bug although it can pass unit testing.
It seems to me the test code would be more useful when later the original code to be tested is modified. So running the unit test can make sure the original functionality is not broken. But in reality it's not common to remove existing logic but more likely to add some new code over that. Take the phone number again for example, maybe later +441234567890Ext123 appears as a valid phone number. In this case the original code would be modified to add this possibility. But in this case the test code would fail because it also needs to be modified.
Good explanations and also a good video. Didn't you skip some parts or continue too quickly?
In my opppinion the cycle of testdriven development is allways to create failing test, fix with the minimal amount of code possible and create the next failing test. So when you created the function returning just false and checking for true the minimal approach would be to change the returned value and than add a test checking for false...
I was looking for this comment, I think the same, in the first test he should make it return just true, and then create another test that force him to implement some part of the phone number validation logic
Excellent video Nelson!
You are really doing good job, thank you so much.......
This is just what I needed! Could you also make a Golang OAuth API Tutorial (making a go API from scratch) Thanks.
Great suggestion! I have been doing lots of Go lately so stay tuned
جزاكم الله خيرا" . Jazaka ALLA khayran Bro
Keep with the good work Bro!
Great video as most you publish. Just one comment, what is the scenario for the case where you have a new public function, but inside it you have various private functions defined or private variables that call functions from other classes? How do you implement the unit test of each one? Regards.
Awesome work. Great Java tutorials! Keep it up.
Thanks buddy
Dude, you are doing such good content! Gods work!
Thanks
I came back to this video after a year. Java is still not better looking but I now understand TDD better.
This section of the course is not TDD. Sure, tests are being done before the actual coding but this does not mean TDD. TDD builds better code as it enables concentration on smaller segments of the code. Saying "I want to keep this video simple" is a total waste of time as there are many factors that need to be understood to do TDD.
A side effect is that you can confidently release software just by having the tests pass. This means that you have to have confidence in the tests and doing this is hard.
One of the great tragedies of our software age is that we spend more and more effort with rotting code bases, meaning the costs just spiral out of control. Done properly TDD will eliminate this.
For a really good book on TDD get Clean Craftsmanship by Robert C Martin but be warned, you need to actually understand what is in the book to have any chance of proper TDD.
why did you drop the TDD in the last part and wrote the service logic first and modified the tests to pass afterwards?
thanks for this awesome chanel nelson .
Glad you enjoy it!
Great video.
Possible video on Domain Driven Design?
Great suggestion!
Good Evening at the end of the video you placed an @Service bean but how come you did that since you did not have a service package. or maybe i am overlooking something.
This is amazing, thank you.
Another great course. Your crash course is like a pro level course. Thanks to Amigos.
thanks Zakaria
Great video as always Nelson! Been looking to do more TDD during my internship. Thank you!
Very good example of mockito and TDD. Thank you so much!!
You welcome
Passes the Uncle Bob quality test.
Hey Nelson nice work, well explained simple and straight. I want only to discuss the PhoneNumberValidator class, it's a utility class so for me it's not needed to declare it like a bean and put it in the constructor of various Service class. I think that it's better to make a utility class with static methods in it and use it like every other utility class, so no need to mock it in the test or pass it in the constructor, it's more flexible. Tell me what you think about this modification. Good work keep it up!
Statics are evil and difficult to test when you reply on external dependencies
First one here... I was waiting very eagerly.Thanks🙂
Hope you enjoyed it!
@@amigoscode yes loved it♥️
Can someone explain me why the public keyword wasn't necessary at the PhoneNumberValidatorTest? Is due to the fact that no other module will use the class?
What's the font configured in your zsh? It's very readable.
Hi can you please update this, I tried to run the tests after branch 6 and I had no option to run them. I did clone the repo in to intellij
Your system is running freaking hot... MacBook Pro with i9 it is.
Nice! Waiting for a video on interview questions/process for junior developers. That'd be awesome.
Hey! First of all, congratz on an amazing video! I'd like to ask one question: Don't you think that parameterized test ruin the clean code idea of having one test for each assertion?
Thx A lot My Friend, Baraka Allah Fik
Awesome video bro, best video I have seen so far about TDD.
Awesome video, Thanks alot.
Glad you liked it!
Amazing clarity
As much as I hate writing tests, I'm hoping that you will convince me to want to do it more :D
I also hate write tests for react apps :p
Mockito and JUNIT testing is it included in software testing please tel me waiting
When building the project I get the follwoing error: java: package javax.persistence does not exist
wow! this is good. please can you do a TDD on devices like bikes?
You're awesome. Thanks for advice and courses
You welcome
Please the discord link has expired? Can I get the link again?
can you share your work environment. What are those 2 monitors? Maybe Amazon link?
Where can I get the full course
i have a generell question regarding "how to start a test". why does maven tests fails but intellijs not ? is it all about wrong configuration ?
Hi Sir! You are doing a great job. I request you to make a video on Microservices and How to secure Microservices. Thank you so much for the knowledge that you are sharing with us. Assalamualaikum!!!
awesome work,thanks
Awsome video. I enjoy the way you explain things... Thanks for that. Can you do a video like this but in python for web development? Have a great day
Nice video as always
this is the actual good video
Thanks a lot nelson!!!
Playback speed 1.5x makes it much better.
Great video!
That's a fantastic crash course sir! I have a question. When you add PhoneNumberValidator into CustomerRegistrationService, shouldn't we rewrite the test first, make it fail, and then start writing the logic in CustomerRegistrationService?
Thanks in advance
Am getting this errors on building the project after checking out branch 6- integration testing in IntelliJ. What do I do??
What error?
What error?
@@amigoscode Information:java: Errors occurred while compiling module 'testing'
Information:javac 11.0.4 was used to compile java sources
Information:02/06/2020 09:51 - Build completed with 4 errors and 0 warnings in 47 s 613 ms
C:\software-testing\src\main\java\com\amigoscode\testing\customer\CustomerRegistrationService.java
Error:(12, 19) java: cannot find symbol
symbol: class CustomerRepository
location: class com.amigoscode.testing.customer.CustomerRegistrationService
Error:(15, 40) java: cannot find symbol
symbol: class CustomerRepository
location: class com.amigoscode.testing.customer.CustomerRegistrationService
Error:(19, 37) java: cannot find symbol
symbol: class CustomerRegistrationRequest
location: class com.amigoscode.testing.customer.CustomerRegistrationService
C:\software-testing\src\main\java\com\amigoscode\testing\customer\CustomerRegistrationController.java
Error:(22, 26) java: cannot find symbol
symbol: class CustomerRegistrationRequest
location: class com.amigoscode.testing.customer.CustomerRegistrationController
@@amigoscode same!!!
I can't find the full course for TDD.
Thank you very much for the lesson , which design pattern you used here ?
builder pattern
Thank you!
nice video bro 👌🏾
amazing video !
Thanks
The intro made me thought it was an ad, so i actually tried to skip the video in the first second xD
Great video!!!
I have a question regarding assertThat. In the current example (16:02) you import the assert from Assertions.assertThat(org.assertj.core.api). In another video th-cam.com/video/Geq60OVyBPg/w-d-xo.html (28:20) you import assertThat from AssertionsForClassTypes.assertThat(org.assertj.core.api). What is the difference between these 2 assertThat methods? How can we identify which one we will have to use?
Thank you!!!
Please do crash course on react
How possible can we be getting some of your courses on Udemy.
Why you want them on udemy, when you have the courses here for free?
@@magicalvibez2037 This is just a sample chapter of the full course.
Full course on my website
your membrane keyboard is killing me. how can you use that thing? haha
I have good knowledge and exposure on testing manual and automatio
Knowledge of api testing and mobile testing
I am searching for job here in uk if you have any connects can you plz share with me
Thank you
Regards Pranav
A - A - A 👈 Your TTD Three Musketeers
Arrange
Act
Assert
completed
Shouldn't it be : fail test - > refactoring - > pass test
great !
thanks
Pls provide us notes sir
Thanks
Hey Assaloumou alekum brother by the your face look great! I mean nice look
Thanks brother
I recommend having a look at how CakePHP deals with fixtures using factories:
th-cam.com/video/PNA1Ck2-nVc/w-d-xo.html
github.com/vierge-noire/cakephp-fixture-factories
too much ads in a single video. :(
I would love to join your course but it is expensive bro $34.99
it´s giving you a good start into a well paid job.
@@MrBayoumi i bought it it is very good course🙆♂️
Guys, just skip first 10 min. Crash course, my class.
First Viewer... lol
hahah
@@amigoscode Thanks for the video though, good stuff. You're the best.
1st
awesome
I can’t watch anymore..... what a horrible language java is. Thank goodness for Golang. BTW if you really want to learn TDD then get the book, Test Driven Development by Example written by Kent Beck.
yep I love GoLang too
Hi Amigoscode unable to join discord group the invitation link is not working