I am running test cases after change code in business logic. I run test case, but it failing by simply saying NullPoinerException. But it not showing any detais about the issue. It is that:
> it:testOnly com.company.project.Module.write.AlertModuleSpraySpec -F
[trace] Stack trace suppressed: run last project-Module-read/it:testOnly for the full output.
[error] Could not run test com.company.project.Module.write.AlertModuleSpraySpec: java.lang.NullPointerException
[info] Run completed in 1 second, 973 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[error] Error during tests:
[error] com.company.project.Module.write.AlertModuleSpraySpec
[error] (project-Module-read/it:testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 2 s, completed 28 Nov, 2016 2:04:45 PM
Related
My azure release pipeline is working fine when I run individual salesforce test suit image 1 attached. But when I combine multiple salesforce test suit into under "variables" section in azure release pipeline, it getting failed image 2 attached
Logs image attached for the reference [Note - XXX is mentioned to hide the sensitive items) image 3 attached. Version are mentioned clearly in pom.xml so no issue there. Any help on this highly appreciable.
Log added here as requested by Dan in comments section.
2021-09-22T12:46:11.7887285Z Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
2021-09-22T12:46:11.7887560Z
2021-09-22T12:46:11.8032623Z [INFO] ------------------------------------------------------------------------
2021-09-22T12:46:11.8033084Z [INFO] Reactor Summary:
2021-09-22T12:46:11.8033498Z [INFO]
2021-09-22T12:46:11.8033912Z [INFO] xxxx.salesforce.regression 1.0 ..................... SUCCESS [ 1.050 s]
2021-09-22T12:46:11.8041862Z [INFO] xxxx.regression.core 0.0.1-SNAPSHOT ................ SUCCESS [ 1.425 s]
2021-09-22T12:46:11.8047350Z [INFO] xxxx.salesforce.regression.api 0.0.1-SNAPSHOT ...... SUCCESS [ 6.110 s]
2021-09-22T12:46:11.8049728Z [INFO] xxxx.salesforce.regression.framework 0.0.1-SNAPSHOT SUCCESS [ 17.345 s]
2021-09-22T12:46:11.8055798Z [INFO] xxxx.salesforce.regression.script 0.0.1-SNAPSHOT ... FAILURE [01:17 min]
2021-09-22T12:46:11.8060546Z [INFO] ------------------------------------------------------------------------
2021-09-22T12:46:11.8061249Z [INFO] BUILD FAILURE
2021-09-22T12:46:11.8068152Z [INFO] ------------------------------------------------------------------------
2021-09-22T12:46:11.8072043Z [INFO] Total time: 01:43 min
2021-09-22T12:46:11.8077042Z [INFO] Finished at: 2021-09-22T08:46:11-04:00
2021-09-22T12:46:11.8079514Z [INFO] ------------------------------------------------------------------------
2021-09-22T12:46:11.8121567Z [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project xxxx.salesforce.regression.script:
Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
2021-09-22T12:46:11.8123247Z [ERROR] java.lang.RuntimeException: Unable to load category: RegressionBrokerCommunityCensusScripts
2021-09-22T12:46:11.8132417Z [ERROR] at org.apache.maven.surefire.group.match.SingleGroupMatcher.loadGroupClasses(SingleGroupMatcher.java:139)
2021-09-22T12:46:11.8135200Z [ERROR] at org.apache.maven.surefire.group.match.JoinGroupMatcher.loadGroupClasses(JoinGroupMatcher.java:49)
2021-09-22T12:46:11.8139427Z [ERROR] at org.apache.maven.surefire.common.junit48.FilterFactory.createGroupFilter(FilterFactory.java:100)
2021-09-22T12:46:11.8144812Z [ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreProvider.createJUnit48Filter(JUnitCoreProvider.java:279)
2021-09-22T12:46:11.8169178Z [ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:130)
2021-09-22T12:46:11.8170407Z [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
2021-09-22T12:46:11.8171319Z [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
2021-09-22T12:46:11.8171999Z [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
2021-09-22T12:46:11.8176714Z [ERROR] Caused by: java.lang.ClassNotFoundException: RegressionBrokerCommunityCensusScripts
2021-09-22T12:46:11.8177403Z [ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
2021-09-22T12:46:11.8191357Z [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
2021-09-22T12:46:11.8191846Z [ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
2021-09-22T12:46:11.8210436Z [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
2021-09-22T12:46:11.8212191Z [ERROR] at org.apache.maven.surefire.group.match.SingleGroupMatcher.loadGroupClasses(SingleGroupMatcher.java:135)
2021-09-22T12:46:11.8212992Z [ERROR] ... 7 more
2021-09-22T12:46:11.8213257Z [ERROR]
2021-09-22T12:46:11.8213629Z [ERROR] -> [Help 1]
2021-09-22T12:46:11.8214006Z [ERROR]
2021-09-22T12:46:11.8214686Z [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
2021-09-22T12:46:11.8215594Z [ERROR] Re-run Maven using the -X switch to enable full debug logging.
2021-09-22T12:46:11.8216175Z [ERROR]
2021-09-22T12:46:11.8218205Z [ERROR] For more information about the errors and possible solutions, please read the following articles:
2021-09-22T12:46:11.8219550Z [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
2021-09-22T12:46:11.8220244Z [ERROR]
2021-09-22T12:46:11.8221416Z [ERROR] After correcting the problems, you can resume the build with the command
2021-09-22T12:46:11.8224889Z [ERROR] mvn <args> -rf :xxxx.salesforce.regression.script
2021-09-22T12:46:12.1235561Z The process 'D:\Tools\apache-maven-3.6.3\bin\mvn.cmd' failed with exit code 1
2021-09-22T12:46:12.1239927Z Could not retrieve code analysis results - Maven run failed.
2021-09-22T12:46:13.8305598Z No test result files matching D:\agents\A5\_wk\r4\a\**\surefire-reports\TEST-*.xml were found, so publishing JUnit test results is being skipped.
2021-09-22T12:46:13.8351432Z ##[error]Build failed.
My test suits execute fine with jvm, but if I enable scalajs plugin in sbt and run sbt test I get the following output:
[info] Tests:
[info] - should finishTest1
[info] - should finishTest2
...
[info] - should finishTest100
[info] Run completed in 4 seconds, 580 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] No tests were executed.
[success] Total time: 4 s, completed Oct 29, 2019 1:27:24 PM
So it seems that the test might get executed, but the their results get ignored? I am not really sure where should I start in order to fix such problem.
The test file looks like this:
import org.scalatest._
class Tests extends FlatSpec with Matchers {
it should "finishTest1" in {
assert(... == ...)
}
...
}
Furthemore, although sbt test returns the above output, running the tests trough intellij results in java.lang.NoClassDefFoundError: org/scalatest/tools/Runner!
I am running Serenity Jbehave Scripts with example table with 19 rows of values but the script is executing only 7 rows which are present in the example table and giving exception as below when executing the 8th row
The Stack trace from console is :
Example: {workspaceName=admin, menuName=Admin, menuOption=Parameter Maintenance, portletTitle=Parameter Maintenance}
Given login to CMS as colinw and colinw
Then I Navigate to admin Workspace
When I Select Parameter Maintenance Option from Admin Menu
Then I Verify Portlet Parameter Maintenance is Displayed
Then I Close the Portlet Parameter Maintenance
Then logout from CMS
Example: {workspaceName=admin, menuName=Admin, menuOption=Product Maintenance, portletTitle=Product Type}
Story stories/smoke/ShakeDownScript.story duration of 301 seconds has exceeded timeout of 300 seconds
(AfterStories)
[pool-2-thread-1] INFO net.thucydides.core.webdriver.SystemPropertiesConfiguration - project.build.directory : null
[pool-2-thread-1] INFO net.thucydides.core.webdriver.SystemPropertiesConfiguration - project.reporting.OutputDirectory : null
[pool-2-thread-1] INFO net.thucydides.core.webdriver.SystemPropertiesConfiguration - OutputDirectory : C:\WCG Automation\CMS\CMS_Automation\target\site\serenity
Given login to CMS as colinw and colinw
Then I Navigate to admin Workspace
Generating reports view to 'C:\WCG Automation\CMS\CMS_Automation\target\jbehave' using formats '[stats, console, html, xml, serenityreporter, junitscenarioreporter]' and view properties '{decorateNonHtml=true}'
Reports view generated with 0 stories (of which 0 pending) containing 0 scenarios (of which 0 pending)
Tests run: 47, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 313.246 sec <<< FAILURE! - in wcg.cms.CMSTestSuite
wcg.cms.CMSTestSuite Time elapsed: 3.651 sec <<< ERROR!
java.lang.RuntimeException:org.jbehave.core.embedder.Embedder$RunningStoriesFailed: Failures in running stories:
stories/smoke/ShakeDownScript.story: java.util.concurrent.CancellationException
at org.jbehave.core.embedder.Embedder$ThrowingRunningStoriesFailed.handleFailures(Embedder.java:553)
at org.jbehave.core.embedder.Embedder.handleFailures(Embedder.java:238)
at org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:216)
at net.serenitybdd.jbehave.embedders.ExtendedEmbedder.runStoriesAsPaths(ExtendedEmbedder.java:60)
at net.serenitybdd.jbehave.runners.SerenityReportingRunner.run(SerenityReportingRunner.java:175)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
Results :
Tests in error:
JUnit4Provider.invoke:128->executeTestSet:153->executeWithRerun:173->execute:283 ยป Runtime
Tests run: 47, Failures: 0, Errors: 1, Skipped: 0
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! The file encoding for reports output files should be provided by the POM property ${project.reporting.outputEncoding}.
[INFO]
[INFO] --- serenity-maven-plugin:1.1.36:aggregate (serenity-reports) # CMS_Automation ---
[INFO] LOADING LOCAL PROPERTIES FROM C:\WCG Automation\CMS\CMS_Automation\serenity.properties
[INFO] LOADING LOCAL PROPERTIES FROM C:\WCG Automation\CMS\CMS_Automation\serenity.properties
[INFO] LOADING LOCAL PROPERTIES FROM C:\WCG Automation\CMS\CMS_Automation\serenity.properties
[INFO] webdriver.base.url=http://nssrvdfsdev01/calms2cms/
[INFO] serenity.project.name=Automation Testing
[INFO] webdriver.timeouts.implicitlywait=60000
[INFO] project.build.directory : C:\WCG Automation\CMS\CMS_Automation
[INFO] project.reporting.OutputDirectory : null
[INFO] OutputDirectory : C:\WCG Automation\CMS\CMS_Automation\target\site\serenity
[INFO] current_project.base.dir: C:\WCG Automation\CMS\CMS_Automation
Generating HTML Story Reports from C:\WCG Automation\CMS\CMS_Automation\target\site\serenity
Generating HTML Story Reports to C:\WCG Automation\CMS\CMS_Automation\target\site\serenity
[INFO] project.build.directory : C:\WCG Automation\CMS\CMS_Automation
[INFO] project.reporting.OutputDirectory : null
[INFO] OutputDirectory : C:\WCG Automation\CMS\CMS_Automation\target\site\serenity
Merging requirements = [Requirement{name='Smoke', type='feature' parent = 'null', cardNumber='null'}]
Merging requirements = []
Merged requirements set = [Requirement{name='Smoke', type='feature' parent = 'null', cardNumber='null'}]
[INFO] REPORTS GENERATED IN C:\WCG Automation\CMS\CMS_Automation\target\site\serenity
[INFO] REPORT HOME PAGE: C:\WCG Automation\CMS\CMS_Automation\target\site\serenity\index.html
[INFO] Generating release reports for: []
GENERATE CUSTOM REPORTS
[INFO]
[INFO] --- maven-failsafe-plugin:2.18.1:verify (default) # CMS_Automation ---
[INFO] Failsafe report directory: C:\WCG Automation\CMS\CMS_Automation\target\failsafe-reports
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! The file encoding for reports output files should be provided by the POM property ${project.reporting.outputEncoding}.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Sample Serenity project using JBehave and WebDriver
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:25 min
[INFO] Finished at: 2016-08-22T17:26:18+05:30
[INFO] Final Memory: 37M/416M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify (default) on project CMS_Automation: There are test failures.
[ERROR]
[ERROR] Please refer to C:\WCG Automation\CMS\CMS_Automation\target\failsafe-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
it appears that story execution is exceeding the timeout of 300 seconds . is there any way so that we can reset the 300 seconds to 600 seconds in the framework
The solution is quite simple.
I found a related question and answer here.
You can either run the tests with an extra argument like:
mvn clean verify -DstoryTimeoutInSecs=600
Or put a property in the serenity.properties file (which should be in the root of your project if you have it) like this:
story.timeout.in.secs=600
I have code that uses the new Akka 2.4.0. Apparently I've got some libs that are compiled with earlier versions, so I get the warnings/errors shown.
Most problematic, I get an ambiguous reference problem shown below.
OK, so the compiler is warning me (I think) that it's bumped older Akka versions in favor of 2.4.0, then it's confused about akka.pattern.ask.
What should I do about it?
My output is below:
> test:compile
[info] Compiling 5 Scala sources to /Users/wmy965/git/hello/common/target/scala-2.11/test-classes...
[error] /Users/wmy965/git/hello/common/src/test/scala/common.test.service/FacilitiesTests.scala:16: ambiguous reference to overloaded definition,
[error] both method ask in trait AskSupport of type (actorSelection: akka.actor.ActorSelection, message: Any, sender: akka.actor.ActorRef)(implicit timeout: akka.util.Timeout)scala.concurrent.Future[Any]
[error] and method ask in trait AskSupport of type (actorSelection: akka.actor.ActorSelection, message: Any)(implicit timeout: akka.util.Timeout)scala.concurrent.Future[Any]
[error] match expected type ?
[error] import akka.pattern.ask._
[error] ^
[error] /Users/wmy965/git/hello/common/src/test/scala/common.test.service/FacilitiesTests.scala:43: value ? is not a member of akka.actor.ActorRef
[error] Error occurred in an application involving default arguments.
[error] val result = Misc.await(harness.facilities.mongoControl ? MongoAction({ mongo =>
[error] ^
[error] two errors found
[error] (common/test:compileIncremental) Compilation failed
[error] Total time: 1 s, completed Oct 23, 2015 5:57:17 PM
> evicted
[info] Updating {file:/Users/wmy965/git/hello/}hello...
[info] Updating {file:/Users/wmy965/git/hello/}common...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.4 ...
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.typesafe.akka:akka-actor_2.11:(2.3.12, 2.3.7) -> 2.4.0 (caller: com.cof:common_2.11:reactive2_a6d8f9, com.typesafe.akka:akka-stream-experimental_2.11:1.0, co.blocke:laterabbit_2.11:0.3, com.typesafe.akka:akka-slf4j_2.11:2.4.0, com.thenewmotion.akka:akka-rabbitmq_2.11:1.2.4)
[info] Here are other libraries that were evicted:
[info] * org.slf4j:slf4j-api:(1.7.7, 1.6.0) -> 1.7.12 (caller: com.bionicspirit:shade_2.11:1.7.Z, org.mongodb:casbah-core_2.11:2.8.2, org.mongodb:casbah-gridfs_2.11:2.8.2, org.slf4j:slf4j-simple:1.7.7, com.typesafe.akka:akka-slf4j_2.11:2.4.0, org.mongodb:casbah-commons_2.11:2.8.2, org.mongodb:casbah-query_2.11:2.8.2)
[info] * org.mongodb:casbah_2.11:2.8.0 -> 2.8.2 (caller: com.cof:common_2.11:reactive2_a6d8f9, co.blocke:scalajack_mongo_2.11:4.4.1)
[info] * org.scala-lang:scala-reflect:2.11.0 -> 2.11.7 (caller: co.blocke:scalajack_2.11:4.4.1, org.monifu:monifu-core_2.11:0.7.0)
[info] * org.joda:joda-convert:1.2 -> 1.7 (caller: com.github.nscala-time:nscala-time_2.11:1.0.0, co.blocke:scalajack_2.11:4.4.1)
[info] * org.scala-lang:scala-library:(2.11.0, 2.11.5, 2.11.4) -> 2.11.7 (caller: com.bionicspirit:shade_2.11:1.7.Z, com.github.nscala-time:nscala-time_2.11:1.0.0, com.typesafe.akka:akka-http-experimental_2.11:1.0, com.typesafe.akka:akka-stream-experimental_2.11:1.0, co.blocke:laterabbit_2.11:0.3, org.mongodb:casbah-gridfs_2.11:2.8.2, co.blocke:scalajack_2.11:4.4.1, com.typesafe.akka:akka-slf4j_2.11:2.4.0, org.monifu:monifu-core_2.11:0.7.0, org.mongodb:casbah-core_2.11:2.8.2, com.cof:common_2.11:reactive2_a6d8f9, com.typesafe.akka:akka-http-core-experimental_2.11:1.0, com.typesafe.akka:akka-actor_2.11:2.4.0, org.scala-lang:scala-reflect:2.11.7 (), org.mongodb:casbah_2.11:2.8.2, com.typesafe.akka:akka-parsing-experimental_2.11:1.0, org.mongodb:casbah-commons_2.11:2.8.2, org.mongodb:casbah-query_2.11:2.8.2, co.blocke:scalajack_mongo_2.11:4.4.1, com.thenewmotion.akka:akka-rabbitmq_2.11:1.2.4)
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[success] Total time: 1 s, completed Oct 23, 2015 5:57:30 PM
To avoid ambiguity, you can either add sender() or ActorRef.noSender - depends on the context. Or add a timeout mongoControl.ask(MongoAction({...}))(1.second)
I have multiple IntelliJ (Scala) modules that have build.sbt file and scalatest code.
I also created ScalaTest configurations for each of them.
I can run the test one by one from the execution of sbt test.
Is it possible to execute all the tests at once? I can think of making a Python/Bash script, but I wonder if there is a simple way to do it.
for d in dirs:
execute("sbt test")
ADDED
From Alexey Romanov's answer, I created a build.sbt in the root directory with the following content
lazy val root = (project in file(".")).aggregate(context, contextProcessor)
lazy val context = project
lazy val contextProcessor = project
Then, I executed set test to make all the tests run.
[info] ContextTest:
[info] - Create context
[info] - Create context 2
[info] Run completed in 195 milliseconds.
[info] Total number of tests run: 2
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[info] Compiling 1 Scala source to /Users/smcho/Desktop/code/ContextSharingSimulation/contextProcessor/target/scala-2.11/test-classes...
[info] DatabaseTest:
[info] - Create test
[info] - Create test2
[info] Run completed in 147 milliseconds.
[info] Total number of tests run: 2
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 5 s, completed Aug 12, 2015 3:03:41 PM
Reference - http://www.scala-sbt.org/0.13.5/docs/Getting-Started/Multi-Project.html
; <module1>/test; <module2>/test; <module3>/test
Or create an aggregate project:
// in build.sbt
lazy val root = (project in file(".")).
aggregate(<module1>, ...)
Now you can just run sbt test. Actually, it should already be there by default:
If a project is not defined for the root directory in the build, sbt creates a default one that aggregates all other projects in the build.