tools Flashcards

1
Q

What is Maven?

A

Apache Maven is a software project management and comprehension tool that can manage a project’s build, reporting, and documentation from a central piece of information, making it a complete build lifecycle framework.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

A

archetypeArtifactId: a starter template to use for creating the basic project structure.
groupId, artifactId, and version: this combination enables you to identify an artifact uniquely. groupId is mostly the company’s domain reversed. For example, groupId of example.com is created as com.example. Version can be in format as ..-. For example, 1.0.0-SNAPSHOT or 1.0.0-RELEASE. Please follow the link for more information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
// Building project and running test 
mvn clean compile test surefire-report:report
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Gradle?

A

Gradle is an open-source build management system that allows you to build any software. It caches dependencies locally and downloads them in parallel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is configuration management? #

A

The framework should be able to read the configurable parameters from any of the sources and be able to change the behaviour of the features provided by the framework. The configuration can be picked up from files like .properties, .ini, .xml, .json, .yml, or .toml, or it can be picked up from the database or any other external sources. This will allow the framework to work independently and free from hard-coding, thus making it more extensible, robust, configurable and easily pluggable with any CI/CD tools.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Configuration hierarchy overview

A

The framework should bundle the default value for all the configurable parameters in a configuration file.
These default values should be overridable from a project-specific configuration file.
These project-specific configuration parameters should be overridable by passing as a JVM argument (i.e., -Dkey=value).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Designing the configuration manager

A

The reading of configuration files needs to happen only once. This can be achieved by using the Singleton Pattern for the creation of the file object.

The configuration file can be any of these formats: .properties, .ini, .xml, .json, .yaml, .toml.

We can use an appropriate library for reading the configuration files for fetching the configuration parameters.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Configuration overriding

A

First, the configuration will be looked up in the JVM arguments, so it can be passed from the command line
If the configuration is not passed through the command line, it will be looked up in the project-specific configuration file.
If the configuration parameter is not passed through the command line or a project-specific file, then it will fallback to the default configuration file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Logback

A

intended as a successor to the popular log4j project that is used for logging to console and file. The main advantage of using logback over log4j is that its internals has been re-written to perform about ten times faster and has a smaller memory footprint as well.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

logback hierarchy of logging levels

A

ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Using Logback in the project

A

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

private static final Logger LOG = LoggerFactory.getLogger(Main.class);

LOG.trace(“log trace”);
LOG.trace(“log trace with arguments ‘{}’”, “arg”);
LOG.warn(“log warn”);
LOG.warn(“log warn with arguments ‘{}’”, “arg”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

default TestNG reports

A

org. testng.reporters.SuiteHTMLReporter – generates a HTML reporter for suites.
org. testng.reporters.FailedReporter – generates testng-failed.xml containing only the failed tests.
org. testng.reporters.XMLReporter – generates summary of test output in xml format.
org. testng.reporters.EmailableReporter2 – generates a single-page HTML report emailable-report.html of the test results.
org. testng.reporters.JUnitReportReporter – generates Junit test output xml for each of the test suites.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

We can have our own reporters

A

by implementing org.testng.IReporter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Allure Framework

A

a flexible and lightweight test reporting tool that shows a very concise representation of test execution in a very intuitive web report.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Allure has few annotations for marking the life cycle of test execution.

A

@Step

@Attachment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

@Step

A

Any action that constitutes a testing scenario is marked with @Step.
a)
@Step(“opening base url”)
public void openUrl(String url) {}

B)
StepResult result = new StepResult().setName(“open base url”);
Allure.getLifecycle().startStep(UUID.randomUUID().toString(), result);
getLifecycle().updateStep(s -> s.setStatus(getStatus(e).orElse(Status.PASSED));

17
Q

@Attachment

A
a)
//method annotated with @Attachment should return either a String or byte[]
@Attachment(value = "adding log", type = "text/plain")
public String addAttachment() {
    return "hello";
}

b) Allure.getLifecycle().addAttachment(“adding log”, “text/plain”, “.txt”, “hello”);