Junit Executor issue with running java class

176 views
Skip to first unread message

amit...@gmail.com

unread,
May 28, 2018, 7:31:03 AM5/28/18
to codename-taurus
Hi Andrey,

I am facing issue while executing Junit test which is bundled in jar and i have following configuration:-

execution:
- executor: junit
  concurrency: 10
  #ramp-up: 15s
  #hold-for: 2m
  iterations: 100  # loop over test suite for 5 times  
  scenario: complex
  
scenarios:
  complex:
    script: /bzt-configs/nft-test-cbs-account-service/target/classes/com/bskyb/cbs/nft/test/acs/LWS_SVC_ACS_GetAccount.class
    additional-classpath:  # optional, following libs will be added to java classpath
    - /bzt-configs/nft-test-cbs-account-service.jar
    
modules:
  junit:
    #jar-name: /bzt-configs/nft-test-cbs-account-service.jar
    complie-target-java: 1.7.0_79   


Error reported is :-


11:24:37 INFO: Taurus CLI Tool v1.11.0
11:24:38 INFO: Starting with configs: ['test3.yml']
11:24:38 INFO: Configuring...
11:24:38 INFO: Artifacts dir: /tmp/artifacts
11:24:38 INFO: Preparing...
11:24:38 WARNING: There is newer version of Taurus 1.11.1 available, consider up
11:24:39 INFO: Starting...
11:24:39 INFO: Waiting for results...
11:24:40 WARNING: Please wait for graceful shutdown...
11:24:40 INFO: Shutting down...
11:24:40 ERROR: Child Process Error: Test runner complex (JUnitTester) has faile
d with retcode 1
JUnitTester STDERR:
May 28, 2018 11:24:40 AM taurusjunit.CustomRunner main
INFO: Starting: [/tmp/artifacts/runner-3.properties]
Exception in thread "main" java.lang.RuntimeException: Nothing to test
        at taurusjunit.CustomRunner.main(CustomRunner.java:40)
11:24:40 ERROR: JUnitTester STDERR:
May 28, 2018 11:24:40 AM taurusjunit.CustomRunner main
INFO: Starting: [/tmp/artifacts/runner-3.properties]
Exception in thread "main" java.lang.RuntimeException: Nothing to test
        at taurusjunit.CustomRunner.main(CustomRunner.java:40)
11:24:40 INFO: Post-processing...
11:24:40 INFO: Test duration: 0:00:01
11:24:40 INFO: Artifacts dir: /tmp/artifacts
11:24:40 WARNING: Done performing with code: 1


can you help me ?

Andrey Pokhilko

unread,
May 28, 2018, 8:34:33 AM5/28/18
to codenam...@googlegroups.com

Hi,

Are you sure LWS_SVC_ACS_GetAccount.class is a Java test case class?

--

Andrey Pokhilko
Open Source Initiatives Leader
CA
          BlazeMeter

28.05.2018 14:31, amit...@gmail.com пишет:
CAUTION: This email originated from outside of CA. Do not click links or open attachments unless you recognize the sender and know the content is safe.

--
You received this message because you are subscribed to the Google Groups "codename-taurus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codename-taur...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codename-taurus/b6f92e11-7511-4294-8c26-19dcf0734f8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

amit...@gmail.com

unread,
May 29, 2018, 4:42:28 AM5/29/18
to codename-taurus
Hi Andrey,

Yes it is java test class, we have java framework created for rest based API's,

This framework is extension to Unit test cases, let me explain you the reason of failure:-

We dont use junit annotation in our test class, our main class (LWS_SVC_ACS_GetAccount.java) which executes in eclipse as junit is with following structure

 
 public Transaction[] setup() throws SetupException

public Transaction[] execute() 

   public Assertion[] validate() 

These are three methods which we execute but your framework has customrunner.java

ArrayList<Class> classes = getClasses(props);
if (classes.isEmpty()) {
throw new RuntimeException("Nothing to test");
}

looks for annotation and since we dont have them in our main class it fails with nothing to test.

Can you help us further ?

Andrey Pokhilko

unread,
May 29, 2018, 4:55:04 AM5/29/18
to codenam...@googlegroups.com

The way Taurus searches for runnable JUnit test cases is exactly JUnit annotation. So you have to have the annotation for Taurus to recognize test class.

--

Andrey Pokhilko
Open Source Initiatives Leader
CA
          BlazeMeter

29.05.2018 11:42, amit...@gmail.com пишет:

amit...@gmail.com

