Pitest not finding test cases - junit5

I'm integrating mutaiton testing using pitest plugin in my intellij
here is my plugin for pitest
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>mutationCoverage</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>0.12</version>
</dependency>
</dependencies>
<configuration>
<outputFormats>
<outputFormat>XML</outputFormat>
<outputFormat>HTML</outputFormat>
</outputFormats>
<mutationThreshold>0</mutationThreshold>
<threads>2</threads>
<verbose>true</verbose>
<testPlugin>junit</testPlugin>
<targetClasses> <!-- target classes was found to be needed when setting up
with sonar -->
<param>com.mypackage.controller.*</param>
<param>com.mypackage.service.*</param>
</targetClasses>
<targetTests> <!-- target tests was found to be needed when setting up with
sonar -->
<param>com.mypackage.rootfolder.*</param> <!-- update to point to the
tests that cover your functional code -->
</targetTests>
</configuration>
</plugin>
i get this ouptut when i run pitest runner in my ide , its not
detecting the test classes
even though the path i provided in configuration is correct , Please advise
11:45:30 AM PIT >> INFO : Verbose logging is disabled. If you
encounter a problem, please enable it before reporting an issue.
11:45:31 AM PIT >> INFO : Sending 14 test classes to minion 11:45:31
AM PIT >> INFO : Sent tests to minion 11:45:31 AM PIT >> INFO : MINION
: 11:45:31 AM PIT >> INFO : Checking environment 11:45:32 AM PIT >>
INFO : MINION : 11:45:32 AM PIT >> INFO : Found 0 tests 11:45:32 AM
PIT >> INFO : MINION : 11:45:32 AM PIT >> INFO : Dependency analysis
reduced number of potential tests by 0 11:45:32 AM PIT >> INFO :
MINION : 11:45:32 AM PIT >> INFO : 0 tests received 11:45:32 AM PIT >>
INFO : Calculated coverage in 1 seconds.

Related

gatling report can't be generated [duplicate]

This question already has answers here:
GatlingSystem-akka.actor.default-dispatcher-2 error - crashed with 'j.l.NullPointerException' when running Karate Gatling test
(2 answers)
Closed 1 year ago.
With a recent change to our codebase we're starting to get the following error.
Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated
We changed nothing with our gatling setup compared to our master branch in which the tests do continue working fine.
The only meaningful change we made in the feature files was the usage of custom java code to fetch an api-key stored in our secret manager.
Said code is called so:
* def AwsUtil = Java.type('be.telenet.yelo.qrcode.util.AwsUtil');
* def apiKey = AwsUtil.getParameterFromSSMByName(ssmApiKeyName, proxyFlag)
Behind this function is a simple AWS SDK getParameter call which works fine in the regular karate cucumber runs and the tests seem indeed to run as well during the karate run because we are getting results:
Karate version: 0.9.6
======================================================
elapsed: 9.11 | threads: 5 | thread time: 36.70
features: 3 | ignored: 0 | efficiency: 0.81
scenarios: 15 | passed: 15 | failed: 0
======================================================
Yet at the end of the run gatling says no calls have been made.
Some more config for our gatling setup:
<profile>
<id>load</id>
<activation>
<property>
<name>load</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<simulationsFolder>src/test/java</simulationsFolder>
<includes>
<include>KarateSimulation</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Is there anyone who has experienced similar issues and who might be able to help?
Kind regards
My guess is that some library in the AWS utils conflicts with some of the Gatling ones. It may require some digging into JAR dependency trees.
One hint - if the API key retrieval is an HTTP call behind the scenes, guess what Karate is really good at.

Change fitNesse port through Eclipse

