[JBoss JIRA] (ARQ-2182) @ApplyScriptBefore on test method is executed before methods annotated with @Before
by Matthias Bünger (JIRA)
[ https://issues.jboss.org/browse/ARQ-2182?page=com.atlassian.jira.plugin.s... ]
Matthias Bünger updated ARQ-2182:
---------------------------------
Description:
I want to use an setUp-method annotated with {{@Before}} to apply a script with general preparations, executed before each method of my test class. In this script ("prepare_test.sql") I empty a table and insert some records. For this I used the {{@ApplyScriptBefore}}.
In one of my test cases I want to insert more records and apply another script ("moreusers", which only has some insert statements).
See this class
{code:title=DataSourceTest.java|borderStyle=solid}
@RunWith(Arquillian.class)
public class DataSourceTest {
@Before
@ApplyScriptBefore({ "prepare_test.sql" })
public void setUp() {
System.out.println("SetUp");
}
@ApplyScriptBefore({ "moreusers.sql" })
@Test
public void GetAllEmps() {
// The "prepare_test.sql" and the "moreusers.sql" should have been applied
}
@Test
public void OtherTest() {
// Only the "prepare_test.sql" should have been applied
}
}
{code}
{code:title=prepare_test.sql|borderStyle=solid}
delete from bish.EMP;
-- 14 Default-Employes
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7839','KING','PRESIDENT',null,to_date('17.11.81','DD.MM.RR'),'5000',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7698','BLAKE','MANAGER','7839',to_date('01.05.81','DD.MM.RR'),'2850',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7782','CLARK','MANAGER','7839',to_date('09.06.81','DD.MM.RR'),'2450',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7566','JONES','MANAGER','7839',to_date('02.04.81','DD.MM.RR'),'2975',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7788','SCOTT','ANALYST','7566',to_date('09.12.82','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7902','FORD','ANALYST','7566',to_date('03.12.81','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7369','SMITH','CLERK','7902',to_date('17.12.80','DD.MM.RR'),'800',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7499','ALLEN','SALESMAN','7698',to_date('20.02.81','DD.MM.RR'),'1600','300','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7521','WARD','SALESMAN','7698',to_date('22.02.81','DD.MM.RR'),'1250','500','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7654','MARTIN','SALESMAN','7698',to_date('28.09.81','DD.MM.RR'),'1250','1400','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7844','TURNER','SALESMAN','7698',to_date('08.09.81','DD.MM.RR'),'1500','0','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7876','ADAMS','CLERK','7788',to_date('12.01.83','DD.MM.RR'),'1100',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7900','JAMES','CLERK','7698',to_date('03.12.81','DD.MM.RR'),'950',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7934','MILLER','CLERK','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
-- Standard noch 2 dazu, macht 16
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9999','Test','Eins','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9998','Test','Zwei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;
{code}
the "moreusers.sql"
{{Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9997','Test','Drei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9996','Test','Vier','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;}}
I think you get the situation. I won't focus the "{{OtherTest()}}" method no more in the description.
When I now execute the {{GetAllEmps()}} I get constraint problems (parent key not found for coloum mgr), because the script "{{moreusers.sql}}" is executed before the "{{prepare_tests.sql}}".
If I delete the {{setUpMethod}} and annotate the testmethod {{GetAllEmps()}} with both scripts
{{@ApplyScriptBefore({ "prepare_test.sql", "moreusers.sql" })}}
then the test passes, because the execution order ist correct and both scripts are applied. But I don't want to annotate every test method with the default script which should run before every test, but only annotate those methods which need further scripts/data.
So I would expect that the method annotated with {{@Before}} and its other annotations are executed before a "normal" test method and its annotations are executed. The docs say so, but the descriped scenario above shows that this is not reality.
was:
I want to use an setUp-method annotated with {{@Before}} to apply a script with general preparations, executed before each method of my test class. In this script ("prepare_test.sql") I empty a table and insert some records. For this I used the {{@ApplyScriptBefore}}.
In one of my test cases I want to insert more records and apply another script ("moreusers", which only has some insert statements).
See this class
{code:title=Bar.java|borderStyle=solid}
@RunWith(Arquillian.class)
public class DataSourceTest {
@Before
@ApplyScriptBefore({ "prepare_test.sql" })
public void setUp() {
System.out.println("SetUp");
}
@ApplyScriptBefore({ "moreusers.sql" })
@Test
public void GetAllEmps() {
// The "prepare_test.sql" and the "moreusers.sql" should have been applied
}
@Test
public void OtherTest() {
// Only the "prepare_test.sql" should have been applied
}
}}
The prepare_test.sql
{{delete from bish.EMP;
-- 14 Default-Employes
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7839','KING','PRESIDENT',null,to_date('17.11.81','DD.MM.RR'),'5000',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7698','BLAKE','MANAGER','7839',to_date('01.05.81','DD.MM.RR'),'2850',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7782','CLARK','MANAGER','7839',to_date('09.06.81','DD.MM.RR'),'2450',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7566','JONES','MANAGER','7839',to_date('02.04.81','DD.MM.RR'),'2975',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7788','SCOTT','ANALYST','7566',to_date('09.12.82','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7902','FORD','ANALYST','7566',to_date('03.12.81','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7369','SMITH','CLERK','7902',to_date('17.12.80','DD.MM.RR'),'800',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7499','ALLEN','SALESMAN','7698',to_date('20.02.81','DD.MM.RR'),'1600','300','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7521','WARD','SALESMAN','7698',to_date('22.02.81','DD.MM.RR'),'1250','500','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7654','MARTIN','SALESMAN','7698',to_date('28.09.81','DD.MM.RR'),'1250','1400','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7844','TURNER','SALESMAN','7698',to_date('08.09.81','DD.MM.RR'),'1500','0','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7876','ADAMS','CLERK','7788',to_date('12.01.83','DD.MM.RR'),'1100',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7900','JAMES','CLERK','7698',to_date('03.12.81','DD.MM.RR'),'950',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7934','MILLER','CLERK','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
-- Standard noch 2 dazu, macht 16
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9999','Test','Eins','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9998','Test','Zwei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;
}}
the "moreusers.sql"
{{Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9997','Test','Drei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9996','Test','Vier','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;}}
I think you get the situation. I won't focus the "{{OtherTest()}}" method no more in the description.
When I now execute the {{GetAllEmps()}} I get constraint problems (parent key not found for coloum mgr), because the script "{{moreusers.sql}}" is executed before the "{{prepare_tests.sql}}".
If I delete the {{setUpMethod}} and annotate the testmethod {{GetAllEmps()}} with both scripts
{{@ApplyScriptBefore({ "prepare_test.sql", "moreusers.sql" })}}
then the test passes, because the execution order ist correct and both scripts are applied. But I don't want to annotate every test method with the default script which should run before every test, but only annotate those methods which need further scripts/data.
So I would expect that the method annotated with {{@Before}} and its other annotations are executed before a "normal" test method and its annotations are executed. The docs say so, but the descriped scenario above shows that this is not reality.
> @ApplyScriptBefore on test method is executed before methods annotated with @Before
> -----------------------------------------------------------------------------------
>
> Key: ARQ-2182
> URL: https://issues.jboss.org/browse/ARQ-2182
> Project: Arquillian
> Issue Type: Feature Request
> Components: Extension - Persistence
> Affects Versions: persistence_1.0.0.Alpha7
> Environment: JBoss Wildfly
> Oracle 11
> Arquillian 1.4.0.FINAL
> Persistence_Extension 1.0.0.Alpha7
> Reporter: Matthias Bünger
> Assignee: Bartosz Majsak
>
> I want to use an setUp-method annotated with {{@Before}} to apply a script with general preparations, executed before each method of my test class. In this script ("prepare_test.sql") I empty a table and insert some records. For this I used the {{@ApplyScriptBefore}}.
> In one of my test cases I want to insert more records and apply another script ("moreusers", which only has some insert statements).
> See this class
> {code:title=DataSourceTest.java|borderStyle=solid}
> @RunWith(Arquillian.class)
> public class DataSourceTest {
> @Before
> @ApplyScriptBefore({ "prepare_test.sql" })
> public void setUp() {
> System.out.println("SetUp");
> }
> @ApplyScriptBefore({ "moreusers.sql" })
> @Test
> public void GetAllEmps() {
> // The "prepare_test.sql" and the "moreusers.sql" should have been applied
> }
>
> @Test
> public void OtherTest() {
> // Only the "prepare_test.sql" should have been applied
> }
> }
> {code}
> {code:title=prepare_test.sql|borderStyle=solid}
> delete from bish.EMP;
> -- 14 Default-Employes
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7839','KING','PRESIDENT',null,to_date('17.11.81','DD.MM.RR'),'5000',null,'10');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7698','BLAKE','MANAGER','7839',to_date('01.05.81','DD.MM.RR'),'2850',null,'30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7782','CLARK','MANAGER','7839',to_date('09.06.81','DD.MM.RR'),'2450',null,'10');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7566','JONES','MANAGER','7839',to_date('02.04.81','DD.MM.RR'),'2975',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7788','SCOTT','ANALYST','7566',to_date('09.12.82','DD.MM.RR'),'3000',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7902','FORD','ANALYST','7566',to_date('03.12.81','DD.MM.RR'),'3000',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7369','SMITH','CLERK','7902',to_date('17.12.80','DD.MM.RR'),'800',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7499','ALLEN','SALESMAN','7698',to_date('20.02.81','DD.MM.RR'),'1600','300','30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7521','WARD','SALESMAN','7698',to_date('22.02.81','DD.MM.RR'),'1250','500','30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7654','MARTIN','SALESMAN','7698',to_date('28.09.81','DD.MM.RR'),'1250','1400','30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7844','TURNER','SALESMAN','7698',to_date('08.09.81','DD.MM.RR'),'1500','0','30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7876','ADAMS','CLERK','7788',to_date('12.01.83','DD.MM.RR'),'1100',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7900','JAMES','CLERK','7698',to_date('03.12.81','DD.MM.RR'),'950',null,'30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7934','MILLER','CLERK','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> -- Standard noch 2 dazu, macht 16
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9999','Test','Eins','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9998','Test','Zwei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> commit;
> {code}
> the "moreusers.sql"
> {{Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9997','Test','Drei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9996','Test','Vier','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> commit;}}
> I think you get the situation. I won't focus the "{{OtherTest()}}" method no more in the description.
> When I now execute the {{GetAllEmps()}} I get constraint problems (parent key not found for coloum mgr), because the script "{{moreusers.sql}}" is executed before the "{{prepare_tests.sql}}".
> If I delete the {{setUpMethod}} and annotate the testmethod {{GetAllEmps()}} with both scripts
> {{@ApplyScriptBefore({ "prepare_test.sql", "moreusers.sql" })}}
> then the test passes, because the execution order ist correct and both scripts are applied. But I don't want to annotate every test method with the default script which should run before every test, but only annotate those methods which need further scripts/data.
> So I would expect that the method annotated with {{@Before}} and its other annotations are executed before a "normal" test method and its annotations are executed. The docs say so, but the descriped scenario above shows that this is not reality.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 8 months
[JBoss JIRA] (ARQ-2182) @ApplyScriptBefore on test method is executed before methods annotated with @Before
by Matthias Bünger (JIRA)
[ https://issues.jboss.org/browse/ARQ-2182?page=com.atlassian.jira.plugin.s... ]
Matthias Bünger updated ARQ-2182:
---------------------------------
Description:
I want to use an setUp-method annotated with {{@Before}} to apply a script with general preparations, executed before each method of my test class. In this script ("prepare_test.sql") I empty a table and insert some records. For this I used the {{@ApplyScriptBefore}}.
In one of my test cases I want to insert more records and apply another script ("moreusers", which only has some insert statements).
See this class
{code:title=Bar.java|borderStyle=solid}
@RunWith(Arquillian.class)
public class DataSourceTest {
@Before
@ApplyScriptBefore({ "prepare_test.sql" })
public void setUp() {
System.out.println("SetUp");
}
@ApplyScriptBefore({ "moreusers.sql" })
@Test
public void GetAllEmps() {
// The "prepare_test.sql" and the "moreusers.sql" should have been applied
}
@Test
public void OtherTest() {
// Only the "prepare_test.sql" should have been applied
}
}}
The prepare_test.sql
{{delete from bish.EMP;
-- 14 Default-Employes
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7839','KING','PRESIDENT',null,to_date('17.11.81','DD.MM.RR'),'5000',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7698','BLAKE','MANAGER','7839',to_date('01.05.81','DD.MM.RR'),'2850',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7782','CLARK','MANAGER','7839',to_date('09.06.81','DD.MM.RR'),'2450',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7566','JONES','MANAGER','7839',to_date('02.04.81','DD.MM.RR'),'2975',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7788','SCOTT','ANALYST','7566',to_date('09.12.82','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7902','FORD','ANALYST','7566',to_date('03.12.81','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7369','SMITH','CLERK','7902',to_date('17.12.80','DD.MM.RR'),'800',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7499','ALLEN','SALESMAN','7698',to_date('20.02.81','DD.MM.RR'),'1600','300','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7521','WARD','SALESMAN','7698',to_date('22.02.81','DD.MM.RR'),'1250','500','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7654','MARTIN','SALESMAN','7698',to_date('28.09.81','DD.MM.RR'),'1250','1400','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7844','TURNER','SALESMAN','7698',to_date('08.09.81','DD.MM.RR'),'1500','0','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7876','ADAMS','CLERK','7788',to_date('12.01.83','DD.MM.RR'),'1100',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7900','JAMES','CLERK','7698',to_date('03.12.81','DD.MM.RR'),'950',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7934','MILLER','CLERK','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
-- Standard noch 2 dazu, macht 16
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9999','Test','Eins','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9998','Test','Zwei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;
}}
the "moreusers.sql"
{{Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9997','Test','Drei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9996','Test','Vier','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;}}
I think you get the situation. I won't focus the "{{OtherTest()}}" method no more in the description.
When I now execute the {{GetAllEmps()}} I get constraint problems (parent key not found for coloum mgr), because the script "{{moreusers.sql}}" is executed before the "{{prepare_tests.sql}}".
If I delete the {{setUpMethod}} and annotate the testmethod {{GetAllEmps()}} with both scripts
{{@ApplyScriptBefore({ "prepare_test.sql", "moreusers.sql" })}}
then the test passes, because the execution order ist correct and both scripts are applied. But I don't want to annotate every test method with the default script which should run before every test, but only annotate those methods which need further scripts/data.
So I would expect that the method annotated with {{@Before}} and its other annotations are executed before a "normal" test method and its annotations are executed. The docs say so, but the descriped scenario above shows that this is not reality.
was:
I want to use an setUp-method annotated with {{@Before}} to apply a script with general preparations, executed before each method of my test class. In this script ("prepare_test.sql") I empty a table and insert some records. For this I used the {{@ApplyScriptBefore}}.
In one of my test cases I want to insert more records and apply another script ("moreusers", which only has some insert statements).
See this class
{{(a)RunWith(Arquillian.class)
public class DataSourceTest {
@Before
@ApplyScriptBefore({ "prepare_test.sql" })
public void setUp() {
System.out.println("SetUp");
}
@ApplyScriptBefore({ "moreusers.sql" })
@Test
public void GetAllEmps() {
// The "prepare_test.sql" and the "moreusers.sql" should have been applied
}
@Test
public void OtherTest() {
// Only the "prepare_test.sql" should have been applied
}
}}}
The prepare_test.sql
{{delete from bish.EMP;
-- 14 Default-Employes
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7839','KING','PRESIDENT',null,to_date('17.11.81','DD.MM.RR'),'5000',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7698','BLAKE','MANAGER','7839',to_date('01.05.81','DD.MM.RR'),'2850',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7782','CLARK','MANAGER','7839',to_date('09.06.81','DD.MM.RR'),'2450',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7566','JONES','MANAGER','7839',to_date('02.04.81','DD.MM.RR'),'2975',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7788','SCOTT','ANALYST','7566',to_date('09.12.82','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7902','FORD','ANALYST','7566',to_date('03.12.81','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7369','SMITH','CLERK','7902',to_date('17.12.80','DD.MM.RR'),'800',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7499','ALLEN','SALESMAN','7698',to_date('20.02.81','DD.MM.RR'),'1600','300','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7521','WARD','SALESMAN','7698',to_date('22.02.81','DD.MM.RR'),'1250','500','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7654','MARTIN','SALESMAN','7698',to_date('28.09.81','DD.MM.RR'),'1250','1400','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7844','TURNER','SALESMAN','7698',to_date('08.09.81','DD.MM.RR'),'1500','0','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7876','ADAMS','CLERK','7788',to_date('12.01.83','DD.MM.RR'),'1100',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7900','JAMES','CLERK','7698',to_date('03.12.81','DD.MM.RR'),'950',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7934','MILLER','CLERK','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
-- Standard noch 2 dazu, macht 16
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9999','Test','Eins','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9998','Test','Zwei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;
}}
the "moreusers.sql"
{{Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9997','Test','Drei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9996','Test','Vier','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;}}
I think you get the situation. I won't focus the "{{OtherTest()}}" method no more in the description.
When I now execute the {{GetAllEmps()}} I get constraint problems (parent key not found for coloum mgr), because the script "{{moreusers.sql}}" is executed before the "{{prepare_tests.sql}}".
If I delete the {{setUpMethod}} and annotate the testmethod {{GetAllEmps()}} with both scripts
{{@ApplyScriptBefore({ "prepare_test.sql", "moreusers.sql" })}}
then the test passes, because the execution order ist correct and both scripts are applied. But I don't want to annotate every test method with the default script which should run before every test, but only annotate those methods which need further scripts/data.
So I would expect that the method annotated with {{@Before}} and its other annotations are executed before a "normal" test method and its annotations are executed. The docs say so, but the descriped scenario above shows that this is not reality.
> @ApplyScriptBefore on test method is executed before methods annotated with @Before
> -----------------------------------------------------------------------------------
>
> Key: ARQ-2182
> URL: https://issues.jboss.org/browse/ARQ-2182
> Project: Arquillian
> Issue Type: Feature Request
> Components: Extension - Persistence
> Affects Versions: persistence_1.0.0.Alpha7
> Environment: JBoss Wildfly
> Oracle 11
> Arquillian 1.4.0.FINAL
> Persistence_Extension 1.0.0.Alpha7
> Reporter: Matthias Bünger
> Assignee: Bartosz Majsak
>
> I want to use an setUp-method annotated with {{@Before}} to apply a script with general preparations, executed before each method of my test class. In this script ("prepare_test.sql") I empty a table and insert some records. For this I used the {{@ApplyScriptBefore}}.
> In one of my test cases I want to insert more records and apply another script ("moreusers", which only has some insert statements).
> See this class
> {code:title=Bar.java|borderStyle=solid}
> @RunWith(Arquillian.class)
> public class DataSourceTest {
> @Before
> @ApplyScriptBefore({ "prepare_test.sql" })
> public void setUp() {
> System.out.println("SetUp");
> }
> @ApplyScriptBefore({ "moreusers.sql" })
> @Test
> public void GetAllEmps() {
> // The "prepare_test.sql" and the "moreusers.sql" should have been applied
> }
>
> @Test
> public void OtherTest() {
> // Only the "prepare_test.sql" should have been applied
> }
> }}
> The prepare_test.sql
> {{delete from bish.EMP;
> -- 14 Default-Employes
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7839','KING','PRESIDENT',null,to_date('17.11.81','DD.MM.RR'),'5000',null,'10');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7698','BLAKE','MANAGER','7839',to_date('01.05.81','DD.MM.RR'),'2850',null,'30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7782','CLARK','MANAGER','7839',to_date('09.06.81','DD.MM.RR'),'2450',null,'10');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7566','JONES','MANAGER','7839',to_date('02.04.81','DD.MM.RR'),'2975',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7788','SCOTT','ANALYST','7566',to_date('09.12.82','DD.MM.RR'),'3000',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7902','FORD','ANALYST','7566',to_date('03.12.81','DD.MM.RR'),'3000',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7369','SMITH','CLERK','7902',to_date('17.12.80','DD.MM.RR'),'800',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7499','ALLEN','SALESMAN','7698',to_date('20.02.81','DD.MM.RR'),'1600','300','30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7521','WARD','SALESMAN','7698',to_date('22.02.81','DD.MM.RR'),'1250','500','30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7654','MARTIN','SALESMAN','7698',to_date('28.09.81','DD.MM.RR'),'1250','1400','30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7844','TURNER','SALESMAN','7698',to_date('08.09.81','DD.MM.RR'),'1500','0','30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7876','ADAMS','CLERK','7788',to_date('12.01.83','DD.MM.RR'),'1100',null,'20');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7900','JAMES','CLERK','7698',to_date('03.12.81','DD.MM.RR'),'950',null,'30');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7934','MILLER','CLERK','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> -- Standard noch 2 dazu, macht 16
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9999','Test','Eins','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9998','Test','Zwei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> commit;
> }}
> the "moreusers.sql"
> {{Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9997','Test','Drei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9996','Test','Vier','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
> commit;}}
> I think you get the situation. I won't focus the "{{OtherTest()}}" method no more in the description.
> When I now execute the {{GetAllEmps()}} I get constraint problems (parent key not found for coloum mgr), because the script "{{moreusers.sql}}" is executed before the "{{prepare_tests.sql}}".
> If I delete the {{setUpMethod}} and annotate the testmethod {{GetAllEmps()}} with both scripts
> {{@ApplyScriptBefore({ "prepare_test.sql", "moreusers.sql" })}}
> then the test passes, because the execution order ist correct and both scripts are applied. But I don't want to annotate every test method with the default script which should run before every test, but only annotate those methods which need further scripts/data.
> So I would expect that the method annotated with {{@Before}} and its other annotations are executed before a "normal" test method and its annotations are executed. The docs say so, but the descriped scenario above shows that this is not reality.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 8 months
[JBoss JIRA] (ARQ-2182) @ApplyScriptBefore on test method is executed before methods annotated with @Before
by Matthias Bünger (JIRA)
Matthias Bünger created ARQ-2182:
------------------------------------
Summary: @ApplyScriptBefore on test method is executed before methods annotated with @Before
Key: ARQ-2182
URL: https://issues.jboss.org/browse/ARQ-2182
Project: Arquillian
Issue Type: Feature Request
Components: Extension - Persistence
Affects Versions: persistence_1.0.0.Alpha7
Environment: JBoss Wildfly
Oracle 11
Arquillian 1.4.0.FINAL
Persistence_Extension 1.0.0.Alpha7
Reporter: Matthias Bünger
Assignee: Bartosz Majsak
I want to use an setUp-method annotated with {{@Before}} to apply a script with general preparations, executed before each method of my test class. In this script ("prepare_test.sql") I empty a table and insert some records. For this I used the {{@ApplyScriptBefore}}.
In one of my test cases I want to insert more records and apply another script ("moreusers", which only has some insert statements).
See this class
{{(a)RunWith(Arquillian.class)
public class DataSourceTest {
@Before
@ApplyScriptBefore({ "prepare_test.sql" })
public void setUp() {
System.out.println("SetUp");
}
@ApplyScriptBefore({ "moreusers.sql" })
@Test
public void GetAllEmps() {
// The "prepare_test.sql" and the "moreusers.sql" should have been applied
}
@Test
public void OtherTest() {
// Only the "prepare_test.sql" should have been applied
}
}}}
The prepare_test.sql
{{delete from bish.EMP;
-- 14 Default-Employes
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7839','KING','PRESIDENT',null,to_date('17.11.81','DD.MM.RR'),'5000',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7698','BLAKE','MANAGER','7839',to_date('01.05.81','DD.MM.RR'),'2850',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7782','CLARK','MANAGER','7839',to_date('09.06.81','DD.MM.RR'),'2450',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7566','JONES','MANAGER','7839',to_date('02.04.81','DD.MM.RR'),'2975',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7788','SCOTT','ANALYST','7566',to_date('09.12.82','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7902','FORD','ANALYST','7566',to_date('03.12.81','DD.MM.RR'),'3000',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7369','SMITH','CLERK','7902',to_date('17.12.80','DD.MM.RR'),'800',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7499','ALLEN','SALESMAN','7698',to_date('20.02.81','DD.MM.RR'),'1600','300','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7521','WARD','SALESMAN','7698',to_date('22.02.81','DD.MM.RR'),'1250','500','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7654','MARTIN','SALESMAN','7698',to_date('28.09.81','DD.MM.RR'),'1250','1400','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7844','TURNER','SALESMAN','7698',to_date('08.09.81','DD.MM.RR'),'1500','0','30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7876','ADAMS','CLERK','7788',to_date('12.01.83','DD.MM.RR'),'1100',null,'20');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7900','JAMES','CLERK','7698',to_date('03.12.81','DD.MM.RR'),'950',null,'30');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('7934','MILLER','CLERK','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
-- Standard noch 2 dazu, macht 16
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9999','Test','Eins','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9998','Test','Zwei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;
}}
the "moreusers.sql"
{{Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9997','Test','Drei','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
Insert into bish.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ('9996','Test','Vier','7782',to_date('23.01.82','DD.MM.RR'),'1300',null,'10');
commit;}}
I think you get the situation. I won't focus the "{{OtherTest()}}" method no more in the description.
When I now execute the {{GetAllEmps()}} I get constraint problems (parent key not found for coloum mgr), because the script "{{moreusers.sql}}" is executed before the "{{prepare_tests.sql}}".
If I delete the {{setUpMethod}} and annotate the testmethod {{GetAllEmps()}} with both scripts
{{@ApplyScriptBefore({ "prepare_test.sql", "moreusers.sql" })}}
then the test passes, because the execution order ist correct and both scripts are applied. But I don't want to annotate every test method with the default script which should run before every test, but only annotate those methods which need further scripts/data.
So I would expect that the method annotated with {{@Before}} and its other annotations are executed before a "normal" test method and its annotations are executed. The docs say so, but the descriped scenario above shows that this is not reality.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 8 months
[JBoss JIRA] (ARQ-567) Supporting Test Suites (@ArquillianSuite)
by David Matejcek (JIRA)
[ https://issues.jboss.org/browse/ARQ-567?page=com.atlassian.jira.plugin.sy... ]
David Matejcek commented on ARQ-567:
------------------------------------
Correct, I have found a bug in arquillian/payara connected with @Produces and classloaders (classcastexception of proxies), but I need some time to create a test for that.
Meanwhile I added only the extension and @ArquillianSuiteDeployment annotation and to my surprise everything works - tests are even faster (no redeployments) and are runnable from Eclipse. I will try @RunWith(Suite.class) on another module, it seems promising :-)
> Supporting Test Suites (@ArquillianSuite)
> -----------------------------------------
>
> Key: ARQ-567
> URL: https://issues.jboss.org/browse/ARQ-567
> Project: Arquillian
> Issue Type: Feature Request
> Reporter: Mousavi Jahan Abadi S. M.
> Assignee: Aslak Knutsen
> Fix For: 1.2.0.Alpha1
>
>
> Currently, it is supported that JUnit test cases being run by Arquillian. This feature request is request for supporting test suites too to be run by Arquillian too. Idea is like:
> @RunWith(ArquillianSuite.class)
> @Suite.SuiteClasses( { TestCase1.class, TestCase2.class, .... } )
> public class AllTests{
> @Deployment
> public static JavaArchive createTestArchive(){
> return ShrinkWrap.create(JavaArchive.class,"test.jar");
> }
> }
> The advantages of above approach for users of Arquillian framework are:
> - Test cases don't needed to be modified to have: "@RunWith(Arquillian.class)" annotation. In other words, test cases will be pure JUnit code, and no Arquillian code (results in less coding for end users).
> - It is not necessary to include the static "@Deployment" methods in all test cases any more, and only Test Suite need to define the archieving/deployment related setting/definitions.
> The advantage of above approach for framework itself is:
> - From performance point-of-view, it becomes possible for Arquillian to deploy all test cases in the Test Suite into J2EE container in one action (one deploy/undeploy for one test suite, instead of mulitple deploy/undeploy for each test case).
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 9 months
[JBoss JIRA] (ARQ-567) Supporting Test Suites (@ArquillianSuite)
by Carlo Marchiori (JIRA)
[ https://issues.jboss.org/browse/ARQ-567?page=com.atlassian.jira.plugin.sy... ]
Carlo Marchiori edited comment on ARQ-567 at 4/11/18 11:54 AM:
---------------------------------------------------------------
I have found a workaround that consists in using
- *Arquillian extension org.eu.ingwar.tools:arquillian-suite-extension* and its attribute @ArquillianSuiteDeployment on the top test class which also has the *@Deployment method*
- *(a)RunWith(Suite.class)* on all *container test classes* that should not contain actual test method; this creates the correct test tree
- *(a)RunWith(Arquillian.class)* on all *leaf test classes* that contain actual test methods; this instructs JUnit/Arquillian to invoke the test methods remotely
was (Author: ygmarchi2):
I have found a workaround that consists in using
- *Arquillian extension org.eu.ingwar.tools:arquillian-suite-extension* and it's attribute @ArquillianSuiteDeployment on the top Suite
- *(a)RunWith(Suite.class)* on all *container test classes* that should not contain actual test method; this creates the correct test tree
- *(a)RunWith(Arquillian.class)* on all *leaf test classes* that contain actual test methods; this instructs JUnit/Arquillian to invoke the test methods remotely
> Supporting Test Suites (@ArquillianSuite)
> -----------------------------------------
>
> Key: ARQ-567
> URL: https://issues.jboss.org/browse/ARQ-567
> Project: Arquillian
> Issue Type: Feature Request
> Reporter: Mousavi Jahan Abadi S. M.
> Assignee: Aslak Knutsen
> Fix For: 1.2.0.Alpha1
>
>
> Currently, it is supported that JUnit test cases being run by Arquillian. This feature request is request for supporting test suites too to be run by Arquillian too. Idea is like:
> @RunWith(ArquillianSuite.class)
> @Suite.SuiteClasses( { TestCase1.class, TestCase2.class, .... } )
> public class AllTests{
> @Deployment
> public static JavaArchive createTestArchive(){
> return ShrinkWrap.create(JavaArchive.class,"test.jar");
> }
> }
> The advantages of above approach for users of Arquillian framework are:
> - Test cases don't needed to be modified to have: "@RunWith(Arquillian.class)" annotation. In other words, test cases will be pure JUnit code, and no Arquillian code (results in less coding for end users).
> - It is not necessary to include the static "@Deployment" methods in all test cases any more, and only Test Suite need to define the archieving/deployment related setting/definitions.
> The advantage of above approach for framework itself is:
> - From performance point-of-view, it becomes possible for Arquillian to deploy all test cases in the Test Suite into J2EE container in one action (one deploy/undeploy for one test suite, instead of mulitple deploy/undeploy for each test case).
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 9 months
[JBoss JIRA] (ARQ-567) Supporting Test Suites (@ArquillianSuite)
by Carlo Marchiori (JIRA)
[ https://issues.jboss.org/browse/ARQ-567?page=com.atlassian.jira.plugin.sy... ]
Carlo Marchiori commented on ARQ-567:
-------------------------------------
I have found a workaround that consists in using
- *Arquillian extension org.eu.ingwar.tools:arquillian-suite-extension* and it's attribute @ArquillianSuiteDeployment on the top Suite
- *(a)RunWith(Suite.class)* on all *container test classes* that should not contain actual test method; this creates the correct test tree
- *(a)RunWith(Arquillian.class)* on all *leaf test classes* that contain actual test methods; this instructs JUnit/Arquillian to invoke the test methods remotely
> Supporting Test Suites (@ArquillianSuite)
> -----------------------------------------
>
> Key: ARQ-567
> URL: https://issues.jboss.org/browse/ARQ-567
> Project: Arquillian
> Issue Type: Feature Request
> Reporter: Mousavi Jahan Abadi S. M.
> Assignee: Aslak Knutsen
> Fix For: 1.2.0.Alpha1
>
>
> Currently, it is supported that JUnit test cases being run by Arquillian. This feature request is request for supporting test suites too to be run by Arquillian too. Idea is like:
> @RunWith(ArquillianSuite.class)
> @Suite.SuiteClasses( { TestCase1.class, TestCase2.class, .... } )
> public class AllTests{
> @Deployment
> public static JavaArchive createTestArchive(){
> return ShrinkWrap.create(JavaArchive.class,"test.jar");
> }
> }
> The advantages of above approach for users of Arquillian framework are:
> - Test cases don't needed to be modified to have: "@RunWith(Arquillian.class)" annotation. In other words, test cases will be pure JUnit code, and no Arquillian code (results in less coding for end users).
> - It is not necessary to include the static "@Deployment" methods in all test cases any more, and only Test Suite need to define the archieving/deployment related setting/definitions.
> The advantage of above approach for framework itself is:
> - From performance point-of-view, it becomes possible for Arquillian to deploy all test cases in the Test Suite into J2EE container in one action (one deploy/undeploy for one test suite, instead of mulitple deploy/undeploy for each test case).
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 9 months
[JBoss JIRA] (ARQGRA-493) Javassist enhanced WebDriver does not work
by Stephan Pirnbaum (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-493?page=com.atlassian.jira.plugin... ]
Stephan Pirnbaum commented on ARQGRA-493:
-----------------------------------------
This is still an issue with 2.3.2. Are there any plans on resolving this problem?
> Javassist enhanced WebDriver does not work
> ------------------------------------------
>
> Key: ARQGRA-493
> URL: https://issues.jboss.org/browse/ARQGRA-493
> Project: Arquillian Graphene
> Issue Type: Bug
> Affects Versions: 2.1.0.Final
> Reporter: Artur Signell
>
> When a WebDriver is wrapped inside a Javassist proxy, it seems that it will be rewrapped inside another proxy in org.jboss.arquillian.graphene.context.GrapheneContextImpl.LazyContext.getWebDriver().
> After this, when driver.get(...) is executed, the result is
> java.lang.RuntimeException: not found _d32get:(Ljava/lang/String;)V in com.vaadin.testbench.TestBenchDriverProxy_$$_javassist_0$$EnhancerByGraphene$$a623df4c
> at javassist.util.proxy.RuntimeSupport.error(RuntimeSupport.java:94)
> at javassist.util.proxy.RuntimeSupport.findMethod(RuntimeSupport.java:70)
> at javassist.util.proxy.RuntimeSupport.find2Methods(RuntimeSupport.java:54)
> at com.vaadin.testbench.TestBenchDriverProxy_$$_javassist_0.get(TestBenchDriverProxy_$$_javassist_0.java)
> at org.jboss.arquillian.graphene.location.LocationEnricher.handleLocationOf(LocationEnricher.java:136)
> at org.jboss.arquillian.graphene.location.LocationEnricher.goTo(LocationEnricher.java:96)
> at org.jboss.arquillian.graphene.location.LocationEnricher.resolve(LocationEnricher.java:81)
> at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.enrichArguments(LocalTestExecuter.java:94)
> at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:61)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
> This does not happen if GrapheneProxyUtil.isProxy is updated to contain an additional check for javassist proxies:
> if (interfaze.getName().equals("javassist.util.proxy.ProxyObject")) {
> return true;
> }
> As I am not very familiar with this project, I have really no clue if this is a good or bad solution.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 9 months