[
https://issues.jboss.org/browse/ARQ-1982?page=com.atlassian.jira.plugin.s...
]
Damien Vidal updated ARQ-1982:
------------------------------
Steps to Reproduce:
- Create a Test class using Arquillian
import java.io.InputStream;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import org.apache.commons.io.FileUtils;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.osgi.metadata.OSGiManifestBuilder;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.osgi.framework.Bundle;
@RunAsClient
@RunWith(Arquillian.class)
public class SampleTest {
@Drone
protected WebDriver driver;
protected StringBuffer verificationErrors = new StringBuffer();
@Deployment(testable = false)
public static JavaArchive createdeployment() {
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class,
"test.jar");
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleSymbolicName(archive.getName());
builder.addBundleManifestVersion(2);
builder.addImportPackages(Bundle.class);
return builder.openStream();
}
});
return archive;
}
@Before
public void setUp() throws Exception {
}
@Test
@InSequence(1)
public void firstTest() {
System.out.println("firstTest()");
}
@Test
@InSequence(2)
public void secondTest() {
System.out.println("secondTest()");
}
@After
public void tearDown() throws Exception {
String verificationErrorString = verificationErrors.toString();
verificationErrors = new StringBuffer();
if (!"".equals(verificationErrorString)) {
Assert.fail(verificationErrorString);
}
}
}
- Launch it in OSGi using with the plugin:
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
was:
- Create a Test class using Arquillian
import java.io.InputStream;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import org.apache.commons.io.FileUtils;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.osgi.metadata.OSGiManifestBuilder;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.osgi.framework.Bundle;
@RunAsClient
@RunWith(Arquillian.class)
public class SampleTest {
@Drone
protected WebDriver driver;
protected StringBuffer verificationErrors = new StringBuffer();
@Deployment(testable = false)
public static JavaArchive createdeployment() {
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class,
"test.jar");
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleSymbolicName(archive.getName());
builder.addBundleManifestVersion(2);
builder.addImportPackages(Bundle.class);
return builder.openStream();
}
});
return archive;
}
@Before
public void setUp() throws Exception {
}
@Test
@InSequence(1)
public void firstTest() {
System.out.println("firstTest()");
}
@Test
@InSequence(2)
public void secondTest() {
System.out.println("secondTest()");
}
@After
public void tearDown() throws Exception {
String verificationErrorString = verificationErrors.toString();
verificationErrors = new StringBuffer();
if (!"".equals(verificationErrorString)) {
Assert.fail(verificationErrorString);
}
}
}
- Launch it is OSGi using with the plugin:
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
Labels: Arquillian OSGI (was: )
Each test case is launched 4 times
----------------------------------
Key: ARQ-1982
URL:
https://issues.jboss.org/browse/ARQ-1982
Project: Arquillian
Issue Type: Bug
Reporter: Damien Vidal
Labels: Arquillian, OSGI
Each test is called 4 times on the following orders.
@Before
@Before
@Test - firstTest
@Test - firstTest
@After
@After
@Before
@Before
@Test - firstTest
@Test - firstTest
@After
@After
-------------------------
@Before
@Before
@Test - secondTest
@Test - secondTest
@After
@After
@Before
@Before
@Test - secondTest
@Test - secondTest
@After
@After
Note:
---------
I tried without Drone - same issue
I tried without RunAsClient - same issue and without Deployment
The instance of the Class is the same for each call of @Test method
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)