Maven separate Unit Test and Integration Tests

The solution is this: <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.19.1</version> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>${surefire.skip}</skip> </configuration> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> … Read more

Login with code when using LiveServerTestCase with Django

You can’t login user from selenium driver. It’s just impossible without some hacks. But you can login once per TestCase by moving it to setUp method. You can also avoid copy-pasting by creating your class inherit from LiveServerTestCase. UPDATE This code worked for me: self.client.login(username=superuser.username, password=’superpassword’) #Native django test client cookie = self.client.cookies[‘sessionid’] self.browser.get(self.live_server_url + … Read more

Wiremock: Multiple responses for the same URL and content?

This is what the Scenarios feature is for. You’ll need to put both stubs into a scenario (i.e. same scenario name), make the first stub trigger a transition to a new state, then make the second stub contingent on the scenario being in the second state and the first stub contingent on the scenario being … Read more

Is there a standard domain for testing “throwaway” email?

You can use example.com. According to the Wikipedia article: example.com, example.net, and example.org are second-level domain names reserved by the Internet Engineering Task Force through RFC 2606, Section 3,1 for use in documentation and examples. They are not available for registration. By implementing the reservation, the Internet Assigned Numbers Authority (IANA) made available domains to … Read more

Why using Integration tests instead of unit tests is a bad idea?

Integration tests tell you whether it’s working. Unit tests tell you what isn’t working. So long as everything is working, you “don’t need” the unit tests – but once something is wrong, it’s very nice to have the unit test point you directly to the problem. As you say, they serve different purposes; it’s good … Read more