JS-Dev-101 practice question 12 of 25
A developer removes the HTML class attribute from the checkout button, so now it is simply: Checkout 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?
Full set: 148 questionsThe test result is a "false positive." The test fails (a "positive" result in defect detection), but it's a "false" alarm because the application's core functionality is not broken. The checkout button still exists and is functional. The test failure is caused by the test itself being brittle; it relies on a specific implementation detail (the class="blue") that has changed, rather than testing the button's actual behavior or existence in a more resilient way. This indicates a flaw in the test, not the code under test.
A. True negative: This would mean the test passed correctly, indicating no defect was found. The test failed.
B. True positive: This would mean the test correctly failed because the button was genuinely broken or missing, which is not the case here.
C. False negative: This would mean the test passed even though there was a real defect. The test did not pass.
1. University of Toronto, CSC301: Introduction to Software Engineering, Fall 2019. Lecture on "Software Testing 1", slide 23, defines False Positive as "Test fails, but no bug."
2. Jest Documentation, "Testing Web Frameworks" section often advises against testing implementation details to avoid brittle tests, which are a common cause of false positives. For example, using selectors that are less likely to change.
Keep practicing
Take the free JS-Dev-101 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other JS-Dev-101 practice questions
- Question 1A developer executes: document.cookie; document.cookie = 'key=John Smith'; What is the be…
- Question 2A developer is required to write a function that calculates the sum of elements in an arr…
- Question 3Given the code below: 01 const delay = async delay => { 02 return new Promise((resolve, r…
- Question 401 function Animal(size, type) { 02 this.type = type || 'Animal'; 03 this.canTalk = false…
- Question 5Refer to the code snippet: 01 let array = [1, 2, 3, 4, 4, 5, 4, 4]; 02 for (let i = 0; i …
- Question 6Code: 01 let array = [1, 2, 3, 4, 4, 5, 4, 4]; 02 for (let i = 0; i < array.length; i++) …
