Saturday 15 June 2013

java - Is there a way to make integration tests fail quickly when middleware fails? -


There are various types of integration tests in our test environment, which are dependent on middleware (CMS platform, underlying DB, LTT).

They are automatic and we manage our middleware with Dockers, so we do not have problems with untrusted networks However, sometimes our DB crashes and our test fails.

The problem is that this failure is detected by the org.hibernate.exception.JDBCConnectionException messages. They come through a timeout when this happens, then we end up with hundreds of unsuccessful tests of this exception, every person takes several seconds to fail. As a result, it takes age to complete our tests. Actually, we usually kill them manually when we find out that they are done.

My question: In a Mewen-powered Java Testing environment, there is a way to direct the build system to look for specific types of exceptions and to kill the whole process, whether they reach (or Reach any type of limit)?

We can monitor our containers and kill that kind of build process, hopefully there is a cleaner way of doing this with Maven.

If you use testgages instead of Janet to define tests depending on other tests There are other options.

For example, as with the others mentioned above, you can make a method to test your database connection and to declare all the other tests that depend on this method. PublicTranslation () {@} "TEST" (public domain); {0} {0} Along with, if server all available test fails, all other tests which depend on this will be omitted and will not be marked as failed report of abandoned methods will be final Will be done in the report, which is important because the methods of skip failure are not Are not. But Your initial test is not valid for the server After the failure, the build should fail completely, the positive effect is that none of your other tests will be executed Which will be very fast fail .

You can also increase this argument with the group. Suppose that you are used by some domain logic tests after database queries, you can declare each database test with a group, such as

  @Test (groups = {" Jdbc "}) Public Nil QueryTestOne () {}  

Depending on these tests, you declare a domain argument test,

  @Test ( DependOnGroups = {"jdbc. *}) Public Zero Domain Teeston () {}  

Therefore, your tests are consistent The order of the day will be guaranteed.

Hope this will help you to structure your test a bit. For more information, take a look.


No comments:

Post a Comment