1+ package checkmarx .ast .eclipse .plugin .tests .ui ;
2+
3+ import static org .junit .Assert .assertTrue ;
4+
5+ import java .util .List ;
6+ import java .util .concurrent .TimeoutException ;
7+
8+ import org .eclipse .swtbot .swt .finder .junit .SWTBotJunit4ClassRunner ;
9+ import org .eclipse .swtbot .swt .finder .widgets .SWTBotTreeItem ;
10+ import org .junit .Test ;
11+ import org .junit .runner .RunWith ;
12+
13+ @ RunWith (SWTBotJunit4ClassRunner .class )
14+ public class SCAResults extends BaseUITest {
15+
16+ @ Test
17+ public void testSCAResultsExist () throws TimeoutException {
18+ try {
19+ // Setup and initialize plugin
20+ setUpCheckmarxPlugin (true );
21+ preventWidgetWasNullInCIEnvironment ();
22+
23+ System .out .println ("\n === Starting SCA Results Test ===" );
24+
25+ // Wait for scan results to load
26+ sleep (2000 );
27+
28+ // Get root node
29+ String scanId = _bot .tree (1 ).cell (0 , 0 );
30+ System .out .println ("Scan ID: " + scanId );
31+
32+ SWTBotTreeItem rootNode = _bot .tree (1 ).getTreeItem (scanId );
33+ rootNode .expand ();
34+ sleep (1000 );
35+
36+ // Find SCA node
37+ List <String > scannerNodes = rootNode .getNodes ();
38+ System .out .println ("Available scanners: " + scannerNodes );
39+
40+ // Verify SCA exists
41+ assertTrue (
42+ "SCA scanner should exist in results" ,
43+ scannerNodes .stream ().anyMatch (node -> node .startsWith ("SCA" ))
44+ );
45+
46+ // Get SCA node
47+ SWTBotTreeItem scaNode = null ;
48+ for (String nodeName : scannerNodes ) {
49+ if (nodeName .startsWith ("SCA" )) {
50+ scaNode = rootNode .getNode (nodeName );
51+ break ;
52+ }
53+ }
54+
55+ // Check severity nodes
56+ scaNode .expand ();
57+ sleep (1000 );
58+
59+ List <String > severityNodes = scaNode .getNodes ();
60+ System .out .println ("SCA severity nodes: " + severityNodes );
61+
62+ // Verify HIGH and MEDIUM exist
63+ assertTrue (
64+ "SCA should have HIGH severity findings" ,
65+ severityNodes .stream ().anyMatch (node -> node .startsWith ("HIGH" ))
66+ );
67+
68+ assertTrue (
69+ "SCA should have MEDIUM severity findings" ,
70+ severityNodes .stream ().anyMatch (node -> node .startsWith ("MEDIUM" ))
71+ );
72+
73+ // Cleanup
74+ _bot .viewByTitle (VIEW_CHECKMARX_AST_SCAN ).close ();
75+
76+ } catch (Exception e ) {
77+ System .out .println ("\n === Test Failed ===" );
78+ System .out .println ("Exception: " + e .getMessage ());
79+ e .printStackTrace ();
80+ throw e ;
81+ }
82+ }
83+ }
0 commit comments