Unit 6: Test Automation and Management/Reporting Frameworks - Practice Quiz

CSE376 — Automated Testing 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is Apache Maven primarily used for?

Introduction to Maven Easy
A. Editing relational database records
B. Building and managing Java projects
C. Designing graphical user interfaces
D. Monitoring computer networks

2 Which Maven feature automatically obtains required external libraries?

Benefits and Features of Maven Easy
A. Source encryption
B. Dependency management
C. Screen recording
D. Database replication

3 Which activity can Maven perform during a project build?

Activities Managed by Maven Easy
A. Manually reviewing every source file before execution
B. Creating database users
C. Drawing application wireframes
D. Compiling source code

4 Where does Maven usually store downloaded dependencies on the developer's computer?

Architecture of Maven Easy
A. Source directory
B. Remote application server
C. Local repository
D. Test directory

5 Which command is commonly used to verify that Maven is installed?

Installing/Configuring Maven Easy
A. mvn -version
B. java -maven
C. mvn -package
D. install mvn project and display every available lifecycle phase

6 Which Maven mechanism can generate a new project from a predefined template?

Creating Maven Project Easy
A. Archetype
B. Repository
C. Annotation
D. Assertion

7 What does POM stand for in Maven?

Understanding POM.xml File Easy
A. Program Output Manager
B. Package Operation Method
C. Project Object Model
D. Project Organization Mechanism

8 Inside which POM element are project dependencies normally listed?

Adding Dependencies to POM.xml Easy
A. <dependencies>
B. <developers>
C. <properties>
D. <repositories>

9 What is TestNG?

Introduction to TestNG Easy
A. A database management system
B. A browser exclusively designed to execute Selenium scripts
C. A Java testing framework
D. A Java code editor

10 Which capability is directly supported by TestNG for controlling test execution order?

TestNG vs JUnit Easy
A. SQL triggers
B. Test priorities
C. Java constructors
D. CSS selectors

11 How can TestNG be added to a Maven project?

Downloading and Installing TestNG Easy
A. Add a TestNG dependency to pom.xml
B. Add TestNG code to index.html
C. Install a separate operating system that includes all Java testing libraries
D. Rename the project folder to TestNG

12 Which annotation identifies a method as a TestNG test method?

Creating Test Cases Using TestNG Annotations Easy
A. @Execute
B. @Case
C. @Method
D. @Test

13 Which TestNG annotation runs a method before every test method?

Understanding Annotations of TestNG Easy
A. @BeforeMethod
B. @BeforeClass
C. @BeforeTest
D. @BeforeSuite

14 Why is TestNG commonly used with Selenium?

Need of TestNG in Selenium Easy
A. To organize and execute browser tests
B. To replace the browser's rendering engine
C. To create web page style sheets
D. To convert every Selenium command into a database query automatically

15 Which Maven command commonly runs the tests in a project?

Running the Test Easy
A. mvn test
B. mvn report-only
C. mvn dependency
D. mvn open

16 Which directory is commonly created by TestNG to store its default report files?

Checking Reports Created by TestNG Easy
A. test-output
B. pom-results
C. src-output
D. java-reports

17 Which file is commonly opened to view the main default TestNG HTML report?

Generating HTML Reports Easy
A. results.java
B. pom.xml
C. testing.properties
D. index.html

18 What is the purpose of an assertion in a TestNG test?

Validating Tests with Assertions Easy
A. To generate a complete application interface from the test output
B. To compare actual and expected results
C. To download browser installation files
D. To define Maven repository locations

19 How can a TestNG class contain multiple test methods?

Creating Multiple Tests Easy
A. Place every method in pom.xml
B. Use one constructor for each test
C. Create a separate Maven installation for every method
D. Mark each test method with @Test

20 Which TestNG syntax assigns priority 1 to a test method?

Prioritizing Tests Easy
A. @BeforeMethod(priority = 1)
B. @Test(priority = 1)
C. @Test(order = 1)
D. @Priority(test = 1)

21 A project contains Java source code, test code, and external libraries. What is Maven primarily used for in this project?

Introduction to Maven Medium
A. Recording browser screenshots during tests
B. Replacing the Java Development Kit
C. Managing the project build and dependencies
D. Designing web pages without source code

22 Two developers build the same Maven project on different machines. Which Maven feature most directly helps them use consistent library versions?

Benefits and Features of Maven Medium
A. Operating-system-specific scripts
B. Local variable naming rules
C. Centralized dependency declarations
D. Manual browser configuration

23 Which sequence best represents common activities managed by Maven during a software project lifecycle?

Activities Managed by Maven Medium
A. Encrypt, decrypt, scan, and format
B. Record, crop, compress, and upload
C. Compile, test, package, and install
D. Design, browse, print, and delete

