Introduction to Arquillian framework

24
This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document. Getting started with Arquillian Framework

description

Introduction to Arquillian framework

Transcript of Introduction to Arquillian framework

Page 1: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Getting started with Arquillian Framework

Page 2: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

The progression of a J2EE application testing

What is Arquillian ?

Why Arquillian ?

How to run Arquillian test ?

Shrink and Wrap

Demo

Arquillian Extensions

Agenda

Page 3: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

The progression of a J2EE application testing

What is happening ?

• Unit testing

• Functional testing

• Integration Testing

• Performance Testing

Page 4: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

- Does these actions adapt Agile or extreme programming methodologies ?

- Still Integration testing is painful.

- Run time configuration

- Run time management

- Running the Tests

What is needed for the current ?

Page 5: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Unit vs Integration testing :

Page 6: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

The progression of a J2EE application testing…

Page 7: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

What is Arquillian ?

- is a container-oriented testing framework that enablesdevelopers to create portable integration tests for enterpriseapplications;

- is a JBoss Community project.

The Arquillian framework is broken up into three major sections:

Test runners (JUnit or TestNG),

Containers (Weld, OpenWebBeans, Tomcat, Glassfish, and so on),

Test enrichers (integration of your test case into the container that

your code is running in).

Page 8: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Arquillian Architecture

Page 9: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

- is a fluent API for creating archives such as JARs, WARs and EARs in Java;

- is also a JBoss Community project.

Page 10: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

What is Test Runners ?

Page 11: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

1. A remote container resides in a separate JVM from the test runner; Arquillian binds to the container to deploy and un deploy the test archive and invokes tests via a remote protocol(typically HTTP).

2. An embedded container resides in the same JVM as the test runner; lifecycle managed by Arquillian; tests are executed via a local protocol for containers without a web component (e.g., Embedded EJB) and via a remote protocol for containers that have a web component (e.g., Embedded Java EE).

3. A managed container is the same as a remote container, but in addition, its lifecycle (startup/shutdown) is managed by Arquillian and is run as a separate process

Container :

Page 12: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Example J2EE component :

Page 13: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Example Unit Test class :

Page 14: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Arquillian Test class :

Page 15: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Run it :

Page 16: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

What is happening ?

- The CDI Bean Manager is used to create a new bean instance.

- Arquillian injects the bean into the test class instance, before running any tests

Page 17: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Who care about run time ?

Here comes Arquillian.

Just add dependency in Maven,

Rest of the things actually taken care by the framework,- starting the container run time- packaging the stuffs - deploying into the container - un deploying the package

- Stopping the containers run time.

Page 18: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Test Enrichers:

@Resource: It defines references to any JNDI entry as per standard naming and injection schemes.

@EJB: As long as you are including a deployed EJB in your archive, you can refer to it as long as your target container includes EJB support. EJB JNDI entry conventions remain intact. It is also worthwhile to note that Local and Remote interfaces matter. When you deploy to a same JVM application server, or a remote application server you must ensure that your injected test cases can see the EJB reference appropriately.

@Inject: This is available as long as you have deployed a valid bean archive (requires beans.xml in META-INF or WEB-INF).

And few more by extensions….

Page 19: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Let’s Demonstrate it :

Page 20: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

So finally..

Page 21: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

What else can be automated ?

-Write meaning full tests with endless options.

- Arquillian extensions.- Drone- Graphene- Warp- Persistence- Performance- Seam 2

Page 22: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Pro’s and Con’s

-Con’s- Maven hell

- one test class per @Deployment- too much capabilities – bit large learning curve

-Pro’s- Handy even for testers

- Portable- flexible - open source

Page 23: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Miscellaneous :

Page 24: Introduction to Arquillian  framework

This Document, constitutes and contains proprietary information of ExcelaCom Technologies and shall not be disclosed in whole or in part by Client to any third party or to any employees of Client other than those who have a need to know such information, and shall not be duplicated or used by Client for any other purpose than to evaluate this Document.

Reach Me:

- Karthikeyan Annamalai [email protected]