Analyzing and Testing Code Flashcards

1
Q

What is the technical point of view regarding ATC check variants?

A

They are ABAP development objects. Therefore they do belong to development packages and can be transported to other systems.

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

What is the purpose of creating an ATC check variant?

A

The purpose is to specify which checks should be performed on ABAP code within a specific context or project.

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

How do you create a new ATC check variant?

A

Navigate to the ABAP repository object, type “ATC” in the filter field (file -> new -> other) to find and choose ATC check variant. Enter the name and description of the check variant, ensure the required transport request is selected, and choose “Finish”.

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

What steps are involved in configuring an ATC check variant?

A

Select the desired checks to be performed in the Checks view.

Expand “Note Syntax and Activation” and choose specific checks, e.g., “Extended Program Check SLIN”.

Edit the parameters of the selected checks in the Parameters tab, adjusting values as necessary.

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

What does changing the value from 1 to 2 in the Parameters tab of the check detail view accomplish?

A

It adjusts the behavior of the selected check, potentially expanding the scope or stringency of the check.

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

What is the purpose of the Extended Check in ABAP Development?

A

The Extended Check complements the Syntax Check by offering optional source code checks. It provides additional checks beyond basic syntax validation.

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

How does the ABAP Test Cockpit (ATC) enhance the functionality of the Extended Check?

A

ATC offers a wide range of checks beyond syntax validation, including performance, security, adherence to guidelines, and programming conventions. The functionality of the Extended Check is integrated into ATC as one of many available checks.

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

What are Pseudo Comments and Pragmas used for in ABAP development?

A

Pseudo Comments and Pragmas are used to suppress certain findings generated by ABAP Test Cockpit (ATC), allowing developers to ignore non-critical or false alarm issues.

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

How are Pseudo Comments used to suppress ATC findings?

A

Pseudo Comments are specific comments added at the end of source code lines containing the finding. For example, “#EC NEEDED” is used to suppress Extended Check findings. Pseudo Comments are not visible to the ABAP syntax check or compiler but influence ATC.

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

What is the purpose of Pragmas in suppressing ATC findings?

A

Pragmas are keywords starting with ## that are added within ABAP statements to suppress specific findings. Pragmas are placed inside the ABAP statement, not after it. For example, pragma “##needed” is used to suppress certain findings.

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

How do Pragmas differ from Pseudo Comments in terms of visibility to the ABAP syntax check?

A

Pragmas are visible to the ABAP syntax check, allowing them to suppress certain warnings from the syntax check. Pseudo Comments, however, are not visible to the syntax check or compiler.

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

Where can developers find information on which technique to use for suppressing a specific ATC finding?

A

Developers can find details on ATC findings in the ATC Problems view. This view provides information on which technique, either Pseudo Comments or Pragmas, should be used to suppress a given finding.

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

What distinguishes a test class from an ordinary ABAP class?

A

A test class is distinguished by the addition “FOR TESTING” in the class definition.

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

What is the purpose of the “RISK LEVEL” addition in a test class?

A

The “RISK LEVEL” addition assigns a risk level to the test. It helps in categorizing the test based on its impact on system settings or persistent data.

The available risk level values are:

CRITICAL
DANGEROUS
HARMLESS

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

What is the purpose of the “DURATION” addition in a test class?

A

The “DURATION” addition specifies the expected execution time of the test. It helps in setting upper runtime limits for tests.

The available duration values are:

SHORT
MEDIUM
LONG

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

What is the requirement for a test class in ABAP Unit?

A

A test class should contain at least one test method. A test method must not have any parameters.

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

Where should local test classes be defined when inside a global ABAP class?

A

Local test classes should be defined on the Test Classes tab, unlike ordinary local classes which are defined on the Local Types tab.

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

What is the purpose of the global service class CL_ABAP_UNIT_ASSERT?

A

CL_ABAP_UNIT_ASSERT is used to report errors and influence test execution in ABAP Unit tests.

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

How is the method “fail()” of CL_ABAP_UNIT_ASSERT typically used?

A

The “fail()” method reports an unconditional error. It is usually surrounded by a control structure (e.g., IF…ENDIF or TRY…ENDTRY) to ensure it is reached under a specific condition.

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

What are the types of methods provided by CL_ABAP_UNIT_ASSERT to check expectations?

