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. Monitoring computer networks
B. Designing graphical user interfaces
C. Editing relational database records
D. Building and managing Java projects

2 Which Maven feature automatically obtains required external libraries?

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

3 Which activity can Maven perform during a project build?

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

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

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

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

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

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

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

7 What does POM stand for in Maven?

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

8 Inside which POM element are project dependencies normally listed?

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

9 What is TestNG?

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

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

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

11 How can TestNG be added to a Maven project?

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

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

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

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

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

14 Why is TestNG commonly used with Selenium?

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

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

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

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

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

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

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

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

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

19 How can a TestNG class contain multiple test methods?

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

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

Prioritizing Tests Easy
A. @Test(priority = 1)
B. @BeforeMethod(priority = 1)
C. @Priority(test = 1)
D. @Test(order = 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. Managing the project build and dependencies
B. Designing web pages without source code
C. Recording browser screenshots during tests
D. Replacing the Java Development Kit

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. Manual browser configuration
D. Centralized dependency declarations

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

Activities Managed by Maven Medium
A. Compile, test, package, and install
B. Encrypt, decrypt, scan, and format
C. Record, crop, compress, and upload
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. Remote repository
B. Surefire assertion
C. Test listener
D. Java compiler cache

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. Maven's bin directory is missing from PATH
B. The project has no test class
C. The POM has no reporting section
D. The browser driver is not executable

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. Run TestNG without a project
B. Copy compiled classes manually
C. Create only a browser profile
D. Use a Maven project archetype

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

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

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 TestNG dependency and its scope
C. The browser window dimensions
D. The HTML report filename

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

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

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. Only method-level assertions
C. Mandatory use of XML test data
D. Automatic replacement of Selenium

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. Place a screenshot in the source folder
C. Copy the TestNG website into the project
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. @Run
B. @Test
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 Maven version number
B. Only the browser installation path
C. Only the source-code line count
D. Passed, failed, skipped, and timing details

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. @BeforeSuite and @AfterSuite
B. @BeforeClass and @AfterClass
C. @BeforeTest and @AfterTest
D. @BeforeMethod and @AfterMethod

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

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

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 install-testng
B. mvn compile-report
C. mvn clean-browser
D. mvn test

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. Reinstall the Java compiler
B. Open the generated TestNG report
C. Change all tests to priorities
D. Delete the target directory immediately

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

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

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

Validating Tests with Assertions Medium
A. Close the browser before reading the title
B. Print the title without comparing it
C. Wait for the page and ignore the title
D. Assert that the actual title equals 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?

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

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 all phases through install but omits deployment
B. Maven executes compile and package but skips all test phases
C. Maven executes only the package phase and creates the JAR
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. Change the artifact packaging from jar to pom
C. Run the Maven Clean Plugin twice before compiling the project
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. compile, test, package, install
B. validate, test, post-integration-test, deploy
C. generate-test-sources, test, verify, clean
D. package, pre-integration-test, integration-test, post-integration-test, verify

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:1.0, because the first equally near declaration wins
C. util:2.0, because Maven always selects the newest version
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 M2_HOME to the project's local repository
B. Set user.home to the Maven installation directory
C. Set JAVA_HOME to the intended JDK installation
D. Set MAVEN_OPTS to the dependency cache directory

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 repository; artifactId identifies the dependency scope
C. groupId identifies the lifecycle; artifactId identifies the active build profile
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 absent because dependency management does not add dependencies
C. TestNG is absent because managed dependencies apply only to plugins
D. TestNG is present with test scope supplied by Maven automatically

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. Main compilation fails, while TestNG remains available to test compilation
D. Both compilations fail because test-scoped artifacts are never resolved

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

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() twice
B. resetState() once and closeService() once
C. resetState() twice and closeService() once
D. resetState() twice 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. Subclass before methods run first; subclass after methods run last
B. Superclass before methods run first; superclass after methods run last
C. Superclass methods always run before every subclass configuration method
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. Store one driver per executing thread and clean it up after each test
B. Create one suite-level driver and assign higher test priorities
C. Keep the static driver and synchronize only calls to getTitle()
D. Reuse one browser window but create a new tab for each assertion

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. The suite XML configuration controls TestNG discovery for that execution
C. The command-line class always overrides every configured suite XML file
D. Surefire merges the class filter with all suite XML tests automatically

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 total execution duration and the alphabetical order of test methods
C. The Java source encoding and the number of compiled production classes
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 IMethodInterceptor and reorder discovered test methods
B. Implement IHookable and replace each test method's invocation
C. Implement IAnnotationTransformer and rewrite test priorities
D. Implement IReporter and process the completed suite results

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. HTML reports are created only when every TestNG test has passed
C. IDE TestNG and Maven Surefire runners can use different report directories
D. TestNG renames HTML reports whenever execution begins outside a terminal

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 fails immediately when the first soft assertion fails
C. The method may pass because collected failures are never reported
D. The method is skipped because soft assertions require a listener

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 records that invocation as failed and continues with remaining rows
B. It rolls back the first invocation and reruns all rows as one test
C. It aborts every remaining row because the method has already failed
D. It marks all four invocations skipped because they share one method

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 3 runs first, and the unspecified test receives maximum priority
B. The unspecified test runs first, and negative priorities are treated as disabled
C. Priority -2 runs first, and the unspecified test shares priority 0
D. Priority 0 runs first, and negative priorities are normalized to zero