Using Eclipse, I have created a Fitnesse framework.
When I run the simple calculator example (Right Click - Run as java app) my console throws the error -
Starting FitNesse on port: 80
SEVERE: FitNesse cannot be started...
SEVERE: Port 80 is already in use.
SEVERE: Use the -p command line argument to use a different port.
I do not want to use the command line to manually change the default port.
I want to change it through Eclipse? How do I do this? I am new to this so please explain plainly.
Many thanks,
Within Eclipse, when you right click the project, to "Run as Java Application", that same dropdown has an option to "Run Configurations", choose this. In the pop up modal that will appear, we can enter -p port# as an argument. Save and Close. Now "Run as Java Application".
you need to modify file bulid.gradle
open the gradle file and find task run, set port 80
task run(type: JavaExec) {
dependsOn classes, copyRuntimeLibs
classpath = sourceSets.main.runtimeClasspath
main "fitnesseMain.FitNesseMain"
args "-p", "80", "-e", "0"
}
build fitnesse preject and run FitnesseMain
If you are using Maven rather gradle, try using antrun plugin and specify port number in the task args. Then, run start-fitnesse task
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>start-fitnesse</id>
<phase>test</phase>
<configuration>
<tasks>
<echo taskname="fitnesse" message="Starting FitNesse..." />
<java classname="fitnesseMain.FitNesseMain" classpathref="maven.runtime.classpath"
fork="true">
<arg line="-p 49231" />
<arg line="-v " />
<arg line="-d ." />
</java>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

install4j 5.1.5 - Signing: disable at command line or maven plugin not possible

Today I integrated the signing process to our project. It works fine. Now I tried to disable the signing process at the maven-plugin:
<plugin>
<groupId>org.sonatype.install4j</groupId>
<artifactId>install4j-maven-plugin</artifactId>
<version>1.0.5</version>
<executions>
<execution>
<id>build-installer</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<projectFile>${project.build.outputDirectory}/${install4j.projectFile}</projectFile>
<destination>${project.build.directory}/installer</destination>
<disableSigning>${disableSigning}</disableSigning>
<!-- password for keystore has to be set as system property -->
<winKeystorePassword>${certificate.keystore.psw}</winKeystorePassword>
</configuration>
</execution>
</executions>
</plugin>
Then I was calling our maven build with the following command:
mvn clean prepare-package -DdisableSigning=true
and got the following error message:
[INFO] --- install4j-maven-plugin:1.0.5:compile (build-installer) # ForumViewerInstaller ---
[INFO] install4j: Unknown option '--disable-signing'
[INFO] Usage: install4jc [OPTIONS] [config file]
[INFO] Try 'install4jc --help for more information'
It looks like the maven-plugin is not compatible with install4j 5 anymore, is it? Or could it be a problem with my install4j configuration?
Thanks for any solution
Hardie
This is a bug that will be fixed in install4j 5.1.11. Currently only the short form -u works.

Trying to run a pack of selenium tests written in java using Jenkins

