Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Gliffy
imageAttachmentIdatt208142343
baseUrlhttps://thepluginpeople.atlassian.net/wiki
namecustomer-acceptance-testing
diagramAttachmentIdatt207978503
containerId207945729
timestamp1515765801028

Example Test

Getting the example project

Setting up

Building the code will try to contact a Jira instance at http://localhost:8080 using username admin, and password admin.  You are not expected to have a production instance available like this, JEMH integration tests will manipulate mail queues and server configurations!

  1. JEMH-API and JEMH-AO artifacts are now available by using the following repository in your pom.xml

    JEMH Repositories:

    Code Block
        <repositories>
            <repository>
                <id>atlassian-public</id>
                <url>https://maven.atlassian.com/repository/public</url>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>never</updatePolicy>
                    <checksumPolicy>warn</checksumPolicy>
                </snapshots>
                <releases>
                    <enabled>true</enabled>
                    <checksumPolicy>warn</checksumPolicy>
                </releases>
            </repository>
            
    		<!-- for JEMH API package -->
    	    <repository>
    	      <id>ppl-public</id>
    	      <name>PPL Public Release Repository</name>
    	      <url>https://nexus.thepluginpeople.com/repository/ppl-public/</url>
    	    </repository>
    
    		<!-- for arquillian containers -->
            <repository>
                <id>adaptavist-nexus</id>
                <name>Adaptavist External Releases</name>
                <url>https://nexus.adaptavist.com/content/repositories/external</url>
            </repository>
        </repositories>

  2. JEMH Dependencies:

    Code Block
    <properties>
    	<jemh.api.version>2.1.2</jemh.api.version>
    </properties>
    <dependencies>
    		<dependency>
    			<groupId>com.javahollic.jira.jemh</groupId>
    			<artifactId>jemh-api</artifactId>
    			<version>${jemh.api.version}</version>
    			<scope>provided</scope>
    		</dependency>
    </dependencies>

  3. Checkout the httpsthe https://bitbucket.org/javahollicpluginpeople-public/jemh-example-extensions projectextensions project:

    Code Block
    hggit clone https://bitbucket.org/javahollicpluginpeople-public/jemh-example-extensions

  4. At the command line, go into user-integration-testing and run atlas-mvn clean install to pull down all the dependencies, (the trailing 'sonar' repository in the project pom will be updated soon with our own public repo URL)

...

Code Block
    @Test
    @InSequence(20)
    public void runTestCase() throws RemoteException
    {
    	// We must first retrieve the profile installed in the previous test
    	// The profile can be retrieved via the static key defined earlier
    	ProfileBean testProfileBean = getProfile(TEST_PROFILE_KEY);
    	
    	// Install and run a test case against the profile installed earlier
     	List<ProcessingResultBean> processingResults = installAndRunTestCase(TEST_CASE, testProfileBean);
     	
     	// Assert one processing result
     	Assert.assertTrue("Expected 1 processing result, got: " + processingResults.size(), processingResults.size() == 1);

     	// Get the first processing result bean
     	ProcessingResultBean testCaseResult = processingResults.get(0);
     	
     	// Assert that the test case resulted in an issue being created
     	Assert.assertNotNull("No issues were created by testcase", testCaseResult.getIssue());

     	// Assert that the test case resulted in an audit event being created
     	Assert.assertNotNull("No auditEventBean was created by testcase", testCaseResult.getAuditEventBean());
     	
     	// Clear the mail queue to stop delivery failure messages
     	fTestHarness.getJiraMailServerManager().clearJiraMailQueue();
    }

...

AbstractJEMHIntegrationTest structure

setupTest()

This method is executed one per Test class, before any @Test methods are executed.  Its here to enable precise setup of required resources, the current example just clears the JIra mail queue of pending notifications (why you may want to use this on a TEST instance initially!). We remove items from the mail queue so that we know that notifications in the queue after the test runs were as a result of the test!

...