I am using the and I get error
import package is not defined at line 2
when switching to groovy or java. I am using version 3.1 jmeter and java version 1.8.0.
the sampler is jp#jc
Line 2 is
import java.io.File;
I am tried moving down to java1.7 but this does not work either
Related
I have to build JMeter script using JSR223 Sample for chrome, I was wondering if there is a way that I can configure path in the script so that I don't need to host drivers in Jenkins.
In Selenium Automation, I used webdriverManger to download new driver every time https://www.toolsqa.com/selenium-webdriver/webdrivermanager/
JSR223 Sampler:
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.support.ui.WebDriverWait;
**System.setProperty("webdriver.gecko.driver","/Users/geckodriver");**
FirefoxOptions options = new FirefoxOptions().setAcceptInsecureCerts(true);
WebDriver driver = new FirefoxDriver(options);
def wait = new WebDriverWait(driver, 20);
driver.get('https://google.com/');
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//input[#name='q']")));
You can do the same in JMeter:
Download WebDriverManager "fat" jar from the releases page and drop it to "lib" folder of your JMeter installation or at any other place in JMeter Classpath
Restart JMeter to pick the .jar up
Replace your
**System.setProperty("webdriver.gecko.driver","/Users/geckodriver");**
with
io.github.bonigarcia.wdm.WebDriverManager.firefoxdriver().setup()
Enjoy
More information and another trick you can play: How to Reuse Your JMeter Code with JAR Files and Save Time
2020-03-19 10:28:54,395 WARN o.a.j.e.BeanShellPostProcessor: Problem in BeanShell script: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import java.io.*; import java.util.*; import org.json.JSONObject; import org.jso . . . ''
2020-03-19 10:29:54,532 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import java.io.*; import java.util.*; import org.json.JSONObject; import org.jso . . . '' : Typed variable declaration : Class: JSONParser not found in namespace
I added the relaevant jar files in lib folder of jmeter and also added jar files in “Add directory or jar to classpath” but getting issues shown below
You need to restart JMeter to pick up the .jar files you added to JMeter Classpath
Since JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting so consider migrating to JSR223 PostProcessor. Moreover Groovy has built-in JSON support so most probably you won't need these extra libraries at all. See Apache Groovy - Why and How You Should Use It article for more details.
I am using Maven and cucumber in test automation.
How can I use camelCase while writing my codes as cucumber is using snakeCase by default.
Is there a way to manage it in pom.xml file in maven?
btw, my IDE is VS Code.
Tnx
If you are using cucumber-junit you can add #CucumberOptions to your JUnit4 runner class.
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
import static io.cucumber.junit.CucumberOptions.SnippetType.CAMELCASE;
#RunWith(Cucumber.class)
#CucumberOptions(snippets = CAMELCASE)
public class RunCucumberTest {
}
You can also create a cucumber.properties file in src/test/resources containg:
cucumber.snippet-type=camelcase
If you're using cucumber-junit-platform-engine this file should be name junit-platform.properties.
The step definitions are using snake case rather than camel case. We just need to tell Cucumber that's what we want:
java -cp "jars/*" cucumber.api.cli.Main -p pretty --snippets camelcase features
Now when we run ./cucumber it generates snippets with method names that conform t the Java standard
from The Cucumber for Java book
unable to resolve class org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap
# line 4, column 1.
import org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap
This happened when I upgraded grails from 2.2.4 to 3.1.3.
Is there some new place I need to import this too? Or is there a dependency I need to add to my gradle build file?
See step 5 on this page, https://docs.grails.org/3.0.x/guide/upgrading.html
Step 5 - Modify Package Imports In Grails 3.x all internal APIs can be
found in the org.grails package and public facing APIs in the grails
package. The org.codehaus.groovy.grails package no longer exists.
All package declaration in sources should be modified for the new
location of the respective classes. Example
org.codehaus.groovy.grails.commons.GrailsApplication is now
grails.core.GrailsApplication.
I am trying to enable SSO on a WAS 8.5, which is installed on an AS400, and for this I need to use the following classes in java:
import com.ibm.eim.token.IdentityToken;
import com.ibm.jca.idtoken.ConnectionFactoryImpl;
import com.ibm.jca.idtoken.ConnectionSpecImpl;
import com.ibm.jca.idtoken.IdentityTokenFactory;
I found the package com.ibm.eim in \QIBM\ProdData\OS400\security\eim on the WAS server. However, I cannot find the package com.ibm.jca.idtoken in the file system nor on the IBM Knowledge Center website either. Where can I get it ?
Okay I finally found it. It is here in a jar in a jar in a rar file :
com.ibm.jca.idtoken:
\QIBM\ProdData\OS400\security\eim\idTokenRA.rar\idTokenRA.jar\com\ibm\jca\idtoken\
com.ibm.eim.token:
\QIBM\ProdData\OS400\security\eim\idTokenRA.rar\idToken.jar\com\ibm\eim\token\