<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count=“1” configfailurepolicy="continue" name=“SAMPLETEST SUITE” parallel="tests">
<test name=“SAMPLE” group-by-instances="true">
<method-selectors>
<method-selector>
<script language="beanshell">
<![CDATA[(groups.containsKey("P0")) && (groups.containsKey(“P1”))]]>
</script>
</method-selector>
</method-selectors>
<packages>
<package name="*">
<include name=".*"/>
</package>
</packages>
</test>
</suite>
The above configuration is the input for me to parse and get the list of the methods. But I am not sure that how to get the list of the included methods from the bean shell with above xml in programatic way.
Santhosh,
TestNG currently doesn’t have something called a “dry-run” mode wherein you could have easily figured out the list of methods that would be executed, but without actually those methods being executed.
The BeanShell that you shared is an example of method selection and not necessarily method interception. These two are two different things.
Beanshell is another way of plugging in a org.testng.IMethodSelector using which you get to decide which method to include and which one not to.
The org.testng.IMethodInterceptor basically lets you do the following :
So for your usecase the IMethodInterceptor should suffice I guess, wherein you get the list of methods that would be executed. But since TestNG doesn’t have a dry-run option yet [ There’s a bug that is tracking this https://github.com/cbeust/testng/issues/1503 ], you could perhaps go extreme and just invoke System.exit(0) from within your Interceptor after you have gotten the list of methods, and maybe print it or something. Just talking loud here!
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Krishnan,
FYI, it would be pretty easy to implement -dryRun
:
IWorker
which, instead of actually running a test, immediately returns with a success statusIWorkerFactory
.To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.
Thanks Cedric. I have self-assigned https://github.com/cbeust/testng/issues/1503
I will give this a try and raise a PR.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
Cédric
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
public abstract class BaseTest implements IHookable, IConfigurable {
@Override
public void run(IHookCallBack callBack, ITestResult testResult) {
if (Config.getProperty("skip_test_execution", false))
return;
callBack.runTestMethod(testResult);
}
@Override
public void run(IConfigureCallBack callBack, ITestResult testResult) {
if (Config.getProperty("skip_test_execution", false)) return;
callBack.runConfigurationMethod(testResult);
}
} But all your tests should extend this class
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.