Unit 6: Test Automation and Management/Reporting Frameworks - Practice Quiz
1 What is Apache Maven primarily used for?
2 Which Maven feature automatically obtains required external libraries?
3 Which activity can Maven perform during a project build?
4 Where does Maven usually store downloaded dependencies on the developer's computer?
5 Which command is commonly used to verify that Maven is installed?
6 Which Maven mechanism can generate a new project from a predefined template?
7 What does POM stand for in Maven?
8 Inside which POM element are project dependencies normally listed?
<dependencies>
<developers>
<properties>
<repositories>
9 What is TestNG?
10 Which capability is directly supported by TestNG for controlling test execution order?
11 How can TestNG be added to a Maven project?
pom.xml
index.html
12 Which annotation identifies a method as a TestNG test method?
@Execute
@Case
@Method
@Test
13 Which TestNG annotation runs a method before every test method?
@BeforeMethod
@BeforeClass
@BeforeTest
@BeforeSuite
14 Why is TestNG commonly used with Selenium?
15 Which Maven command commonly runs the tests in a project?
mvn test
mvn report-only
mvn dependency
mvn open
16 Which directory is commonly created by TestNG to store its default report files?
test-output
pom-results
src-output
java-reports
17 Which file is commonly opened to view the main default TestNG HTML report?
results.java
pom.xml
testing.properties
index.html
18 What is the purpose of an assertion in a TestNG test?
19 How can a TestNG class contain multiple test methods?
pom.xml
@Test
20 Which TestNG syntax assigns priority 1 to a test method?
@BeforeMethod(priority = 1)
@Test(priority = 1)
@Test(order = 1)
@Priority(test = 1)
21 A project contains Java source code, test code, and external libraries. What is Maven primarily used for in this project?
22 Two developers build the same Maven project on different machines. Which Maven feature most directly helps them use consistent library versions?
23 Which sequence best represents common activities managed by Maven during a software project lifecycle?
24 A Maven build cannot find a declared library in the local repository. Which Maven architecture component is normally contacted next to obtain it?
25
After installing Maven, the command mvn -version fails in a new terminal. Which configuration issue is the most likely cause?
26 A developer wants Maven to generate the standard directory structure and a starter POM automatically. Which approach is most appropriate?
27
Which set of information is most commonly defined in a Maven pom.xml file?
28 A TestNG test fails to compile because the TestNG classes cannot be resolved. What should be checked first in the POM?
29 What is the main purpose of TestNG in an automated testing project?
30 A team needs to execute selected tests in groups and control their order with priorities. Which framework feature makes TestNG a suitable choice?
31 In a Maven-based project, what is generally the preferred way to make TestNG available to the test code?
32 A method should be recognized by TestNG as an executable test method. Which annotation should be applied?
@Test
@Run
@Execute
@Case
33 After a TestNG suite finishes, what information is normally available in its generated report?
34 A browser must be initialized before every test method and closed afterward. Which annotation arrangement is most appropriate?
@BeforeTest and @AfterTest
@BeforeMethod and @AfterMethod
@BeforeClass and @AfterClass
@BeforeSuite and @AfterSuite
35 Why is TestNG commonly combined with Selenium in automated testing projects?
36 A Maven project contains TestNG tests under the standard test source directory. Which command usually runs the project's test phase?
mvn test
mvn compile-report
mvn clean-browser
mvn install-testng
37 A test run reports one failure, but the console output is insufficient to identify the failed assertion. What is the best next action?
38 What is a practical advantage of an HTML report over raw console output for a test suite?
39
A login test should fail when the page title is not Dashboard. Which assertion is most appropriate?
Dashboard
40 A test class contains separate methods for valid login, invalid login, and logout. What is the main benefit of keeping them as separate TestNG tests?
41
A Maven project declares no custom lifecycle bindings and uses standard jar packaging. A developer runs mvn package. Which outcome correctly describes Maven's lifecycle behavior?
package phase and creates the JAR
compile and package but skips all test phases
install but omits deployment
package in lifecycle order
42 Two developers build the same project on clean machines. Maven downloads identical dependency versions, but compilation still differs because each machine uses a different JDK. Which change most directly improves build reproducibility?
jar to pom
release value
43 A project passes unit tests but its integration tests require the packaged application to be started before testing and stopped afterward. Which Maven phase sequence best models this requirement?
generate-test-sources, test, verify, clean
validate, test, post-integration-test, deploy
package, pre-integration-test, integration-test, post-integration-test, verify
compile, test, package, install
44
Project app depends on lib-a:1.0 and lib-b:1.0. lib-a depends on util:1.0, while lib-b depends on util:2.0; both paths to util have equal depth. lib-a is declared first in app's POM. With no dependency management entry, which version is selected?
util:2.0, because Maven always selects the newest version
util:1.0, because the first equally near declaration wins
45
Running mvn -version reports Maven correctly but shows a Java runtime different from the one intended for builds. Which configuration should be corrected first?
JAVA_HOME to the intended JDK installation
MAVEN_OPTS to the dependency cache directory
user.home to the Maven installation directory
M2_HOME to the project's local repository
46
A generated Maven project has coordinates com.example:checkout-tests:1.0-SNAPSHOT. Which statement correctly distinguishes its groupId and artifactId?
groupId identifies the plugin prefix; artifactId identifies the packaging phase
groupId identifies the lifecycle; artifactId identifies the active build profile
groupId identifies the repository; artifactId identifies the dependency scope
groupId identifies the organization namespace; artifactId identifies the project artifact
47
A parent POM places testng:7.10.2 inside dependencyManagement, but a child POM contains no TestNG entry under dependencies. What is the resulting child classpath?
48
A TestNG dependency is declared with scope set to test. A class under src/main/java imports org.testng.Assert, while tests also import it. What should happen during a standard Maven build?
49 A legacy test platform must declare that one test method depends on the successful completion of another and should be skipped automatically if the prerequisite fails. Which TestNG feature directly expresses this requirement?
@Factory(dataProvider = "authenticate")
@BeforeMethod(dependsOnGroups = "authenticate")
@Test(dependsOnMethods = "authenticate")
@Test(priority = 1, expectedExceptions = Exception.class)
50
A Maven project has the TestNG IDE plugin installed, but mvn test reports that org.testng.annotations.Test cannot be resolved during test compilation. Which action addresses the actual build configuration problem?
reporting section
pom.xml
PATH
51
A TestNG class defines @BeforeClass openService(), @BeforeMethod resetState(), two enabled @Test methods, @AfterMethod captureResult(), and @AfterClass closeService(). Assuming no failures, how many times are resetState() and closeService() invoked?
resetState() once and closeService() once
resetState() twice and closeService() twice
resetState() twice and closeService() once
resetState() once and closeService() twice
52
A superclass and subclass both define @BeforeClass and @AfterClass configuration methods. When TestNG runs tests from the subclass, which ordering is expected?
53
A Selenium suite is changed to run TestNG methods in parallel. Tests intermittently control one another's browser because all methods share a static WebDriver. Which design best isolates concurrent sessions?
getTitle()
54
Maven Surefire is configured with <suiteXmlFiles> pointing to smoke.xml. A developer runs mvn test -Dtest=CheckoutTest. Assuming the suite file remains configured, which selection rule is the most reliable conclusion?
55 A test method fails, but its cleanup method also throws an exception. When reviewing TestNG output, which report information is most important for distinguishing the original test failure from the configuration failure?
56 A team needs a custom report containing one record per completed test, including status, duration, and throwable details, after the entire suite has finished. Which TestNG extension is the best fit?
IHookable and replace each test method's invocation
IAnnotationTransformer and rewrite test priorities
IReporter and process the completed suite results
IMethodInterceptor and reorder discovered test methods
57
Tests run successfully from an IDE and TestNG generates test-output/index.html, but the team expects the same file under Maven's target/surefire-reports. Which explanation best accounts for the mismatch?
58
A TestNG test uses SoftAssert for five independent checks. Two checks fail, but the method never calls assertAll(). What result should be expected?
59
A @DataProvider supplies four rows to one @Test method. The second invocation fails, and no dependencies or retry analyzer are configured. What is TestNG's normal behavior?
60
A TestNG class contains tests with priorities -2, 0, and 3, plus one test with no explicit priority. Ignoring dependencies and parallel execution, which statement is correct?
0 runs first, and negative priorities are normalized to zero
3 runs first, and the unspecified test receives maximum priority
-2 runs first, and the unspecified test shares priority 0
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →