wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Nodejs - Testing

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is testing?

a)

an activity to check whether the actual results match the expected results

b)

an activity to check whether the expected results match the initial results

c)

an activity to check whether the initial results match the actual results

d)

none of the options

2.

What is the purpose of a test runner?

a)

to write test cases

b)

to execute test cases

c)

to set up mock data

d)

to debug the code

3.

which library/framework can we use to test out nodejs app

a)

node-tester

b)

testy-node

c)

jest

d)

node-jester

4.

when using jest, what module can we use with it to test HTTP request and responses

a)

supertest

b)

requester

c)

jest-request

d)

test-request

5.

which of the following command is used to run tests(test runner)

a)

npm jest

b)

npm test

c)

npm runner

d)

npm pretest

6.

in Jest, what keyword is used to define a test case?

a)

should

b)

it

c)

expect

d)

describe

7.

in Jest, what keyword is used to define a test suite?

a)

should

b)

it

c)

expect

d)

describe

8.

Which of the following is not a hook in jest?

a)

beforeEach

b)

beforeAll

c)

after

d)

afterAll

9.

What is the purpose of hooks in testing?

a)

abstract complex behaviour from test cases

b)

configure test cases to meet certain requirements

c)

setup mocks and global variables for other test cases

d)

All of the options

10.

which of the following is not a type of testing?

a)

unit testing

b)

integration testing

c)

end-to-end testing

d)

complex testing

11.

unit testing tests individual units of code, while integration testing _______

a)

tests code coverage

b)

tests for syntax error

c)

tests for interactions between parts of the application

d)

tests for integral changes

12.

why do we always do a cleanup of the database for every test case?

a)

to remove all the data in the database

b)

to avoid confilcts on the data when running tests cases

c)

all of the options

13.

which of the following is not something we can write test for?

a)

response status code

b)

structure of the body/data of response

c)

values from the request body matches what the database needs

d)

none of the options

14.

```const response = await supertest(app)

.post('/users/signup')```


From the code above, which of the following is not correct

a)

we are testing the endpoint of /users/signup

b)

the endpoint is using a POST method

c)

app is an instance of Express

d)

none of the options

15.

which of the following is an assertion keywords in Jest?

a)

it

b)

describe

c)

expect

d)

assertThat