24 A Maven build cannot find a declared library in the local repository. Which Maven architecture component is normally contacted next to obtain it?

Architecture of Maven Medium
A. Surefire assertion
B. Java compiler cache
C. Test listener
D. Remote repository

25 After installing Maven, the command mvn -version fails in a new terminal. Which configuration issue is the most likely cause?

Installing/Configuring Maven Medium
A. The project has no test class
B. The POM has no reporting section
C. The browser driver is not executable
D. Maven's bin directory is missing from PATH

26 A developer wants Maven to generate the standard directory structure and a starter POM automatically. Which approach is most appropriate?

Creating Maven Project Medium
A. Use a Maven project archetype
B. Create only a browser profile
C. Run TestNG without a project
D. Copy compiled classes manually

27 Which set of information is most commonly defined in a Maven pom.xml file?

Understanding POM.xml File Medium
A. Screenshots, cookies, and browser history
B. Operating-system users, passwords, and logs
C. Coordinates, dependencies, and build plugins
D. Keyboard shortcuts, themes, and fonts

28 A TestNG test fails to compile because the TestNG classes cannot be resolved. What should be checked first in the POM?

Adding Dependencies to POM.xml Medium
A. The Maven project display name
B. The HTML report filename
C. The TestNG dependency and its scope
D. The browser window dimensions

29 What is the main purpose of TestNG in an automated testing project?

Introduction to TestNG Medium
A. Organizing and executing automated tests
B. Replacing every browser automation library
C. Creating application database tables
D. Compiling the operating system kernel

30 A team needs to execute selected tests in groups and control their order with priorities. Which framework feature makes TestNG a suitable choice?

TestNG vs JUnit Medium
A. Groups and priority attributes
B. Automatic replacement of Selenium
C. Mandatory use of XML test data
D. Only method-level assertions

31 In a Maven-based project, what is generally the preferred way to make TestNG available to the test code?

Downloading and Installing TestNG Medium
A. Declare TestNG as a Maven dependency
B. Copy the TestNG website into the project
C. Place a screenshot in the source folder
D. Install TestNG as a browser extension

32 A method should be recognized by TestNG as an executable test method. Which annotation should be applied?

Creating Test Cases Using TestNG Annotations Medium
A. @Test
B. @Run
C. @Execute
D. @Case

33 After a TestNG suite finishes, what information is normally available in its generated report?

Creating Reports Using TestNG Medium
A. Only the browser installation path
B. Only the source-code line count
C. Passed, failed, skipped, and timing details
D. Only the Maven version number

34 A browser must be initialized before every test method and closed afterward. Which annotation arrangement is most appropriate?

Understanding Annotations of TestNG Medium
A. @BeforeTest and @AfterTest
B. @BeforeMethod and @AfterMethod
C. @BeforeClass and @AfterClass
D. @BeforeSuite and @AfterSuite

35 Why is TestNG commonly combined with Selenium in automated testing projects?

Need of TestNG in Selenium Medium
A. It organizes Selenium tests and provides execution controls
B. It converts every web page into Java code
C. It automatically fixes incorrect locators
D. It removes the need for browser drivers

36 A Maven project contains TestNG tests under the standard test source directory. Which command usually runs the project's test phase?

Running the Test Medium
A. mvn test
B. mvn compile-report
C. mvn clean-browser
D. 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?

Checking Reports Created by TestNG Medium
A. Open the generated TestNG report
B. Delete the target directory immediately
C. Reinstall the Java compiler
D. Change all tests to priorities

38 What is a practical advantage of an HTML report over raw console output for a test suite?

Generating HTML Reports Medium
A. It eliminates the need for test assertions
B. It presents results in a navigable visual format
C. It removes all test execution logs
D. It guarantees that failed tests will pass

39 A login test should fail when the page title is not Dashboard. Which assertion is most appropriate?

Validating Tests with Assertions Medium
A. Print the title without comparing it
B. Wait for the page and ignore the title
C. Assert that the actual title equals Dashboard
D. Close the browser before reading the title

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?

Creating Multiple Tests Medium
A. Maven skips compilation of the class
B. All failures are automatically hidden
C. The browser driver becomes unnecessary
D. Each behavior receives an independent result

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?

Introduction to Maven Hard
A. Maven executes only the package phase and creates the JAR
B. Maven executes compile and package but skips all test phases
C. Maven executes all phases through install but omits deployment
D. Maven executes every phase through 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?

Benefits and Features of Maven Hard
A. Move every dependency declaration into the parent project's profile
B. Run the Maven Clean Plugin twice before compiling the project
C. Change the artifact packaging from jar to pom
D. Configure the Maven Compiler Plugin with a fixed 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?

