-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add support for SmtpSampler #191
Comments
Thank you for reporting this. I guess you are getting this while using jmx2dsl, right? |
Hello, since we haven't yet implemented specific logic for smtpsampler (requested here), and in consequence haven't added associated dependencies, the jmx2dsl command fails with the error you get. Until we don't implement support for smtp sampler you might use as a workaround something like this: java -cp jmdsl.jar:ApacheJMeter_mail-5.5.jar:mail-1.5.0-b01.jar us.abstracta.jmeter.javadsl.cli.Cli jmx2dsl smtp.jmx Downloading the additional jars from here and here, or copying them (or even pointing in the command line to them) from JMeter lib folder. With that you would get a functional, but not yet "optimized", conversion using existing support for wrappers. I hope this helps. Regards |
Closing this as SMTP sampelr has already been requested here. |
Thanks let me try thsi out. |
GoogleTest.zip java -jar jmdsl.jar jmx2dsl GoogleTest.jmx Error I am getting is : Cause: Detail:com.thoughtworks.xstream.converters.ConversionException:
|
Hello, thank you for sharing the JMX! Downloading the selenium webdriver plugin zip from here, unzipping it, and running jmx2dsl like this: java -cp "jmdsl.jar:lib/ext/*:lib/*" us.abstracta.jmeter.javadsl.cli.Cli jmx2dsl GoogleTest.jmx I was able to get the following DSL: ///usr/bin/env jbang "$0" "$@" ; exit $?
/*
These commented lines make the class executable if you have jbang installed by making the file
executable (eg: chmod +x ./PerformanceTest.java) and just executing it with ./PerformanceTest.java
*/
//DEPS org.assertj:assertj-core:3.23.1
//DEPS org.junit.jupiter:junit-jupiter-engine:5.9.1
//DEPS org.junit.platform:junit-platform-launcher:1.9.1
//DEPS us.abstracta.jmeter:jmeter-java-dsl-wrapper:1.22
//DEPS us.abstracta.jmeter:jmeter-java-dsl:1.22
import static org.assertj.core.api.Assertions.assertThat;
import static us.abstracta.jmeter.javadsl.JmeterDsl.*;
import static us.abstracta.jmeter.javadsl.wrapper.WrapperJmeterDsl.*;
import com.googlecode.jmeter.plugins.webdriver.config.gui.ChromeDriverConfigGui;
import com.googlecode.jmeter.plugins.webdriver.sampler.gui.WebDriverSamplerGui;
import java.io.IOException;
import java.io.PrintWriter;
import org.apache.jmeter.visualizers.SummaryReport;
import org.junit.jupiter.api.Test;
import org.junit.platform.engine.discovery.DiscoverySelectors;
import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;
import org.junit.platform.launcher.core.LauncherFactory;
import org.junit.platform.launcher.listeners.SummaryGeneratingListener;
import org.junit.platform.launcher.listeners.TestExecutionSummary;
import us.abstracta.jmeter.javadsl.core.TestPlanStats;
public class PerformanceTest {
@Test
public void test() throws IOException {
TestPlanStats stats = testPlan()
.tearDownOnlyAfterMainThreadsDone()
.children(
vars()
.set("email", "\"//input[@type='email']\"")
.set("password", "\"//input[@type='password']\"")
.set("url", "'https://contenttech-platform-load.cas.org/'")
.set("loginButton", "\"//span[text()=' Login ']\"")
.set("userRoleLabel", "\"//*[@ng-reflect-place-holder='User Role']\"")
.set("userRole", "\"//*[@title='ProjectManager']/div[text()='ProjectManager']\"")
.set("exceptionQueue", "\"//*[text()=' Exception ']/span\"")
.set("exceptionCount", "\"//span[text()='Exception']/following::div//a/div\"")
.set("sampledCount", "\"//span[text()='Sampled']/following::div//a/div\"")
.set("noMarkush", "\"//span[text()='No Markush']/following::div//a/div\"")
.set("wc", "\"//span[text()='WC']/following::div//a/div\"")
.set("RF", "\"//span[text()='WC']/following::div//a/div\"")
.set("pendingApproval", "\"//span[text()='Pending Approval']/following::div//a/div\"")
.set("profile", "\"//div[@class='profile-img ff-rb blue-background']\"")
.set("reports", "\"//app-platform-menu/div/div[1]/app-platform-side-bar/div/ul/li[3]/div/div/img\"")
.set("productionReport", "\"//li[text()='Production Report']\""),
threadGroup(1, 1,
testElement(new ChromeDriverConfigGui())
.prop("ChromeDriverConfig.chromedriver_path", "chromedriver.exe")
.prop("ChromeDriverConfig.android_enabled", false)
.prop("ChromeDriverConfig.headless_enabled", false)
.prop("ChromeDriverConfig.insecurecerts_enabled", false)
.prop("ChromeDriverConfig.incognito_enabled", false)
.prop("ChromeDriverConfig.no_sandbox_enabled", false)
.prop("ChromeDriverConfig.disable_dev_shm_usage", false)
.prop("WebDriverConfig.driver_path", "C:\\Users\\bps29\\Downloads\\chromedriver-win64\\chromedriver-win64\\chromedriver.exe"),
testElement(new SummaryReport()),
testElement("PT_01_GoogleSearch", new WebDriverSamplerGui())
.prop("WebDriverSampler.script", "var pkg = JavaImporter(org.openqa.selenium);\n"
+ "WDS.sampleResult.sampleStart();\n"
+ "WDS.browser.get(\"https://google.com\");\n"
+ "var searchField = WDS.browser.findElement(pkg.By.xpath(\"//textarea[@title='Search']\"));\n"
+ "searchField.sendKeys(\"Selenium\");\n"
+ "java.lang.Thread.sleep(5000)")
.prop("WebDriverSampler.language", "javascript"),
resultsTreeVisualizer()
)
).run();
assertThat(stats.overall().errorsCount()).isEqualTo(0);
}
/*
This method is only included to make the test class self-executable. You can remove it when
executing tests with maven, gradle, or some other tool.
*/
public static void main(String[] args) {
SummaryGeneratingListener summaryListener = new SummaryGeneratingListener();
LauncherFactory.create()
.execute(LauncherDiscoveryRequestBuilder.request()
.selectors(DiscoverySelectors.selectClass(PerformanceTest.class))
.build(),
summaryListener);
TestExecutionSummary summary = summaryListener.getSummary();
summary.printFailuresTo(new PrintWriter(System.err));
System.exit(summary.getTotalFailureCount() > 0 ? 1 : 0);
}
} If you plan to run this in a project, make sure that the jmeter plugin is added as dependency to it. Eg: <dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-webdriver</artifactId>
<version>4.10.0.0</version>
</dependency> And also the jmeter dsl wrapper module: <dependency>
<groupId>us.abstracta.jmeter</groupId>
<artifactId>jmeter-java-dsl-wrapper</artifactId>
<version>1.22</version>
</dependency> On top of the usual junit & jmeter dsl dependencies. |
Hello, The first issue might be related to maven respositories configuration, or you may need to tell intellij to update maven index (check the intellij tip you get when hovering the plugin version, or try to do a Regarding your second issue, that class is part of |
Thanks for your help. It worked :) |
Hello , while running converted DSL code into IntelliJ i am getting below error for SummaryReport.java. java.lang.ExceptionInInitializerError |
Can you try adding this (with proper import) before test plan creation? |
That is a problem from the webdriver plugin. Was the JMX working fine and only de resulting DSL not working? Maybe you have to fix the path pointing to the chrome driver? or update the chrome driver? or maybe you are missing some dependency in pom.xml? |
again started facing issue while conversion. getting same error as above. i have put all jmx, API under src folder. and i am running command from src folder itself. Please look attached image. |
Feature request for SmtpSampler support
Thank you!
The text was updated successfully, but these errors were encountered: