I am executing the Cucumber automation test scripts through gradle, though i am able to execute the test successfully but reports are not getting generated. I did give a try with with below gradle tasks
one at a time.
Cucumber gradle tasks copied below
a) for the below gradle task i am able to execute the scripts which does not generate reports as i have not included the reports statements inside args
task cucumber() {
dependsOn assemble, testClasses
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty',
'--glue','com.hal.brands.test.stepdefinition',
'src/test/resources','src/main/java',
'--tags', '#Api'
]
}
}
}
b) I tried to include the few statements related to reporting as shown in below gradle task but it failed with a exception
task cucumber() {
dependsOn assemble, testClasses
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', 'json:target/HalBrands.json', 'com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:',
'--monochrome', 'true',
'--features','src\test\resources\featurefile',
'--glue','com.hal.brands.test.stepdefinition',
'src/test/resources','src/main/java',
'--tags', '#Api'
]
}
}
}
Exception details given below
BUILD SUCCESSFUL in 1s
6 actionable tasks: 6 up-to-date
E:\GradleProj_workspace\GadleDemoProj>gradle cucumber
> Configure project :
http://api-qa.dpr-prv.halbrands.us.cloudappzero.azureflash.com
E:\GradleProj_workspace\GadleDemoProj
> Task :cucumber FAILED
Exception in thread "main" java.lang.IllegalArgumentException: com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter: is not valid. Try URI[:LINE]*
at io.cucumber.core.model.FeatureWithLines.parse(FeatureWithLines.java:56)
at io.cucumber.core.options.RuntimeOptionsParser.parse(RuntimeOptionsParser.java:131)
at io.cucumber.core.options.CommandlineOptionsParser.parse(CommandlineOptionsParser.java:25)
at io.cucumber.core.options.CommandlineOptionsParser.parse(CommandlineOptionsParser.java:29)
at io.cucumber.core.cli.Main.run(Main.java:29)
at io.cucumber.core.cli.Main.main(Main.java:14)
Caused by: java.lang.IllegalArgumentException: Expected scheme-specific part at index 68: com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:
at java.net.URI.create(URI.java:852)
at io.cucumber.core.model.FeaturePath.parseProbableURI(FeaturePath.java:72)
at io.cucumber.core.model.FeaturePath.parse(FeaturePath.java:57)
at io.cucumber.core.model.FeatureWithLines.parseFeaturePath(FeatureWithLines.java:77)
at io.cucumber.core.model.FeatureWithLines.parse(FeatureWithLines.java:53)
... 5 more
Caused by: java.net.URISyntaxException: Expected scheme-specific part at index 68: com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.failExpecting(URI.java:2854)
at java.net.URI$Parser.parse(URI.java:3057)
at java.net.URI.<init>(URI.java:588)
at java.net.URI.create(URI.java:850)
... 9 more
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\GradleProj_workspace\GadleDemoProj\build.gradle' line: 104
* What went wrong:
Execution failed for task ':cucumber'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_202\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
6 actionable tasks: 1 executed, 5 up-to-date
E:\GradleProj_workspace\GadleDemoProj>
**---------------------------------------------------------------------------------------------------------------**
I am not sure where i am going wrong in the above 'b' gradle task . Please help with me at the earliest as iam literally wasting lot of time here trying out many possibilities. Also i want to keep you informed that i am new gradle stuff.
Have also copied cucumberoptions as present in my cucumber runner file
#CucumberOptions(features = { "classpath:featurefile" }, glue = { "classpath:com.hal.brands.test.stepdefinition",
"classpath:com.hal.brands.helper" },
plugin = { "pretty", "json:target/HalBrands.json", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:" },
monochrome = true, tags = "#Api")
Pls take off the json: to get rid of the exception you are getting wrt to invalid scheme!
The Complete solution is given below .
task cucumber() {
dependsOn assemble, testClasses
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty',
'--plugin', 'json:target/HalBrands.json',
'--plugin', 'com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:Report',
'--glue','com.hal.brands.test.stepdefinition',
'src/test/resources','src/main/java',
'--tags', '#Api'
]
}
}
}
Related
We are facing this bug in our production environment. I have been looking for a solution for a while and I cannot seem to solve it. Any help would be appreciated.
We are using Sagemaker Batch Transform to perform inference on our machine learning models. Each job is supposed to create one instance using a docker image from our ECR container. This job then consumes a payload and starts processing it using a pytorch script. When the job is done, the script calls an API to store the results.
The issue is that when we check the cloud watch logs for a SINGLE job, we see that it is repeated. After the job is repeated multiple times, the individual instances of the same job may or may not finish and the whole operation returns with an error.
Basically, we see the following issue in our cloud watch logs and cannot seem to figure out what is causing this:
2022-04-24 19:41:47,865 [INFO ] W-model-1-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - Starting to Process Task: 12345678-abcd-1234-efgh-123456ab12c3
...
[The job is running and printing logs]
...
[There is no error but the job doesn't seem to run anymore, the same job seems to roll back again]
...
2022-04-24 19:52:09,522 [INFO ] W-model-1-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - Starting to Process Task: 12345678-abcd-1234-efgh-123456ab12c3
...
[The job is running and printing logs]
...
[There is no error but the job doesn't seem to run anymore, the same job seems to roll back again]
...
2022-04-24 20:12:11,834 [INFO ] W-model-1-stdout com.amazonaws.ml.mms.wlm.WorkerLifeCycle - Starting to Process Task: 12345678-abcd-1234-efgh-123456ab12c3
...
[The job is running and printing logs]
...
[There are no errors but the cloud watch logs stop here. Sagemaker returns an error to the client.]
The following sample code is what we are using to run the jobs:
def inference_batch(self):
batch_input = f"s3://{self.cnf.SAGEMAKER_BUCKET}/batch-input/batch.csv"
batch_output = f"s3://{self.cnf.SAGEMAKER_BUCKET}/batch-output/"
job_name = f"{self.cnf.SAGEMAKER_MODEL}-{str(datetime.datetime.now().strftime('%Y-%m-%d-%H-%m-%S'))}"
transform_input = {
'DataSource': {
'S3DataSource': {
'S3DataType': 'S3Prefix',
'S3Uri': batch_input
}
},
'ContentType': 'text/csv',
'SplitType': 'Line',
}
transform_output = {
'S3OutputPath': batch_output
}
transform_resources = {
'InstanceType': self.cnf.SAGEMAKER_BATCH_INSTANCE,
'InstanceCount': 1
}
# self.sm_boto_client is an instance of boto3.Session(region_name="some-region).client("sagemaker")
self.sm_boto_client.create_transform_job(
TransformJobName=job_name,
ModelName=self.cnf.SAGEMAKER_MODEL,
TransformInput=transform_input,
TransformOutput=transform_output,
TransformResources=transform_resources
)
status = self.sm_boto_client.describe_transform_job(TransformJobName=job_name)
print(f'Executing transform job {job_name}...')
while status['TransformJobStatus'] == 'InProgress':
time.sleep(5)
status = self.sm_boto_client.describe_transform_job(TransformJobName=job_name)
if status['TransformJobStatus'] == 'Completed':
print(f'Batch transform job {job_name} successfully completed.')
else:
raise Exception(f'Batch transform job {job_name} failed.')
I am trying to create a kotlin multiplatform project with spring-boot and kotlin/js react
This is the build.gradle.kts am using:
plugins {
id("org.springframework.boot") version "2.7.4" apply false
id("io.spring.dependency-management") version "1.0.14.RELEASE" apply false
kotlin("multiplatform") version "1.7.20"
kotlin("plugin.spring") version "1.7.20" apply false
}
group = "com.examples"
version = "1.0-SNAPSHOT"
repositories {
jcenter()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}
kotlin {
jvm {
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
withJava()
}
js(IR) {
binaries.executable()
browser {
commonWebpackConfig {
cssSupport.enabled = true
}
}
}
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting {
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
}
val jvmTest by getting {
dependencies {
implementation("org.springframework.boot:spring-boot-starter-test")
}
}
val jsMain by getting {
dependencies {
implementation("org.jetbrains.kotlin-wrappers:kotlin-react:18.2.0-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:18.2.0-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion:11.9.3-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom:6.3.0-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-redux:4.1.2-pre.346")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-redux:7.2.6-pre.346")
}
}
val jsTest by getting
}
}
tasks.named<Copy>("jvmProcessResources") {
val jsBrowserDistribution = tasks.named("jsBrowserDistribution")
from(jsBrowserDistribution)
}
However, ./gradlew build throws this
./gradlew clean build
> Configure project :
Kotlin Multiplatform Projects are an Alpha feature. See: https://kotlinlang.org/docs/reference/evolution/components-stability.html. To hide this message, add
'kotlin.mpp.stability.nowarn=true' to the Gradle properties.
The property 'kotlin.mpp.enableGranularSourceSetsMetadata=true' has no effect in this and future Kotlin versions, as Hierarchical Structures support is now en
abled by default. It is safe to remove the property.
The property 'kotlin.native.enableDependencyPropagation=false' has no effect in this and future Kotlin versions, as Kotlin/Native dependency commonization is
now enabled by default. It is safe to remove the property.
> Task :compileKotlinJvm FAILED
e: java.lang.NoSuchMethodError: 'void kotlin.script.experimental.api.KotlinType.<init>(kotlin.reflect.KClass, boolean, int, kotlin.jvm.internal.DefaultConstru
ctorMarker)'
at org.jetbrains.kotlin.scripting.definitions.ScriptCompilationConfigurationFromDefinition$1.invoke(ScriptCompilationConfigurationFromDefinition.kt:32
)
at org.jetbrains.kotlin.scripting.definitions.ScriptCompilationConfigurationFromDefinition$1.invoke(ScriptCompilationConfigurationFromDefinition.kt:28
)
at kotlin.script.experimental.api.ScriptCompilationConfiguration.<init>(scriptCompilation.kt:23)
at kotlin.script.experimental.api.ScriptCompilationConfiguration.<init>(scriptCompilation.kt:25)
at org.jetbrains.kotlin.scripting.definitions.ScriptCompilationConfigurationFromDefinition.<init>(ScriptCompilationConfigurationFromDefinition.kt:27)
at org.jetbrains.kotlin.scripting.definitions.ScriptDefinition$Companion.getDefault(ScriptDefinition.kt:221)
at org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationExtension.updateConfiguration(ScriptingCompilerConfigurationExtension.
kt:67)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.configureProjectEnvironment(KotlinCoreEnvironment.kt:578)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:199)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:108)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:445)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:192)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:143)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:99)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:47)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:475)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:125)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:373)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:318)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.rebuild(IncrementalCompilerRunner.kt:114)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:207)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:79)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:625)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:101)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1746)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':compileKotlinJvm'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Internal compiler error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
9 actionable tasks: 7 executed, 2 up-to-date
How to fix this?
Note that if I use version 1.6.21 (as suggested by https://start.spring.io/) for kotlin multiplatorm and kotlin spring plugin, then compiler is unable to resolve imports related to kotlin/js react
import kotlinx.browser.document
import react.create
import react.dom.client.createRoot
I created a testcase with Protractor-cucumber framework and I have used Grunt for execution of that test case. However, at the time of execution it failed and it's not providing any error stacktrace to know why it is failing.
I've searched Google and also reviewed other Stack Overflow solutions but I didn't find a solution for this.
Config File
exports.config = {
//seleniumAddress: 'http://localhost:4444/wd/hub',
getPageTimeout: 60000,
allScriptsTimeout: 500000,
directConnect:true,
framework: 'custom',
// path relative to the current config file
frameworkPath: require.resolve('C:\\...\\node_modules\\protractor-cucumber-framework'),
capabilities: {
'browserName': 'chrome'
},
ignoreUncaughtExceptions:true,
// Spec patterns are relative to this directory.
specs: [
'./learnFramework/utility/test.feature'
],
cucumberOpts: {
require: './learnFramework/TestCases/spec.js',
tags: false,
profile: false,
'no-source': true
},
onPrepare: function () {
browser.ignoreSynchronization=true;
browser.manage().window().maximize();
}
};
Spec File
module.exports=function(){
this.Given(/^Open the browser and Load the URL$/,async function(){
browser.get("https://google.com");
});
this.When(/^User entered the text in the search box$/,async function(){
browser.sleep(5000);
console.log(await browser.getTitle());
await element(By.name("q")).sendKeys("facebook");
browser.sleep(3000);
});
this.Then(/^click on search$/,async function(){
browser.action().sendKeys(protractor.Key.ENTER).perform();
browser.sleep(5000);
});
}
Error Log
Running "jshint:files" (jshint) task
>> 1 file lint free.
>
Running "protractor:singlerun" (protractor) task
[00:08:29] I/launcher - Running 1 instances of WebDriver
[00:08:29] I/direct - Using ChromeDriver directly...
>
DevTools listening on ws://127.0.0.1:50146/devtools/browser/5c09d68c-f3ff-43b2-b645-0b5c098c41d9
Feature: Title of your feature
>
I want to use this template for my feature file
>
Scenario: Title of your scenario
✓ Given Open the browser and Load the URL
✖ When User entered the text in the search box
- And click on search
>
Failures:
>
[00:09:03] I/launcher - 0 instance(s) of WebDriver still running
[00:09:03] I/launcher - chrome #01 failed 1 test(s)
[00:09:03] I/launcher - overall: 1 failed spec(s)
[00:09:03] E/launcher - Process exited with error code 1
>>>
>>> Test failed but keep the grunt process alive.
>
Done.
If you observe the error log "When" step has failed but there is no error stacktrace in the command line to find why it failed.
My expectation is that it should show the error stacktrace for why it has failed.
You need to use await on your browser actions otherwise it performs the actions synchronously.
e.g
await browser.get("https://google.com");
This is my lane
lane :alpha do
begin
version_code = increment_version_code(
gradle_file_path: "./app/build.gradle"
)
gradle(task: "clean assembleRelease --info")
supply(
track: "alpha",
apk: "#{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]}"
)
git_commit(
path: "./app/build.gradle",
message: "Fastlane Android: Release new build #{version_code} [ci skip]"
)
on_success()
rescue => exception
on_error(exception)
end
end
On local machine gradle works perfect and the build is created and supply finishes successfully. On Bitrise I have this error:
FAILURE: Build failed with an exception.
[13:58:23]: ▸ * What went wrong:
[13:58:23]: ▸ Execution failed for task ':app:bundleReleaseJsAndAssets'.
[13:58:23]: ▸ > Could not list contents of '/bitrise/src/node_modules/metro/node_modules/jest-haste-map/node_modules/.bin/sane'. Couldn't follow symbolic link.
When I run mvn install goal with progurad option then am getting the following error. Previously, I don't have this error. I could not find what has made the difference in getting the following error:
proguard.ParseException: Unknown option '-encryptstrings' in line .. of file 'proguard.cfg'
I am using dexguard for my project. is this error because of the maven could not identify the dexguard folder location?
proguard.cfg content:
-dalvik -- unknown option
-android -- unknown option
# Encrypt all strings -- parse exception
-encryptstrings '???*'
The following works with out issues:
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic
-optimizationpasses 30
-allowaccessmodification
-dontpreverify
-dontoptimize
-ignorewarnings
-renamesourcefileattribute Maviance
-keepattributes SourceFile,LineNumberTable,*Annotation*
-keep,allowshrinking,allowobfuscation class android.support.**Compat* { *; }
The option -encryptstrings '???*' is only supported by DexGuard. So when you use ProGuard to build your application, you will receive such an error.
Thus it is advised to separate the dexguard related configuration into a separate config file dexguard-project.txt that is only included when using DexGuard.
I had the same error using dexguard. The problem was that I was missing this line
proguardFiles getDefaultDexGuardFile('dexguard-debug.pro')
So gradle took Proguard instead of Dexguard, which obviously doesn´t have the encryptstrings feature. So the working release configuration is this:
release {
debuggable true
minifyEnabled true
proguardFiles getDefaultDexGuardFile('dexguard-debug.pro')
signingConfig signingConfigs.release
}