Showing posts with label Cypress. Show all posts
Showing posts with label Cypress. Show all posts

Thursday, March 26, 2020

Typescript vs Javascript

What is JavaScript?
JavaScript (JS) is a scripting language which is primarily used for creating web pages. It is used to enhance HTML pages and is generally embedded in HTML code. JavaScript doesn’t need to be compiled as its an interpreted language. It helps to create dynamic, creative and interactive web pages. JavaScript files are identified by the .js extension.
What is TypeScript
TypeScript is an open-source programming language that lets you write JavaScript the way you want to. TypeScript is a superset of JavaScript that compiles into simple JavaScript. TypeScript is purely object-oriented with classes and interfaces. It helps programmers to write object-oriented programs and have them compiled to JavaScript, both on the server-side and client-side.

Mocha and Chai


  • What is Mocha Framework?


Mocha is a JavaScript test framework for Node.js programs, featuring browser support, asynchronous testing, test coverage reports, and use of any assertion library.

describe('Foo', function(){
  describe('#bar()', function(){
    it('should work without error', function(done){
      var foo = new Foo(128);
      foo.bar(done);
    })
  })

})


describe():To group the tests
it(): Individual test case
context() is just an alias for describe(), and behaves the same way; it just provides a way to keep tests easier to read and organized. Similarly, specify() is an alias for it().

describe('Hooks', function() {
  before(function() {
    // runs once before all tests in the block
  })

  after(function() {
    // runs once after all tests in the block
  })

  beforeEach(function() {
    // runs before each test in the block
  })

  afterEach(function() {
    // runs after each test in the block
  })

})
  • Chai
Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. 

expect(), should(), assert() -style assertions







API interview questions

  https://www.katalon.com/resources-center/blog/web-api-testing-interview-questions/ Top 50+ Web API Testing Interview Questions [Ultimate l...