Activities Managed by Maven Hard
A. generate-test-sources, test, verify, clean
B. validate, test, post-integration-test, deploy
C. package, pre-integration-test, integration-test, post-integration-test, verify
D. 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?

Architecture of Maven Hard
A. Both versions, because transitive artifacts remain isolated
B. util:2.0, because Maven always selects the newest version
C. util:1.0, because the first equally near declaration wins
D. Neither version, because equal-depth conflicts fail the build

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?

Installing/Configuring Maven Hard
A. Set JAVA_HOME to the intended JDK installation
B. Set MAVEN_OPTS to the dependency cache directory
C. Set user.home to the Maven installation directory
D. Set 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?

Creating Maven Project Hard
A. groupId identifies the plugin prefix; artifactId identifies the packaging phase
B. groupId identifies the lifecycle; artifactId identifies the active build profile
C. groupId identifies the repository; artifactId identifies the dependency scope
D. 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?

Understanding POM.xml File Hard
A. TestNG is present with compile scope inherited from the parent
B. TestNG is present with test scope supplied by Maven automatically
C. TestNG is absent because managed dependencies apply only to plugins
D. TestNG is absent because dependency management does not add dependencies

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?

Adding Dependencies to POM.xml Hard
A. Main compilation succeeds, while TestNG is excluded from test execution
B. Both compilations succeed, but TestNG is omitted only from packaging
C. Both compilations fail because test-scoped artifacts are never resolved
D. Main compilation fails, while TestNG remains available to test compilation

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?

TestNG vs JUnit Hard
A. @Factory(dataProvider = "authenticate")
B. @BeforeMethod(dependsOnGroups = "authenticate")
C. @Test(dependsOnMethods = "authenticate")
D. @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?

Downloading and Installing TestNG Hard
A. Reinstall the IDE plugin and clear the editor's layout cache
B. Declare TestNG as a report plugin in Maven's reporting section
C. Declare TestNG as a test-scoped dependency in pom.xml
D. Add TestNG's JAR directory only to the operating system 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?

Creating Test Cases Using TestNG Annotations Hard
A. resetState() once and closeService() once
B. resetState() twice and closeService() twice
C. resetState() twice and closeService() once
D. 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?

Understanding Annotations of TestNG Hard
A. Superclass methods always run before every subclass configuration method
B. Superclass before methods run first; superclass after methods run last
C. Subclass before methods run first; subclass after methods run last
D. Subclass methods always run before every superclass configuration method

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?

Need of TestNG in Selenium Hard
A. Reuse one browser window but create a new tab for each assertion
B. Create one suite-level driver and assign higher test priorities
C. Keep the static driver and synchronize only calls to getTitle()
D. Store one driver per executing thread and clean it up after each test

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?

Running the Test Hard
A. Maven ignores both selectors and scans every compiled production class
B. Surefire merges the class filter with all suite XML tests automatically
C. The command-line class always overrides every configured suite XML file
D. The suite XML configuration controls TestNG discovery for that execution

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?

Checking Reports Created by TestNG Hard
A. The generated artifact name and the Maven dependency resolution order
B. The Java source encoding and the number of compiled production classes
C. The total execution duration and the alphabetical order of test methods
D. Separate failed-test and failed-configuration entries with their stack traces

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?

Creating Reports Using TestNG Hard
A. Implement IHookable and replace each test method's invocation
B. Implement IAnnotationTransformer and rewrite test priorities
C. Implement IReporter and process the completed suite results
D. Implement 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?

Generating HTML Reports Hard
A. Surefire stores HTML output exclusively inside the local artifact repository
B. TestNG renames HTML reports whenever execution begins outside a terminal
C. HTML reports are created only when every TestNG test has passed
D. IDE TestNG and Maven Surefire runners can use different report directories

58 A TestNG test uses SoftAssert for five independent checks. Two checks fail, but the method never calls assertAll(). What result should be expected?

Validating Tests with Assertions Hard
A. The method fails automatically after the final assertion statement
B. The method is skipped because soft assertions require a listener
C. The method may pass because collected failures are never reported
D. The method fails immediately when the first soft assertion fails

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?

Creating Multiple Tests Hard
A. It marks all four invocations skipped because they share one method
B. It aborts every remaining row because the method has already failed
C. It rolls back the first invocation and reruns all rows as one test
D. It records that invocation as failed and continues with remaining rows

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?

Prioritizing Tests Hard
A. Priority 0 runs first, and negative priorities are normalized to zero
B. Priority 3 runs first, and the unspecified test receives maximum priority
C. The unspecified test runs first, and negative priorities are treated as disabled
D. Priority -2 runs first, and the unspecified test shares priority 0