integration-testing

Junit: splitting integration test and Unit tests

孤人 提交于 2019-12-29 10:03:45
问题 I've inherited a load of Junit test, but these tests (apart from most not working) are a mixture of actual unit test and integration tests (requiring external systems, db etc). So I'm trying to think of a way to actually separate them out, so that I can run the unit test nice and quickly and the integration tests after that. The options are.. Split them into separate directories. Move to Junit4 (from v3) and annotate the classes to separate them. Use a file naming convention to tell what a

Deploy WAR in embedded Tomcat 7

会有一股神秘感。 提交于 2019-12-29 06:13:54
问题 I currently need to create a server in order to run a number of unit test. To simplify this process I would like to embed Tomcat into my code and load an instance of Tomcat (which in turn loads my WAR file) before running the unit test (using the @BeforeClass notation). My issue is how can I deploy my WAR file into the embedded Tomcat? As you might notice I cannot use the tomcat maven plugin since I want it to run with the automated tests. 回答1: This code works with Tomcat 8.0: File

Deploy WAR in embedded Tomcat 7

折月煮酒 提交于 2019-12-29 06:13:07
问题 I currently need to create a server in order to run a number of unit test. To simplify this process I would like to embed Tomcat into my code and load an instance of Tomcat (which in turn loads my WAR file) before running the unit test (using the @BeforeClass notation). My issue is how can I deploy my WAR file into the embedded Tomcat? As you might notice I cannot use the tomcat maven plugin since I want it to run with the automated tests. 回答1: This code works with Tomcat 8.0: File

Have integration tests in jacoco-it directory

隐身守侯 提交于 2019-12-25 17:21:31
问题 I have integration tests and they are executed fine, but Jacoco considers them as unit tests. How to tell Jacoco to see them as integration tests and display their graph coverage, not in the jacoco-ut directory, but it the jacoco-it directory ? Here in the Maven configuration: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <argLine>${surefireArgLine}</argLine> <excludes> <exclude>**/it/java/*.java<

error while running integration test with spring boot and testng

十年热恋 提交于 2019-12-25 13:44:41
问题 We are trying to run integration test using testng and springboot.app is running fine and we are able run standalone test using eclipse.but when we run testcase using maven command line.i am getting following exception org.apache.coyote.AbstractProtocol start SEVERE: Failed to start end point associated with ProtocolHandler ["http-nio-8080"] java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:433) at sun.nio.ch.Net.bind

Error “library not found for -lPods-MyProjectTests-KIF” when installing KIF in existing workspace

时间秒杀一切 提交于 2019-12-25 08:52:47
问题 I run into this error when adding KIF to an existing Xcode 6 workspace: ld: library not found for -lPods-MyProjectTests-KIF What may be special about my situation that MyProject.xcworkspace/ resides in the parent directory of MyProject.xcproject/ (and depends on several other sibling projects as well): ./MyProject.xcworkspace/ ./MyProject/ ./MyProject/MyProject.xcworkspace/ ./MyProject/Podfile My Podfile is as follows: target 'MyProjectTests', :exclusive => true do pod 'KIF', '~> 3.0',

making domain.save(failOnError:true) fail when doing integration tests

余生颓废 提交于 2019-12-25 07:12:57
问题 I am purposely causing a cat instance to fail. The following test passes. void testSomething() { Cat.metaClass.save = { throw new Exception("Asdasd") } shouldFail(Exception){ Cat cat = new Cat(name: "asd") cat.save() } GroovySystem.metaClassRegistry.removeMetaClass(Cat.class) } But, when i set the failOnError property for the save method then this fails. How can i alter the save using metaClass in order to make the save(failOnError:true) throw an exception? I appreciate any help! Thanks! void

TomEE arquillian additional library for Hibernate in Testing

孤街浪徒 提交于 2019-12-25 03:44:15
问题 I am trying to do integration testing for JPA ( hibernate and Hikari ) in TomEE 8. As per TomEE documentation I can additional libraries using additionalLibs in pom.xml ( surefire pluggin) , I have added hibernate and Hikari dependencies as mentioned below . But getting error while starting my test case. How to fix this issue ? <systemPropertyVariables> <tomee.additionalLibs> mvn:org.hibernate:hibernate-entitymanager:${hibernate.version} mvn:org.hibernate:hibernate-hikaricp:${hibernate

Integration Testing automation - checking DB values

孤者浪人 提交于 2019-12-25 01:38:36
问题 I'm dealing now with a problem during creating automation of integration test. I would like to: input data via selenium RC check if values are correct in DB after import. I've got problem with logic of those tests. Now I do it as it follows: in one test I generate random data (first name, last name, etc of the person). Then, by simple select from DB I obtain unique person_id key (I assumed that if first and last name are both 8 characters long, random generated strings I can treat them as

How to replace web.xml with application context config files?

不羁的心 提交于 2019-12-25 00:07:14
问题 Background I'm trying to implement integration test for controller in Spring. I DON'T want to use WebApplicationInitializer (Java config for Spring) to run my web app. I want to use xml based configurations. However, @ContextConfiguration could not load web.xml , so I created application-context.xml . The problem is web.xml and application-context.xml are serving the same purpose, Question Can I remove web.xml in favor of application-context.xml ? If I remove web.xml , the test would pass,