Functional testing

 Functional testing


Functional testing is a type of testing that involves testing the functionality of a software application. Functional testing ensures that the software application meets the specified requirements and performs as intended. Here is an example of a functional test written in JavaScript using the Jest library:

scss


const { sum } = require('./sum');


describe('sum function', () => {

  test('adds 1 + 2 to equal 3', () => {

    expect(sum(1, 2)).toBe(3);

  });

  

  test('adds -1 + 2 to equal 1', () => {

    expect(sum(-1, 2)).toBe(1);

  });

});

In this example, we define a function sum that takes two arguments and returns their sum. 

No comments:

Post a Comment

The Importance of Cybersecurity in the Digital Age

 The Importance of Cybersecurity in the Digital Age Introduction: In today's digital age, where technology is deeply intertwined with ev...