Skip to content

Commit

Permalink
Fixed issue when onMethod were not run on tests that are not in defau…
Browse files Browse the repository at this point in the history
…lt package.

So it looks like that for annotation BeforeMethod & AfterMethod the visibility of methods is taken into accounts.

testng-team/testng#473
  • Loading branch information
shafr committed Jul 26, 2018
1 parent 967e88d commit 7b257df
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Arrays;
import java.util.HashMap;

class DockerAnnotationHandler {
public class DockerAnnotationHandler {
private DockerContainerConfig classDockerContainerConfig;
protected DockerController dockerController;

Expand Down Expand Up @@ -114,8 +114,8 @@ private DockerContainerConfig handleMethodAttributes(Method method, DockerContai
return methodContainerConfg;
}

@BeforeMethod
void beforeEachTest(Method method) throws DockerException, InterruptedException {
@BeforeMethod(alwaysRun = true)
protected void beforeEachTest(Method method) throws DockerException, InterruptedException {
DockerContainerConfig methodDockerContainerConfig = handleMethodAttributes(method, classDockerContainerConfig);

dockerController = new DockerController(methodDockerContainerConfig);
Expand All @@ -126,8 +126,8 @@ void beforeEachTest(Method method) throws DockerException, InterruptedException
}
}

@AfterMethod
void afterEachTest(Method method) throws DockerException, InterruptedException {
@AfterMethod(alwaysRun = true)
protected void afterEachTest(Method method) throws DockerException, InterruptedException {
if (dockerController.isRunning()) {
dockerController.stopContainer();
}
Expand Down

0 comments on commit 7b257df

Please sign in to comment.