Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestNG support #41

Open
cezarykluczynski opened this issue Feb 12, 2016 · 11 comments
Open

TestNG support #41

cezarykluczynski opened this issue Feb 12, 2016 · 11 comments

Comments

@cezarykluczynski
Copy link

Hi.

Is there any chance for TestNG support?

@stefanbirkner
Copy link
Owner

I have plans for a Java 8 version of this library that does not need JUnit rules. Which version of Java do you use?

@cezarykluczynski
Copy link
Author

@stefanbirkner It would be cool if this library could be framework-agnostic. I use Java 8.

@stefanbirkner
Copy link
Owner

It will. Unfortunately it will not be as easy to use as the rules and TestNG is does not have any extension points like rules. (http://stackoverflow.com/questions/6099633/does-testng-support-something-like-junit4s-rule)

@stefanbirkner
Copy link
Owner

Which rule are you looking for foremost?

@cezarykluczynski
Copy link
Author

@stefanbirkner As for now, I'm using ExpectedSystemExit. I haven't found any other way to test code that calls System.exit().

@stefanbirkner
Copy link
Owner

I keep you updated on the progress of the new library. Hopefully I can provide a first release for testing System.exti() in the next few days.

@cezarykluczynski
Copy link
Author

@stefanbirkner Thanks!

@stefanbirkner
Copy link
Owner

Would this work for you:

@Test
public void test() {
  int statusCode = catchSystemExit(() -> {
    //here comes your code that calls System.exit(...)
  });
  assertEquals(0, statusCode);
}

@cezarykluczynski
Copy link
Author

@stefanbirkner Sure, looks right.

@stefanbirkner
Copy link
Owner

stefanbirkner commented Apr 26, 2018

I started to create a library called System Lambda that solves the same testing problems like System Rules but without a dependency to a test framework. If that solves your problem, I will not provide a specific TestNG extension.

@pavetok
Copy link

pavetok commented Dec 13, 2018

It will. Unfortunately it will not be as easy to use as the rules and TestNG is does not have any extension points like rules. (http://stackoverflow.com/questions/6099633/does-testng-support-something-like-junit4s-rule)

Are TestNG listeners suitable? http://testng.org/doc/documentation-main.html#testng-listeners

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants