0 Replies Latest reply on Sep 11, 2019 8:52 PM by deep.singh

    Arquillian mix mode not able to read/recognise @Before/After annotations of TestNG

    deep.singh

      I am using Arquillian mixed mode. I am doing some configuration in the client mode(initialising webDriver) and using the server side mode to generate tests data and the run my tests in client mode. Now, everything works fine if I use @Test annotation to do the configuration on the client side but that is not what I want. I want to use the @Before annotation to do the configuration. The problem is when I do the configuration using the @BeforeClass annotation of TestNg it gives me the following error: java.lang.NullPointerException

      Here are some logs after the error is being thrown:

       

      2019-09-12 12:34:13,596 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:inline-dialog" has been deprecated since 5.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:aui-inline-dialog2 instead. (required by "com.atlassian.jira.plugins.jira-workflow-designer:inline-dialog-view")

      2019-09-12 12:34:13,596 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.plugins.atlassian-plugins-webresource-plugin:web-resource-manager" has been deprecated since 3.1.7 and will be removed in 4.0.0. Use com.atlassian.plugins.atlassian-plugins-webresource-rest:web-resource-manager instead. (required by "com.atlassian.jira.plugins.jira-workflow-designer:workflow-designer-loader")

      2019-09-12 12:34:13,596 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:aui-experimental-expander" has been deprecated since 8.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:aui-expander instead. (required by "com.atlassian.jira.plugins.jira-workflow-designer:workflow-designer")

      2019-09-12 12:34:13,597 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:aui-experimental-tooltips" has been deprecated since 8.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:aui-tooltip instead. (required by "com.atlassian.jira.plugins.jira-workflow-designer:workflow-designer")

      2019-09-12 12:34:13,597 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:aui-experimental-iconfont" has been deprecated since 8.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:aui-iconography instead. This key was the old way of including the base aui-icon markup pattern along with all of AUI's defined iconography. If you only want the icon markup pattern, you can include "com.atlassian.auiplugin:aui-icon". (required by "com.atlassian.jira.plugins.jira-workflow-designer:workflow-designer")

      2019-09-12 12:34:13,597 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:inline-dialog" has been deprecated since 5.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:aui-inline-dialog2 instead. (required by "com.atlassian.jira.plugins.jira-workflow-designer:workflow-designer")

      2019-09-12 12:34:13,597 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:aui-experimental-soy-templates" has been deprecated since 8.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:soy instead. (required by "com.atlassian.gadgets.dashboard:client-side-soy-templates")

      2019-09-12 12:34:13,597 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.plugins.atlassian-plugins-webresource-plugin:web-resource-manager" has been deprecated since 3.1.7 and will be removed in 4.0.0. Use com.atlassian.plugins.atlassian-plugins-webresource-rest:web-resource-manager instead. (required by "com.atlassian.gadgets.dashboard:dashboard")

      2019-09-12 12:34:13,598 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:ajs-backbone" has been deprecated since 8.0.0 and will be removed in 9.0.0. Backbone should be bundled by and internally scoped in individual products or plugins. (required by "com.atlassian.gadgets.dashboard:dashboard")

      2019-09-12 12:34:13,598 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:dialog2" has been deprecated since 8.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:aui-dialog2 instead. (required by "com.atlassian.gadgets.dashboard:dashboard")

      2019-09-12 12:34:13,598 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:dropdown" has been deprecated since 5.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:aui-dropdown2 instead. (required by "com.atlassian.gadgets.dashboard:dashboard")

      2019-09-12 12:34:13,598 http-nio-2990-exec-6 WARN anonymous 754x80503x1 - 0:0:0:0:0:0:0:1 /login.jsp [webresource] [DEPRECATED] "com.atlassian.auiplugin:dialog" has been deprecated since 5.0.0 and will be removed in 9.0.0. Use com.atlassian.auiplugin:aui-dialog2 instead. (required by "com.atlassian.applinks.applinks-oauth-plugin:oauth-auth")

      2019-09-12 12:34:24,386 http-nio-2990-exec-2 WARN admin 754x81162x1 hdix9q 0:0:0:0:0:0:0:1 /plugins/servlet/techtime-usermanagement/audit/runlogs [c.a.v.htmlsafe.introspection.AnnotationBoxingUberspect] Velocity template accessing deprecated method com.atlassian.jira.plugin.webfragment.model.JiraHelper#getProjectObject - getEncodedBodyFromContent[line 1, column 10]

      2019-09-12 12:34:24,386 http-nio-2990-exec-2 WARN admin 754x81162x1 hdix9q 0:0:0:0:0:0:0:1 /plugins/servlet/techtime-usermanagement/audit/runlogs [c.a.v.htmlsafe.introspection.AnnotationBoxingUberspect] Velocity template accessing deprecated method com.atlassian.jira.plugin.webfragment.model.JiraHelper#getProjectObject - getEncodedBodyFromContent[line 1, column 40]

      2019-09-12 12:34:33,413 http-nio-2990-exec-9 INFO admin 754x81883x1 rwyj95 127.0.0.1 /rest/plugins/1.0/arquillian-tests-key [c.a.plugin.manager.DefaultPluginManager] Disabling arquillian-tests

      2019-09-12 12:34:33,543 Gemini Blueprint context shutdown thread 1 WARN      [arquillian-tests.spring]

         

          Spring context destroyed : arquillian-tests id(262) v(1.0.0)

         

      2019-09-12 12:34:33,546 http-nio-2990-exec-9 DEBUG admin 754x81883x1 rwyj95 127.0.0.1 /rest/plugins/1.0/arquillian-tests-key [c.a.activeobjects.osgi.ActiveObjectsServiceFactory] onPluginDisabledEvent removing delegate for [arquillian-tests]

      2019-09-12 12:34:33,553 http-nio-2990-exec-9 INFO admin 754x81883x1 rwyj95 127.0.0.1 /rest/plugins/1.0/arquillian-tests-key [c.a.plugin.loaders.ScanningPluginLoader] Removed plugin 'arquillian-tests'

       

       

      Here is what my code looks like:-


      public class RunTypesTest extends ShrinkWrapDeployment {

         private WebDriver driver;
        private static final int testPriority = 3;
        private static final int columnNumber = 1;
        private static final int dropDownNumber = 1;

         @Inject
         private DataGenerator dataGenerator;

         @RunAsClient
        @Parameters({"browser", "logInPageUrl""usernameField", "passwordField", "loginButton", "userMenu"})

         @BeforeClass(alwaysRun = true, description = "This tests method is for initialising webDrive and setting test environment ONLY! This method resembles to the functionality of @BeforeClass method")

         private void initialiseDriverAndLogIn(@Optional("chrome") String browser,
         @Optional ("http://localhost:XXX") String logInPageUrl,
         @Optional ("os_username") String usernameField, @Optional ("os_password") String passwordField,
         @Optional ("login") String loginButton, @Optional ("admin") String userMenu) {

         this.driver = WebDriverHelper.invokeBrowserAndLogIn(browser, logInPageUrl, usernameField, passwordField, loginButton, userMenu);
         }


         @Test(alwaysRun = true, description = "This test method is ONLY for deleting test data! This method resembles to the functionality of @AfterClass method")

         @Parameters({"portNumber" , "baseApplication"})

         private void deleteTestData(@Optional ("2990") int portNumber, @Optional ("jira") String baseApplication) throws Exception {

      RestRequest.deleteAllRunLogs(portNumber, baseApplication);

         }


        // TODO Add arquillian script to create a total of 12 run logs which includes both (8)Bulk and (4)Scheduled user actions.

         @RunAsClient
        @Test(description = "The test verifies that the UI displayed at the frontend after selecting 'All run types' option from the 1st dropdown is right or not? " +

         "It is done by verifying that the number and kind of logs at the frontend are same as of number and kind of logs at the backend(assuming that " +

         "the logs in the backend will be right")

         private void allRunTypesTest() {

         // The test assumes that there will be 12 following types of logs in the backend: "Deactivate users", "Change directory", "Add/remove groups", "Deactivate users",
        // "Add/remove groups", "Reactivate users", "Create Jira issues", "Reactivate Users - by time since last login", "Remove application groups - by the time since last log in",
        // "Deactivated - remove all groups", "Deactivate by - only logged in once", "Delete users")

         RunLogsSuiteParentBase.verifyRunLogUi(driver, dropDownNumber, "All run types", columnNumber, BackendTable.allRunTypesData());
         }

      }

       

       

       

      Note: ShrinkWrapClass is extending Arquillan class and has deployment method which looks like this:

       

      @Deployment
      public static Archive deployTests () {

         return ShrinkWrap.create(JavaArchive.class, "tests.jar")

        .addPackage(ShrinkWrapDeployment.class.getPackage())

        .addPackage(WebDriverManager.class.getPackage())

        .addPackage(WebDriver.class.getPackage())

        .addClass(SpringScannerOne.class);
      }

       

      Dependency used:

      <dependency>
        <groupId>com.adaptavist.arquillian.atlassian</groupId>
        <artifactId>remote-atlas-container</artifactId>
        <version>${arquillian.atlas.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver</artifactId>
        <version>${arquillian.graphene.version}</version>
        <type>pom</type>
        <scope>test</scope>
        <exclusions>
        <exclusion>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        </exclusion>
        </exclusions>
      </dependency>

      <dependency>
        <groupId>org.jboss.arquillian.testng</groupId>
        <artifactId>arquillian-testng-container</artifactId>
        <version>1.4.1.Final</version>
        <scope>test</scope>
      </dependency>

       

      I also have alot of other arquillian dependencies for i.e: selenium bom, arquillian bom, arquillian drone bom.