Fix for Penetration test _ Session and cookie management
[vid.git] / vid-automation / TestNg-ApiTest.xml
index 440fed4..e0ca82c 100644 (file)
@@ -3,27 +3,57 @@
 <suite verbose="1" name="VID API Tests" annotations="JDK">
 
     <listeners>
-        <listener class-name="vid.automation.test.infra.FeatureTogglingTestngTransformer" />
+        <listener class-name="vid.automation.test.infra.SkipTestsTestngTransformer" />
     </listeners>
 
     <test name="test">
-        <groups>
-            <run>
-                <!-- These tests require the settings in asdc.properties to be like
-                asdc.client.type=LOCAL so cannot run on pipeline-->
-                <exclude name="worksOnlyWithLocalASDC"/>
+        <method-selectors>
+            <method-selector>
+                <script language="beanshell">
+                    <![CDATA[
 
-                <!-- these tests call to MaintenanceController which is restricted to
-                localhost, so it can not run on jenkins pipeline -->
-                <exclude name="worksOnlyWithLocalhostVID"/>
+                        //these tests call to MaintenanceController which is restricted to localhost, so it can not run on jenkins pipeline
 
-                <!-- tests and features that are still under development but are pushed to develop -->
-                <exclude name="underDevelopment"/>
+                        String [] exclusionGroups = new String [] {
+                            "worksOnlyWithLocalASDC",
+                            "worksOnlyWithLocalhostVID",
+                            "underDevelopment"
+                        };
 
-            </run>
-        </groups>
+                        String [] testClassesToRunAlways = new String [] {
+                            "LoggerFormatTest"
+                        };
+
+                        String [] classes1 = new String [] {
+                            "AsyncInstantiationALaCarteApiTest"
+                        };
+                        int selectPart = 0;
+
+                        for (g: exclusionGroups) {
+                            if (groups.containsKey(g)) return false;
+                        }
+                        if (selectPart == 0) return true;
+
+                        methodClass = method.getDeclaringClass().toString();
+
+                        if (methodClass.contains("org.onap.vid.api.Base")) return true;
+
+                        for (c: testClassesToRunAlways) {
+                            if (methodClass.endsWith(c)) return true; // repeat in any selectPart value
+                        }
+
+                        for (c: classes1) {
+                            if (methodClass.endsWith(c)) return selectPart==1;
+                        }
+
+                        // else
+                        return selectPart==2;
+                    ]]>
+                </script>
+            </method-selector>
+        </method-selectors>
         <packages>
             <package name="org.onap.vid.*"/>
         </packages>
     </test>
-</suite>
\ No newline at end of file
+</suite>