Code groovy in JSR233 PostProcessor is not executed when jmeter test-plan is built with maven - maven-plugin

I have a project jmeter which performs for each route's HTTP request a lot of groovy code with JSR223 Post Processor
This performing works very fine when I work with jmeter GUI or non-GUI mode, and it is consolidated in my test environment.
Now I'm passing to build this jmeter project with maven, but I'm facing that the groovy code in JSR223 post processor is not performed, and this is not good for the process, because the rest of next routes are not able to work properly, because for example some variables are not set.
What are the steps to configure in maven process to build and/or interpret groovy code? and in general: JSR233 Post-processoe, pre-processor and other similar pre/post processor?
Thanks.

If you're using JMeter Maven Plugin you don't need to do anything, JSR223 Test Elements will be executed just line in GUI or non-GUI mode.
In case you're under impression that they are not executed - take a look at jmeter.log file, it should be under target/jmeter/logs folder, if a JSR223 element fails - you will see the failure reason there.

I have solved the issue.
The root cause was in a http POST request , which failed and then it didn't trigger nested and next groovy code.
The POST was failing for an error code 403 (Forbidden) .
Then I have observed that was necessary to import in the project by pom.xml the variable:
<CookieManager.save.cookies>true</CookieManager.save.cookies>
which allows the project to handle the cookies.
In effect when I was working with Jmeter in GUI mode, that variable was set in user.properties file under /bin folder and it was working fine

Related

Configuring Groovy on Jenkins

I'm using Jenkins ver 2.121.2. I'm trying to configure the Groovy plugin to run groovy scripts via a Jenkins job. The plugin documentation provided here
does not appear to match the UI I see in the System Configuration - Groovy section of this version of Jenkins. The various parameters don't match and so far I'm unable to get the plugin to run a simply groovy script. Not being familar with java and how the classpath works I'm not able to loosely interpret the instructions and get it working. If anyone can point me at documentation that more closely matches the Groovy plugin with the most current version of Jenkins I would appreciate it.
First, you need to configure an instance (or instances) of Groovy to run scripts in your builds. You do that on the Global Tool Configuration page.
You should have a least one JDK configured in the Global Tools Configuration (or have JAVA_HOME defined).
You can have Jenkins install the version of Groovy you want (on first use), or you can install Groovy yourself and point to it as in the example below:
Once this is in place, you can use the Execute Groovy Script build step in a build:

How to modify auto generated service-worker in Create-React-App

I have created a sample app from Create-React-App library. When I ran the build command then it generates a service-worker on its own using cache-first strategy.
But I need some more functionality like cache some API responses n all. I don't know how to modify the script which includes my own code in auto generated service-worker.
I have found some help lines for my case but these are not enough to get a whole understanding of it.
By default, the generated service worker file will not intercept or cache any cross-origin traffic, like HTTP API requests, images, or embeds loaded from a different domain. If you would like to use a runtime caching strategy for those requests, you can eject and then configure the runtimeCaching option in the SWPrecacheWebpackPlugin section of webpack.config.prod.js.
Above paragraph is from official doc
Thanks in advance!
We had a similar problem while working on a project recently and we didn't want to "eject". We created a little tool that allows you to append custom service worker code to the one generated by CRA.
Have a look here: https://github.com/bbhlondon/cra-append-sw
You would can run npm run eject and get access to the underlying Webpack configuration.
Once you do that, the webpack.config.prod.js file can be modified to adjust your generated service worker. Look for the section that configures SWPrecacheWebpackPlugin.
You can add in an additional runtimeCaching configuration option to that section to accommodate your runtime caching needs.

How to add an arbitrary script hook before appEngine compileJava task is executed

I am building a Google App Engine (GAE) project under Android Studio. I want to be able to have different "buildTypes" similar to how one can do for an android app project, however this is not supported by the appEngine Gradle plugin (see https://github.com/GoogleCloudPlatform/gradle-appengine-plugin/issues/177). As a workaround, I want to run some kind of script (e.g.: ant, bash, or similar), to do some arbitrary command prior to the build, so that I can copy or rename the right source files into place for the build. Unfortunately, being somewhat unfamiliar with Gradle, I am at a loss of how to do that. I've been reading the Gradle documentation but have been unable to discover how to add a hook before the :backend:compileJava task is executed. Can anyone explain how I might be able to do this?
If you haven't solved this yet
You can have any task depend on any other :
task myPrecompileTask {
doLast {
// execute some code here
}
}
compileJava.dependsOn myPrecompileTask
That will force any call to compileJava to call myPrecomileTask first.

Elementor. How to make it use protractor.conf?

I started adding e2e tests into our project and it seems a few things changed since the last time I used Protractor. For example elementExplorer still useful, but Elementor is way more cooler.
In its the readme is says to launch it by running e.g.: webmanager start and then elementor http://localhost:3000.
But this way it ignores protractor.conf. And since I have a binary path for Chrome browser in that file, along with a logic for clearing cookies and logging into the app in onPrepare function, protractor has to know where the file is. But I can't find a way.
Starting protractor as usual via protractor protractor.conf.coffee and then elementor localhost:3000 not working either. It says "Unable to start a WebDriver session"
Yes, you should launch it by running webdriver-manager start, I use this to run the scripts: protractor script_file_conf.js since I save my scripts as javascript code in my repository. Remember that the conf file should have a reference to the script file.

How to package react-native application

I am building a sample react native application. Currently i am running it using the node server.Node server is serving the js file.
You can see this in following screenshot:
I want to shift to the option2, for this, if there is any change in the js file, i need to run the curl command manually.
Is there any alternative for this?
AFAIK there's nothing in place and this is work in progress. See:
https://github.com/facebook/react-native/issues/12
We plan on putting in some sort of build step that "compiles" the JS
source directly into a resource file in the app bundle. Obviously in
production you wouldn't have a server running nearby.
There's another bit of discussion here.
At the moment I think you're stuck with the curl option.
All this does is packing all your JavaScript together and writing it into a single file.
Option 1 has a small http server running, providing the latest packed file when you request it.
Option 2 takes the file from the local disk.
You can setup a tool that looks watches your project files and repacks everything if you make changes.
You can do this by yourself, using the packaging tool shipped with react-native (react-native bundle [--minify]) and re-run it everytime things changes using gulp (and gulp-watch).
Also you can use webpack as your packaging tool and use the --watch option. (see example)

Resources