3

ABAP Test Cockpit (ATC) for Developers in Eclipse

 7 months ago
source link: https://community.sap.com/t5/application-development-blog-posts/abap-test-cockpit-atc-for-developers-in-eclipse/ba-p/13113248
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

OlgaDolinskaja

Product and Topic Expert

‎11-03-2014 8:49 AM

Good news for ABAP Development Tools developers in Eclipse: ABAP Test Cockpit (ATC) is available in Eclipse with ADT 2.31. For those of you, who are not familiar with ABAP Test Cockpit, it is a toolset, which allows you to significantly improve the code quality during development process. With ATC you can detect the quality issues with regard to performance, security, programming conventions by regular executing static and dynamic (ABAP Unit) checks (of course you can reuse your Code Inspector backend check infrastructure). A very good general overview about ATC is offered in the blog ABAP Test Cockpit – an Introduction to SAP’s new ABAP Quality Assurance Tool .

The ATC in Eclipse is tightly integrated with ABAP developer tools so that you can run ATC checks during development from the Project Explorer or editor and adjust the quality findings consequently by stepping to the relevant source code lines in the editor and correcting them one by one. You can also check with ATC your transport requests in the Transport Organizer before releasing them. And last but not least you can keep the eye on the central check results from your Q system and correct the reported quality findings.

The live demonstration (video) of the ABAP Test Cockpit tools in Eclipse is now on ABAP Channel in YouTube:

Let’s take a look at the brand new ATC tools in Eclipse in detail.

Check the quality of your source code

It’s quite simple. You can run ATC for a single object in the editor or select multiple objects or even packages using context menu
'Run As-> ABAP Test Cockpit'.

atc_check_568755.png


The tool of choice to analyse the quality issues is the ATC Problems View. It displays the worklist of ATC findings for you as developer to work on. By default the findings are grouped by priority: errors, warnings, information. Clicking on a finding displays its detailed information.The check variant is displayed in the breadcrumb (if required, change the variant in the project properties under ABAP Development).
atc_variant_568756.png
In the breadcrumb you can filter the findings in the ATC Problems View and in this way restrict the view to the findings you need to focus on for correction. You can concentrate your correction work for example on the findings, belonging to the last check run (‘Last Check Run’ entry), package, transport request, or recheck of result from the central Q system. Every time you run ATC, the breadcrumb gets a new filter entry if required (e.g. if a new package is checked) and the findings will be added to your worklist.
atc_filter_568757.png
As soon as you correct a finding, it disappears from your worklist after recheck.
atc_recheck_568758.png
There might be also such situations where a correction of the finding is not possible or not appropriate (e.g. the hard-corded text message, which is not relevant for translation). In such situations the ABAP Test Cockpit offers the possibility to create exemptions for the affected source code parts so that the findings will be hidden from the results. But you can still display them by using the display option ‚Include Exempted Findings’.

atc_exempted_568759.png


Create the exemption by right-clicking on the finding. You need to enter your quality expert (use content assist Ctrl + Space), reason for exemption and justification. As soon as your quality expert approves it, the finding will be marked accordingly in ATC results and will not appear in your worklist.
atc_exemption_568782.png
You can also customize the view on the findings in ATC Problems View and group the findings by priority, objects or checks for your convenience or configure the columns.
atc_grouping_568783.png
Ideally you should run ATC and correct the findings in the ATC Problems View on a regular base during your development process.

Check your transports before release

It is recommended to check regular with ATC your transport requests before release to catch erroneous situations and avoid transporting the source code with quality problems into quality and production systems. This can be done in the Transport Organizer View in Eclipse. There you can choose your transport request and run ATC using context menu ‘Run As->ABAP Test Cockpit’.

atc_transports_568784.png


After execution of ATC checks you will be redirected to the ATC Problems View, where you can focus on the findings, reported for this transport request and get rid of all of them one by one (btw. the new filter entry for the selected transport request will be added to the breadcrumb).

Access ATC results from the central Q system

After your quality expert runs mass (regression) quality checks with the ATC, the results of these checks will be published to the development systems as the current, active ATC result. You as developer can use this central result to eliminate quality problems. You can access the ATC results from the central Q system in the ATC Result Browser (menu 'Window ->Show view->Other...->ATC Result Browser'). You can select the active ATC result on the left and display the findings of the result on the right.
atc_qresults_568799.png
You can also select the active check run and press 'Show Details' button to display its details.

atc_show_details_568800.png

You will get the same information as in the ATC Problems View. Of course you can customize the view by configuring the view columns or group the findings as in the ATC Problems View. Before you start to correct findings execute recheck to make sure they still are relevant.You can rerun ATC checks and consequently correct the remaining findings belonging to the check run result in the ATC Problems View (btw. the new filter entry for the result will be added to the breadcrumb) .

That’s it. Just try out the new ABAP Test Cockpit tools in Eclipse to increase the quality of your source code during development.

For quick and easy try copy & paste this ATC_EXAMPLE report into your system and run ATC for it.

REPORT ATC_EXAMPLE.

parameters p_selall
type abap_bool default 'X'.

class lcl_atc_example definition.

public section.

methods run.

endclass.

class lcl_atc_example implementation.

method run.

data:

lt_spfli    type spfli,

lv_flight   type sflight.

" ATC ERROR:           Incompatible parameter in the function call

"                      lt_spfli(type SPFLI) with the function signature

"                      parameter (type SPFLI_TAB)

" PROPOSED CORRECTION: replace in the DATA section TYPE spfli with spfli_tab.

if ( p_selall = abap_true ).

call function 'READ_SPFLI_INTO_TABLE'

exporting

id = 'AA'

importing

itab = lt_spfli.

endif.

" ATC ERROR:           Strings without text elements are not translated

" PROPOSED CORRECTION: Create text element using Quick Fix Ctrl + 1

message 'Display flight information' type 'I'.

" ATC ERROR:           Performance check SELECT accesses the non-buffered

"                      table SFLIGHT with WHERE condition,

"                      which doesn’t contain any key fields of the table.

" PROPOSED CORRECTION: SELECT * FROM sflight INTO lv_flight

"                      WHERE carrid = 'AA' AND seatsmax = 10.

select * from sflight into lv_flight where seatsmax = 10.

endselect.

endmethod.

endclass.

start-of-selection.

data example type ref to lcl_atc_example.

create object example.

example->run( ).

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK