Tag Archives: tests

Better Test Code Principles: #1 Don’t copy/paste the code. Reuse it.

When starting to learn Java, one of the first things you are taught is that a class consists of several things, among which are the ‘methods’.  A method is nothing more than grouping of several code lines. Since tests are code, the same principle applies to writing your Java based tests. Especially if you are dealing with duplicate code (code you keep copy/pasting all across your test project).

So what would be the reasons for not wanting to duplicate your code, but instead grouping it into methods: Continue reading Better Test Code Principles: #1 Don’t copy/paste the code. Reuse it.

Quick Tip: Running automated tests in parallel

The What

I have a bunch of tests that i would like to run faster, by making them execute in parallel. In my tests:

  1. I am not using a DataProvider and only want to make the same test run several times.
  2. I am using a DataProvider and want my test to run with the provided values from the provider, but in parallel.
  3. I am not using DataProviders, but my tests are ran by using the textng.xml file that specifies which tests to run (as per this article).

Continue reading Quick Tip: Running automated tests in parallel