After reading nearly all the posts that it suggests under "Questions with similar titles" (I will continue reading after sending this post) and reading
centripetal.ca/blog/2011/02/07/getting-started-with-selenium-and-jenkins/
oliverpolden.com/content/setting-automated-selenium-testing-jenkinshudson
and some other posts (I note these two because I think they may be useful to someone) I haven't found an answer to what I need. And now I get to that:
I'm working in a company that uses Jenkins for CI and maven. They have three types of tests ran for the sotware: junit, cactus and selenium. Jenkins has a job to run junit tests. Now they've decided to run the other two types of tests (Cactus and Selenium) using Jenkins. And that's my task. Cactus would be another question I'll ask later (have been banging my head with that one for too long right now). The Selenium tests are written in java and there's a java file that has all the tests as it follows:
package com.mycompany.test.dailySanity;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
#RunWith(Suite.class)
#Suite.SuiteClasses({
Test1.class,
Test2.class,
Test3.class,
})
public class AllTests {
/**
* This is just a place holder.
* Add All your TestClass one to the list above.
* NOTE, the TestClasses should be "," separated
*/
}
All the information I've found talks about an htmlsuite, but nothing about if the tests are in java (no, exporting them to HTML is not an option). I've tried
export DISPLAY=":99" && java -jar /path/to/selenium-server.jar
-browserSessionReuse -htmlSuite *firefox http://localhost
/path/to/my/testsfile/AllTests.java
/path/to/my/logfile/SeleniumLog.html
as an "Execute Shell" in "Build" step in Jenkins job, but it just stays trying something.
Console output
09:29:48.508 INFO - Java: Sun Microsystems Inc. 14.2-b01
09:29:48.518 INFO - OS: Linux 2.6.18.8-xenU amd64
09:29:48.654 INFO - v2.4.0, with Core v2.4.0. Built from revision 13337
09:29:49.263 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
09:29:49.264 INFO - Version Jetty/5.1.x
09:29:49.269 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
09:29:49.271 INFO - Started HttpContext[/selenium-server,/selenium-server]
09:29:49.271 INFO - Started HttpContext[/,/]
09:29:49.337 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#7a187814
09:29:49.337 INFO - Started HttpContext[/wd,/wd]
09:29:49.343 INFO - Started SocketListener on 0.0.0.0:4444
09:29:49.343 INFO - Started org.openqa.jetty.jetty.Server#67ad77a7
10:51:00.038 INFO - Shutting down...
10:51:00.040 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]
I assume it does nothing else (waited for 2 hours before aboting it) beacause it's a java file and it requires an html file (-htmlsuite is a clue).
To sum up: I need a way to run Selenium tests written in Java and packaged in a java suite on Jenkins.
EDITING
Ok, I'm not getting anywhere and running out of time. I'm adding more information just in case someone can give me a hand (not that I'm not thankful to Ross). Here goes my selenium_pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.company</groupId>
<artifactId>selenium-test</artifactId>
<version>0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
<artifactId>selenium-java-client-driver</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Skip the normal tests, we'll run them in the integration-test phase -->
<skip>true</skip>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>/path/to/my/tests/AllTests.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When I run
mvn -f selenium_pom.xml integration-test
I get the following output
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.kana.sem:selenium-test:jar:0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. # line 44, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building selenium-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) # selenium-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /path/to/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # selenium-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) # selenium-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /path/to/resources/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # selenium-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) # selenium-test ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) # selenium-test ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO]
[INFO] --- selenium-maven-plugin:2.1:start-server (default) # selenium-test ---
Launching Selenium Server
Waiting for Selenium Server...
[WARNING] OS appears to be Unix and no DISPLAY environment variable has been detected. Browser maybe unable to function correctly. Consider using the selenium:xvfb goal to enable headless operation.
[INFO] User extensions: /localhome/kana/p4/dev/BOT/target/selenium/user-extensions.js
08:05:07,166 INFO [org.openqa.selenium.server.SeleniumServer] Java: IBM Corporation 2.3
08:05:07,173 INFO [org.openqa.selenium.server.SeleniumServer] OS: Linux 2.6.18.8-xenU x86
08:05:07,184 INFO [org.openqa.selenium.server.SeleniumServer] v2.9.0, with Core v2.9.0. Built from revision 14289
08:05:07,273 INFO [org.openqa.selenium.server.SeleniumServer] RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
08:05:07,277 INFO [org.openqa.jetty.http.HttpServer] Version Jetty/5.1.x
08:05:07,686 INFO [org.openqa.jetty.util.Container] Started org.openqa.jetty.jetty.servlet.ServletHandler#51fe51fe
08:05:07,687 INFO [org.openqa.jetty.util.Container] Started HttpContext[/wd,/wd]
08:05:07,687 INFO [org.openqa.jetty.util.Container] Started HttpContext[/,/]
08:05:07,688 INFO [org.openqa.jetty.util.Container] Started HttpContext[/selenium-server,/selenium-server]
08:05:07,689 INFO [org.openqa.jetty.util.Container] Started HttpContext[/selenium-server/driver,/selenium-server/driver]
08:05:07,705 INFO [org.openqa.jetty.http.SocketListener] Started SocketListener on 0.0.0.0:4444
08:05:07,705 INFO [org.openqa.jetty.util.Container] Started org.openqa.jetty.jetty.Server#40e640e6
08:05:07.916 INFO - Checking Resource aliases
Selenium Server started
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default) # selenium-test ---
[INFO] No tests to run.
[INFO] Surefire report directory: /path/to/surefire-reports/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.387s
[INFO] Finished at: Fri Jan 13 08:05:08 CST 2012
[INFO] Final Memory: 12M/30M
[INFO] ------------------------------------------------------------------------
I'm using perforce, Jenkins, maven3 and Red Hat Enterprise Linux Server release 5.5 (Tikanga). I'm sure my pom is one of the problems, but got it from internet samples...
Thanks (and congratulations to all that have finished reading this post!)
PS: If you also know how to get a report from the Selenium tests that would be great.
The -htmlsuite option is for something completely different from what you're trying to do. Don't let it distract you :-)
Your Java code appears to be written so that the tests are executed via JUnit. That's a very common technique. I expect all you need to do is make sure the Selenium RC server is running before the tests begin. Just java -jar /path/to/selenium-server.jar and leave it running until at least the end of the last test. Your tests will contact the server by creating a connection to it, probably by calling new DefaultSelenium(...).
Jenkins is very well integrated with Maven, so I suggest you concentrate on running the tests using Maven rather than Jenkins. You can use the failsafe plugin to run integration tests such as your selenium tests. Jenkins will automatically find the failsafe reports and show a pretty HTML summary. Also, you can test this more easily on your local machine.
Please can you update your post to clarify whether you're using Selenium 1 or 2. RemoteWebDriver looks like v2, but your POM shows selenium-java-client-driver from 1.0