A

Methods starting with “assert_” check on a certain expectation and report an error if this expectation is not met.

21
Q

What does the method “assert_equals()” of CL_ABAP_UNIT_ASSERT do?

A

The “assert_equals()” method compares the content of two data objects and reports an error if they differ.

22
Q

How does the method “assert_differs()” of CL_ABAP_UNIT_ASSERT differ from “assert_equals()”?

A

The “assert_differs()” method also compares the content of two data objects, but it reports an error if the data objects have the same content.

23
Q

How do you create a local test class with unit tests?

A

Navigate to the tab “Test Classes” (below your code where you also find local types and global class)

Type “test” and invoke code completion with ctrl+space

The name of the testclass should start with “ltcl_”

24
Q

What is the recommended naming convention for a local test class in ABAP Unit?

A

The recommended naming convention is to start the name of the test class with “LTCL_” to identify it as a test class.

25
Q

How can you execute unit tests?

A

Locate the repository object containing the tests in the Project Explorer view.
Right-click the repository object to open the context menu.
Choose “Run As” -> “ABAP Unit Test”.

26
Q

What happens if you open the context menu for a package instead of a global class in ADT?

A

If you open the context menu for a package, all tests found in repository objects of this package are executed.

27
Q

How can you perform ABAP Unit tests as part of an ATC run?

A

To perform ABAP Unit tests as part of an ATC run, you need to create a check variant and choose “Dynamic Code Checks” -> “ABAP Unit Check”.

28
Q

What is the purpose of integrating the ATC test framework into the ABAP Test Cockpit (ATC)?

A

The integration allows for mass tests, enabling developers to run multiple tests efficiently and systematically.

29
Q

What is the difference between ABAP Test Cockpit and ABAP Unit tests?

A

ABAP Test Cockpit (ATC) is a framework integrated into the ABAP Development Tools (ADT) for performing various types of static code checks and mass tests, including ABAP Unit tests as part of an ATC run. ABAP Unit tests, on the other hand, are specific tests written by developers to validate the behavior of individual units of ABAP code, typically executed within the ABAP Unit framework itself.

30
Q

What is a test fixture in software testing?

A

A test fixture refers to a predefined configuration required for a test to run properly. It may include test data, objects, and resources.

31
Q

What are the methods used for test fixtures in ABAP Unit?

A

SETUP(): This instance method is called before each test of the test class to create fixtures that need to be recreated for each test.

TEARDOWN(): This instance method is called after each test of the test class to undo the changes made in SETUP(). It’s crucial for reverting changes made to persistent data.

CLASS_SETUP(): This static method is executed once before the first test of the test class. It’s used for fixtures that are time-consuming and not changed by any test methods.

CLASS_TEARDOWN(): This static method is executed once after the last test of the test class. It’s used to undo changes made in CLASS_SETUP().

32
Q

What is the program flow of ABAP Unit for a single test class?

A

1 The test class is loaded into program memory.

2 If the test class contains a static constructor (CLASS_CONSTRUCTOR), it’s executed.

3 Each test starts with the creation of an instance of the test class.

4 If the test class contains an instance constructor (CONSTRUCTOR), it’s executed.

5 The ABAP Unit framework calls the test method.

6 After the test, the instance is discarded. If there are multiple test methods, a new instance is created for each test.

7 After the last test method, the processing of the test class is finished, and the framework moves to the next test class, if any.

33
Q

What should you do in case of a missing prerequisite in an ABAP Unit test?

A

In case of a missing prerequisite, such as missing authorizations or problems with the SETUP method, you can use methods skip() and ASSUME_ from class CL_ABAP_UNIT_ASSERT. These methods are counted as aborted tests and are displayed differently in the UNIT test result to distinguish them from errors in the tested coding.

34
Q

How does the method skip() from class CL_ABAP_UNIT_ASSERT differ from fail() in terms of test result display?

A

The method skip() is counted as an aborted test and is displayed with “Missing Prerequisites” in front of the message text in the Failure Trace, while fail() is counted as a failed test and is displayed with “Critical Assertion Error” in front of the message text.

35
Q

What features are available for analyzing performance using the ABAP Profiler?

