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