6 Replies Latest reply on Jun 5, 2013 2:18 PM by jmnarloch

    loadin and creating beans for all the classes

    menganisanjay

      Hi,

           i'm new to arquillian. i'm tying to use arquillian in Spring sample application. There are 2 classes in the service layer.

      if i wanted to test a service class, it is forcing me to provide the other class too.

       

      Could any please help me in resolving this.

       

      Thanks in advance.

        • 1. Re: loadin and creating beans for all the classes
          bmajsak

          Can you give us a bit more details what is the error you are facing? What is the environment you are using for tests etc? I would also recommend to follow the guides on arquillian.org. They will give you very good understanding of the Arquillian's mechanics (including deployment process).

          • 2. Re: loadin and creating beans for all the classes
            menganisanjay

            i was not getting any errors. my query is "Is it compulsory to jar all the classes from a package." For Ex: there are 2 service classes in service.impl package service1 & service2. In the applicationContext.xml I have provided the

            <context:component-scan base-package="com.arquillian.service.impl" />

             

            i have created a testcase for testing service1. while creating deployment as war, arquillian is forcing to include the service2.class into the war.

            Please let me know if you need anything more.

             

            Thanks in advance.

            • 3. Re: loadin and creating beans for all the classes
              bmajsak

              Test deployment is not that different from normal application deployment. If s1 is using s2 it obviously needs to go to the deployment package. You need to package all required dependencies (or a full application if you like, which you can pre-built eg. using maven)

               

              Please have a look here for better understanding https://github.com/arquillian/arquillian-showcase/tree/master/spring

              • 4. Re: loadin and creating beans for all the classes
                menganisanjay

                Sorry Majsak. Here service1 & service2 are not dependent. For Ex: the impl package is containing UserImpl & SearchImpl. Now I want to test services related to User(UserImplTest). I'm assuming by using arquillian, for testing we can only load the necessary classes. I have included my code too in the first post.

                 

                May be assumption is wrong.

                • 5. Re: loadin and creating beans for all the classes
                  bmajsak

                  I'm assuming by using arquillian, for testing we can only load the necessary classes.

                  Your assumption is right. So what is the problem you are facing again?

                   

                  First you said

                  it is forcing me to provide the other class too.

                  But then

                  i was not getting any errors.

                   

                  so I'm a bit lost at the moment.

                  • 6. Re: loadin and creating beans for all the classes
                    jmnarloch

                    Hi,

                     

                    As my understanding is correct all you need is confirmation that Arquillian does not require for packaging all the application classes?

                     

                    Arquillian can hardly be aware of the existing project source and as a such relaies only on the deployments. So you can go and try to test each of the service layer class seperatly providing that there is no direct dependency between them, in such case either the deployment or test will fail dependending on the deployment type.

                     

                    Hopes that this dispels your doubts