lin
2025-08-01 633231e833e21d5b8b1c00cb15aedb62b3b78e8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package test;
 
import org.testng.ITestContext;
import org.testng.annotations.Test;
 
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
 
public class SerializationTest {
 
  @Test(groups = "broken")
  public void iSuiteShouldBeSerializable(ITestContext context) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(out);
    oos.writeObject(context.getSuite());
    oos.close();
  }
 
  @Test(groups = { "broken", "maven-broken" })
  public void testngMethodShouldBeSerializable(ITestContext context) throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(out);
    oos.writeObject(context.getAllTestMethods()[0]);
    oos.close();
  }
}