Tuesday, December 24, 2019

Chapter-8 Angular Jasmine SpyOn




  • Jasmine Spies help  us to mock the execution of the method /  function.
  • It’s a easy way to check a method was called or not, without leaving Subject Under Test(SUT).
  • We can chain the spyOn method to get dummy return value using .and.returnvalue()
  • spyOn can call the original function using .and.callThrough().

Thursday, December 12, 2019

Testing String and Array using jasmine matchers with Angular





1.Test Strings using matchers:
toBe
toEqual
toContain
toMatch

2. Difference between toBe & toEqual
3. Test Arrays using matchers:
toEqual
toContain
4. How to exclude test cases from execution.

Monday, December 9, 2019

Setup & Tear-down in Angular 8 unit testing


Setup - a test method beforeEach that will be executed before each unit test case.Tear Down - a test method afterEach that will be executed after each unit test case.





Sunday, December 8, 2019

CSS box model





  • Content box: The innermost box, where text and image are placed.
  • Padding box: It is a space between the element content and border of the element.
  • Border box: The border goes around the element content and padding.
  • Margin box: It is the area around border of the element.
    • The above properties have four edges “top, right, bottom, left”. 
    • Whenever we set height and width of the element we set it only for element content of the element.
    • To calculate the total area of the element we need calculate the area of element with margin, padding




Saturday, December 7, 2019

Angular 8 Unit testing Chapter4 - Arrange-Act-Assert(AAA) Pattern





  • AAA is common standard for writing the unit test cases.
  • Arrange: It means Arrange everything to setup the unit test case, like creating the objects, initializing/mocking data etc..
  • Act: Act on your unit test case, meaning execute necessary functionality/methods that needs to be unit tested.
  • Assert: This part verifies the functionality/method that we are unit testing is giving the result as per expectation.

Sunday, December 1, 2019