unread,
May 29, 2018, 5:41:20 AM5/29/18
to codename-taurus
Thanks for your response, now i have changed the class have provided an-noted method inside the class


@Override
    @Test
public void runTest() 
{
Results results = new Executor().executeScript(getScripts());
logger.info(results.toString());
if(results.getCombinedAssertionResult().equals(AssertionResult.FAIL))
{
fail("Script assertions failed, please check logs for details.");
}
else if(results.getCombinedAssertionResult().equals(AssertionResult.EXCEPTION))
fail("Script failed, exception thrown. Please check logs for details."); 
}
    
But i am getting following  exception:-


May 29, 2018 8:43:02 AM taurusjunit.CustomListener testFailure
SEVERE: failed warning(junit.framework.TestSuite$1): No tests found in com.bskyb.cbs.nft.test.acs.LWS_SVC_ACS_GetAccount
May 29, 2018 8:43:02 AM taurusjunit.CustomListener testFinished


{"duration":0.009,"start_time":1527583382,"test_suite":"junit.framework.TestSuite$1","error_msg":"junit.framework.AssertionFailedError: No tests found in com.bskyb.cbs.nft.test.acs.LWS_SVC_ACS_GetAccount","extras":{"full_name":"junit.framework.TestSuite$1.warning"},"error_trace":"junit.framework.AssertionFailedError: No tests found in com.bskyb.cbs.nft.test.acs.LWS_SVC_ACS_GetAccount\n\tat junit.framework.Assert.fail(Assert.java:57)\n\tat junit.framework.TestCase.fail(TestCase.java:227)\n\tat junit.framework.TestSuite$1.runTest(TestSuite.java:100)\n\tat junit.framework.TestCase.runBare(TestCase.java:141)\n\tat junit.framework.TestResult$1.protect(TestResult.java:122)\n\tat junit.framework.TestResult.runProtected(TestResult.java:142)\n\tat junit.framework.TestResult.run(TestResult.java:125)\n\tat junit.framework.TestCase.run(TestCase.java:129)\n\tat junit.framework.TestSuite.runTest(TestSuite.java:255)\n\tat junit.framework.TestSuite.run(TestSuite.java:250)\n\tat org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)\n\tat org.junit.runners.Suite.runChild(Suite.java:127)\n\tat org.junit.runners.Suite.runChild(Suite.java:26)\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:309)\n\tat org.junit.runner.JUnitCore.run(JUnitCore.java:160)\n\tat org.junit.runner.JUnitCore.run(JUnitCore.java:138)\n\tat org.junit.runner.JUnitCore.run(JUnitCore.java:117)\n\tat taurusjunit.CustomRunner.main(CustomRunner.java:61)\n","test_case":"warning","status":"BROKEN"}

Andrey Pokhilko

unread,
May 29, 2018, 7:23:51 AM5/29/18
to codenam...@googlegroups.com

Hi,

You can review the module that Taurus uses to integrate with Java JUnit, it might give you some hints what happens: https://github.com/Blazemeter/taurus/tree/master/java/JUnit_plugin

Just because I have no idea how this can happen if you have used correct annotation...

--

Andrey Pokhilko
Open Source Initiatives Leader
CA
          BlazeMeter

29.05.2018 12:41, amit...@gmail.com пишет:

amit...@gmail.com

unread,
May 29, 2018, 9:08:30 AM5/29/18
to codename-taurus
Hi Andrey,

i can see from your code :-

runner.run(classes.toArray(new Class[classes.size()]));

this is running classes using above junit api.

i have created new java class :-

public class JunitTestRunner {

public static void main(String[] args) {
      JUnitCore jUnitCore = new JUnitCore();
      org.junit.runner.Result result = jUnitCore.run(LWS_SVC_ACS_GetAccount.class);
  }
}

if this work from local command line then this means junit is packaged in jar properly.

amit...@gmail.com

unread,
Jun 11, 2018, 7:41:16 AM6/11/18
to codename-taurus
Hi 

I am facing below error :-


<?xml version='1.0' encoding='UTF-8'?>
<testsuites>
  <testsuite name="sample_labels" package_name="bzt">
    <testcase classname="bzt-8740091305165" name="LWS_SVC_ACS_GetAccount">
      <error message="junit.framework.AssertionFailedError: Script failed, exception thrown. Please check logs for details." type="Error">junit.framework.AssertionFailedError: Script failed, exception thrown. Please check logs for details.
(status code is 500)
(total errors of this type: 1)</error>
    </testcase>
  </testsuite>

Any idea ?
Reply all
Reply to author
Forward
0 new messages