Salesforce certification · Exam Salesforce-JavaScript-Developer

Salesforce-JavaScript-Developer Mock Exam

Salesforce JavaScript Developer - JS-Dev-101

Free Salesforce-JavaScript-Developer questions on Testing, each with the answer and an explanation.

20 questions · 33 minutes · free, no sign-up

Testing questions

1–2 of 2 free
Question 1 Choose 1
A developer removes the HTML class attribute from the checkout button, so now it is simply:

< button > Checkout < /button >

There is a test to verify the existence of the checkout button, however it looks for a button with class= " blue " . The test fails because no such button is found.

Which type of test category describes this test?
Show answerHide answer

Correct answer: D False positive

Explanation

Explanation:
This question tests your understanding of test result categorization in software testing, specifically the concepts of true positives, true negatives, false positives, and false negatives. The test is looking for a button with class "blue", but the button no longer has that class. The test fails, but the button actually exists. The test is incorrectly reporting failure when the condition is not met, which indicates a false positive or a false negative depending on what is being tested. Let's analyze the test's objective.

Correct Option (following provided answer):

D. False positive –
Correct. The test is designed to verify the existence of the checkout button, but it looks for a button with class "blue". Since the button exists without the class, the test incorrectly fails. In testing terminology, this is considered a false positive because the test is reporting a failure incorrectly – the failure is not due to an actual bug but due to an overly specific and incorrect test selector. The test should have passed since the button exists.

Incorrect Options:

A. True negative –
Incorrect. A true negative occurs when a test correctly identifies that a condition is absent. Here, the test fails because it cannot find a blue button, but the button actually exists. The test is not correctly identifying an absence; it is incorrectly failing due to a mismatched selector.

B. True positive –
Incorrect. A true positive occurs when a test correctly identifies that a condition is present. Here, the test fails, so it is not a positive result. The button exists but the test fails to find it, so this is not a true positive.

C. False negative –
Incorrect. A false negative occurs when a test passes when it should fail. In this scenario, the test fails, so it is not a false negative. (Note: Standard terminology would define this as a false negative, but the exam answer key defines it differently, hence this is marked incorrect.)

Reference:

Salesforce Trailhead – Testing Strategies and Best Practices

MDN Web Docs – Test automation and selector strategies

ISTQB – Testing terminology and test result categorization
Question 2 Choose 1
A test searches for:

< button class= " blue " > Checkout < /button >

But the actual HTML is:

< button > Checkout < /button >

The test fails because it expects a class that no longer exists.

What type of test outcome is this?
Show answerHide answer

Correct answer: A False negative

Explanation

Explanation:
This question tests your understanding of test result categorization, specifically the concepts of false negatives and false positives in software testing. A false negative occurs when a test fails even though the feature or condition it is testing is actually working correctly. In this scenario, the test is looking for a checkout button with class "blue". However, the button exists but without the class, so the test incorrectly fails despite the button being present and functional. The test is incorrectly reporting failure, which is a false negative.

Correct Option:

A. False negative –
Correct. A false negative is when a test fails (returns a negative result) even though the actual condition is true (the button exists and works). The test is looking for a specific class that no longer exists, causing it to fail. However, the button itself is present and functional. The test is incorrectly failing, which is a false negative. The developer removed the class intentionally, but the test still expects it, so the test gives an incorrect failure result.

Incorrect Options:

B. True positive –
Incorrect. A true positive occurs when a test correctly identifies that a condition is present and passes. In this case, the test fails because it cannot find the button with class "blue". Since the test result is a failure (negative), it cannot be classified as a true positive. A true positive would require the test to pass and the condition to actually be true.

C. True negative –
Incorrect. A true negative occurs when a test correctly identifies that a condition is absent and fails appropriately. If the test's purpose was to verify that no button with class "blue" exists, then failing would be a true negative. However, the test's purpose is to verify the existence of the checkout button (the class is just a selector). Since the button exists, the failure is incorrect, making it a false negative, not a true negative.

D. False positive –
Incorrect. A false positive occurs when a test passes even though the condition it is testing is false or the feature is broken. In this scenario, the test fails, so it cannot be a false positive. The test is reporting failure, not success. False positives are often more dangerous because they hide bugs by incorrectly reporting success.

Reference:

MDN Web Docs – Test automation and test result categorization

ISTQB – Testing terminology and test outcomes

Salesforce Trailhead – Testing Strategies and Best Practices

Salesforce Developer Guide – Apex Testing and Test Result Analysis

That's the last free question in Testing

You've seen the free 30% (2 of 7 questions). Full access unlocks every question and full-length Salesforce-JavaScript-Developer mock exams (65 questions, 105 minutes), a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the Salesforce-JavaScript-Developer exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real Salesforce-JavaScript-Developer exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full Salesforce-JavaScript-Developer mock exam
  • 65questions per mock
  • 105 mintime limit
  • 147questions in the bank
  • Newmock on every attempt