3
import org.testng.annotations.Configuration;
4
import org.testng.annotations.Test;
7
* this test verifys that the test class is instantiated exactly once
8
* regardless of how many test methods we have, showing that TestNG
9
* semantics is quite different from JUnit
11
public class CtorCalledOnce {
12
public static int instantiated = 0;
13
public CtorCalledOnce() {
18
public void testMethod1(){
19
assert instantiated == 1 : "Expected 1, was invoked " + instantiated + " times";
23
public void testMethod2(){
24
assert instantiated == 1 : "Expected 1, was invoked " + instantiated + " times";
28
public void testMethod3(){
29
assert instantiated == 1 : "Expected 1, was invoked " + instantiated + " times";
32
@Configuration(afterTest = true)
33
public void afterTest() {
b'\\ No newline at end of file'