A
  1. Identify runtime-expensive statements.
  2. Identify performance hot spots for refactoring efforts.
  3. Compare performance of different implementations.
  4. Analyze call hierarchy in the application.
  5. Identify excessive use of modularization units.
  6. Identify repeated database operations, like SELECT statements in loops.
  7. Identify accessed database objects (tables and views).
36
Q

How can you start the ABAP Profiler for an ABAP program?

A

You can start the ABAP Profiler directly from the ABAP source code editor or from the Project Explorer view.

right click in code -> profile as

37
Q

What are the trace parameters used to configure the ABAP Profiler?

A

Aggregation Settings: Determines trace handling for repeated executions, affecting file size and tool availability.
- No aggregation: Largest file size, all tools.
- Partial aggregation: Medium size, Call Sequence unavailable.
- Full aggregation: Smallest size, Aggregated Call Tree unavailable.

Statement Granularity: Controls measurement detail level, impacting file size and information.
- Only procedural units: Small size, runtime attributed to units.
- Procedural units, SQL: Medium size, separate database access tracing.
- Procedural units, SQL, internal tables: Large size, separate DB and table operation tracing.

Start option: Determines trace initiation timing.
- Immediately: Trace begins with program execution.
- Explicit switch on/off: Starts with trace off, can switch on at breakpoint.

38
Q

What are the components of the ABAP Profiling perspective?

A

Editor Area: Displays trace results.

Trace Area: Contains views for trace results and request management.

Details Area: Displays metadata during object focus and runtime measurement properties during analysis.

39
Q

What is the Condensed Hit List in ABAP Trace Analysis Tools?

A

Purpose: Identifies costly procedural units (e.g., methods).

Content: Aggregated runtime data for procedural units, excluding database accesses.

Columns:
Executions and Callers: Total executions and unique call positions.
Total Time: Overall runtime, including all calls.
Own Time: Runtime excluding wait time for other units and specified ABAP statements.

40
Q

What is the purpose of the SQL Trace?

A

The SQL Trace is utilized to monitor the traffic between the ABAP system and the database comprehensively.

41
Q

How do you activate the SQL trace?

A

To activate the SQL trace, right-click on the project, select “SQL trace” from the context menu, and choose “Activate.”

42
Q

What does the Aggregated Call Tree allow you to analyze?

A

The Aggregated Call Tree reveals the sequence of procedural unit calls, highlighting repetitions. It provides insights into the call hierarchy and helps identify performance patterns.

43
Q

What is the purpose of the Aggregated Timeline in ABAP trace analysis?

A

The Aggregated Timeline visualizes call sequences and durations, facilitating the identification of performance trends and bottlenecks. It offers an overview of trace events and their respective timings.

44
Q

How does the Database Accesses tool assist in ABAP trace analysis?

A

The Database Accesses tool identifies accessed database objects and top consumers among database interactions. It displays SQL statement runtimes, execution counts, and their impact on overall runtime, aiding in performance optimization.

45
Q

True or False? The SQL Trace Analysis is displayed in Eclipse IDE.

A

False.

The SQL Trace Analysis is not displayed in Eclipse IDE. It is part of the Technical Monitoring Cockpit and is displayed in a browser.

46
Q

After profiling an ABAP application you want to analyze the sequence in which procedural units were called. Which of the following trace analysis tools do you go to?

A
Aggregated Call Tree

B
Database Accesses

C
Condensed Hit List

A

A

That is correct. The Aggregated Call Tree allows you to analyze the sequence in which procedural units were called.

47
Q

Your ATC check finds a variable text that is not used statically. You want to suppress this finding using either a pseudo-comment or a pragma. Which of the following options are syntactically correct?

A
DATA text TYPE string. “#EC NEEDED

B
DATA text TYPE string “#EC NEEDED .

C
DATA text TYPE string. ##needed

D
DATA text TYPE string ##needed .

A

A
DATA text TYPE string. “#EC NEEDED
D
DATA text TYPE string ##needed .

Pseudo comment “#EC NEDDED has to be placed after the delimiter (the period sign). Pragma ##needed is part of the statement and has to be placed before the delimiter.

48
Q

For which of the following analysis tools does ABAP Development Tools provides a dedicated perspective?

A
ABAP Test Cockpit

B
ABAP Debugger

C
ABAP Unit

D
ABAP Profiling

A

B
ABAP Debugger

D
ABAP Profiling

49
Q
A