nagkumar commented on issue #5957:
URL: https://github.com/apache/jmeter/issues/5957#issuecomment-1580313389

   ```
       private final SummaryGeneratingListener runSuiteClass()
       {
        LauncherDiscoveryRequestBuilder requestBuilder = 
LauncherDiscoveryRequestBuilder.request();
        requestBuilder.selectors(selectClass(getJUnit5TestClass()));
   
        Launcher launcher = LauncherFactory.create();
        SummaryGeneratingListener listener = new SummaryGeneratingListener();
        launcher.registerTestExecutionListeners(listener);
        launcher.execute(requestBuilder.build());
        listener.getSummary().printTo(new PrintWriter(System.out));
        return listener;
       }
   ```
   
   This is the code to run JUnit 5 Suite class, this is able to run the test 
suite properly when run from the individual main class.. however when I run it 
as part of JUnit5Sampler with code block
   
    ```
   public SampleResult sample(final Entry aEntry)
       {
        final SampleResult lSampleResult = new SampleResult();
        lSampleResult.sampleStart();
   
        try
        {
            final TestExecutionSummary lSummary = runSuiteClass().getSummary();
   
            if (lSummary.getTestsFailedCount() == 0)
            {
                lSampleResult.setSuccessful(true);
            }
            else
            {
                setFailedResponse(lSampleResult, "Some tests failed.");
            }
        }
        catch (final Exception aException)
        {
            setFailedResponse(lSampleResult, "Exception occurred: " + 
aException.getMessage());
        }
   
        lSampleResult.sampleEnd();
        return lSampleResult;
       }
   
   
   ```
   
   JMeter does not run the test case for sure as it returns immediately, 
however results are shown as 100% success...
   
   
   The .jmx file used is
   
   ```
   <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.5">
       <hashTree>
        <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test 
Plan" enabled="true">
            <stringProp name="TestPlan.comments"/>
            <boolProp name="TestPlan.functional_mode">false</boolProp>
            <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
            <elementProp name="TestPlan.user_defined_variables" 
elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" 
testname="User Defined Variables"
                         enabled="true">
                <collectionProp name="Arguments.arguments"/>
            </elementProp>
            <stringProp name="TestPlan.user_define_classpath"/>
        </TestPlan>
        <hashTree>
            <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" 
testname="JUnit Test Thread Group" enabled="true">
                <stringProp 
name="ThreadGroup.on_sample_error">continue</stringProp>
                <elementProp name="ThreadGroup.main_controller" 
elementType="LoopController" guiclass="LoopControlPanel" 
testclass="LoopController" enabled="true">
                    <boolProp 
name="LoopController.continue_forever">false</boolProp>
                    <stringProp name="LoopController.loops">2</stringProp>
                </elementProp>
                <stringProp name="ThreadGroup.num_threads">10</stringProp>
                <stringProp name="ThreadGroup.ramp_time">5</stringProp>
                <longProp name="ThreadGroup.start_time">1678980642000</longProp>
                <longProp name="ThreadGroup.end_time">1678980642000</longProp>
                <boolProp name="ThreadGroup.scheduler">false</boolProp>
                <stringProp name="ThreadGroup.duration"/>
                <stringProp name="ThreadGroup.delay"/>
            </ThreadGroup>
            <hashTree>
                <JUnit5Sampler guiclass="JUnitTestSamplerGui" 
testclass="JUnit5Sampler" testname="JUnit 5 Sampler" enabled="true">
                    <stringProp 
name="junit5Sampler.classname">com.tejasoft.tests.ju.ju5.ut.perf.TestAllPerfSuite</stringProp>
                    <boolProp name="junit5Sampler.appendError">false</boolProp>
                    <boolProp 
name="junit5Sampler.appendException">false</boolProp>
                </JUnit5Sampler>
                <hashTree/>
            </hashTree>
        </hashTree>
       </hashTree>
   </jmeterTestPlan>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to