Help with Selenium Maven Cargo

I am trying to use cargo to deploy and start my container (which works fine), and then use selenium to execute some UI tests.
Whenever I try to run (mvn clean integration-test), I get to the point where it says
Launching Selenium Server
Waiting for Selenium Server...
[INFO]Redirecting output to
[INFO]User extensions
But then my integration tests never get executed by surefire. Any help is much appreciated. It seems like the Selenium Server never gets started.
One quick note, I am using JUnit 4.4
I tried using ANT instead, to copy over the selenium-server and start selenium that way. When I do that, my integration tests run, but I got the following error, which is why I was trying to use the selenium-maven-plugin.
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.3 sec <<< FAILURE!
testAllCriticalPagesLoadWithoutError(com.adminserver.pas.test.SimpleSmokeTest) Time elapsed: 0.29 sec <<< ERROR!
java.lang.RuntimeException: Could not start Selenium session: NUL
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
at com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:123)
at com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:104)
at com.thoughtworks.selenium.SeleneseTestCase.setUp(SeleneseTestCase.java:78)
at com.adminserver.pas.test.BaseSeleniumTest.setUp(BaseSeleniumTest.java:69)
at com.adminserver.pas.test.SimpleSmokeTest.setUp(SimpleSmokeTest.java:22)
at junit.framework.TestCase.runBare(TestCase.java:132)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
Here is the relevant snippets in my pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>start-selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
</execution>
</executions>
<configuration>
<timeout>30</timeout>
<background>true</background>
<port>4444</port>
<logOutput>true</logOutput>
<verifyBrowser>*iexplore</verifyBrowser>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<skip>true</skip>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
Here is the output from the selenium server.log file:
11:35:51,542 INFO [org.openqa.selenium.server.SeleniumServer] Java: Sun Microsystems Inc. 1.5.0_19-b02
11:35:51,542 INFO [org.openqa.selenium.server.SeleniumServer] OS: Windows 2003 5.2 x86
11:35:51,592 INFO [org.openqa.selenium.server.SeleniumServer] v1.0.1 [2697], with Core v#VERSION# [#REVISION#]
11:35:51,712 INFO [org.mortbay.http.HttpServer] Version Jetty/5.1.x
11:35:51,712 INFO [org.mortbay.util.Container] Started HttpContext[/,/]
11:35:51,722 INFO [org.mortbay.util.Container] Started HttpContext[/selenium-server,/selenium-server]
11:35:51,722 INFO [org.mortbay.util.Container] Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:35:51,732 INFO [org.mortbay.http.SocketListener] Started SocketListener on 0.0.0.0:4444
11:35:51,732 INFO [org.mortbay.util.Container] Started org.mortbay.jetty.Server#bf32c
I got this finally to work. Here are a couple of things that made this work:
JBOSS in the default startup started up its RMI Port on 4444 (that's the same one as Selenium ). Not sure why I this wasn't more blatant obvious, maybe the sequence of runs in the maven file. I added a port to the selenium-maven-plugin configuration, and added a system property of selenim.port to the surefire-plugin, PRESTO, it worked.
My plugin repository for Codehause (which publishes the selenium-maven-plugin) was set to snapshots (DOH). I changed it to the release repo, that seemed to get things moving.
I changed the type of the project to "pom", so it didn't attempt to create a JAR
I don't know if it mattered or not, but I moved the surefire plugin to be AFTER the selenium-maven-plugin