Change fitNesse port through Eclipse - automation

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>

Related

izPack disable debug Window

I'm using Izpack 5.1.2, and according to the documentation, the following is used to enable debugging information:
java -DDEBUG=true -jar installer.jar
java -DSTACKTRACE=true -jar installer.jar
java -DTRACE=true -jar installer.jar
And also:
<guiprefs>
<modifier key="showDebugWindow" value="true"/>
</guiprefs>
As such, i assume to disable the debugging information, so the debug window wouldn't show, i would only need to change the above to false.
Unfortunately, even after setting all the above to false, when i execute the installer, the debug window still shows.
In order to create an exe for the java artifact, i'm wrapping it with launch4j, adding the section to set the java variables to false:
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>l4j-clui</id>
<phase>install</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<jar>target/${installer-output-filename}.jar</jar>
<outfile>target/${installer-output-filename}.exe</outfile>
<classPath>
<mainClass>com.izforge.izpack.installer.bootstrap.Installer</mainClass>
</classPath>
<downloadUrl>http://java.com/download</downloadUrl>
<jre>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<minVersion>1.8.0</minVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64</runtimeBits>
<opts>
<opt>-DTRACE=false</opt>
<opt>-DSTACKTRACE=false</opt>
<opt>-DDEBUG=false</opt>
</opts>
</jre>
....
I can't understand why after setting all the debug variables to false, the debug window still shows.
The problem was not on the IzPack configuration, but on the Launch4J configuration, as the headerType tag was incorrectly configured:
<headerType>console</headerType>
In order to disable the console Output i should have used the gui option:
<headerType>gui</headerType>

Can't run and debug groovy tests under intellij idea

I try to embed groovy test to java project.
I start with spock examples - https://github.com/spockframework/spock-example
Examples is compile and execute by running maven goal test but if i try to run test under intellij idea (ctrl+F10 under test method) it failure with classpath error.
Error running HelloSpockSpec.length of Spock's and his friends' names:
Class 'HelloSpockSpec' not found in module 'spock-example'
I try to apply advices from IntelliJ + Groovy + Spock but it didn't help.
Don't forget to mark the folder as "Test Sources" in IntelliJ
Then it should work as expected :-)
Intellij can automatically add the groovy source as a source directory based on your pom. Add build-helper-maven-plugin config to your maven pom under plugins specifying ${basedir}/src/test/groovy as a source dir:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-groovy-test-source</id>
<phase>test</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/test/groovy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

Intellij set runtime variables for run configuration

I have maven run configuration, where I call:
liquibase:rollback -Dliquibase.rollbackCount=1 -Dliquibase.clearCheckSums=true
Is there any way to display some popup to provide for instance rollbackCount before running the configuration itself instead of editing the configuration?
IntelliJ itself can't prompt you for commandline parameters. But you can achieve this with a workaround:
1) Create a .bat file that prompts you for an input and creates a simple properties file (assuming you're using windows)
#echo off
set /p id="ID: "
echo liquibase.rollbackCount=%id% > config.properties
2) Load the properties file from maven. This uses the properties plugin for maven. If you're already using the plugin the dependency must not be inserted.
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
</dependency>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/config.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
3) Execute the bat before running maven
Edit your run configuration
Add "External Tool" to "Before Launch"
Set Working directory to: $ProjectFileDir$ and Program to your .bat file
When running the program in IntelliJ a commandline should now open with the batch file asking for the ID. Then the properties file will be written, maven executes and loads that file.
Try this:
configure your Maven job in the "Run/Debug Configurations" dialog
set the checkbox Show this page as shown in my screenshot
when you call the run configuration, a dialog appears and it should be possible to edit the field command line or something else
No I don't think there is, but you can duplicate a configuration quite easily using the 'Copy Configuration' button and then have a few similar ones with just the changes you want.

Best practices for integrating QTP with Maven build Scripts? [duplicate]

We need to integrate QTP with Hudson to automatically invoke test suites against the code deployed in Hudson. The build process is based on Maven.
Is there any plugin or something to achieve this? We heard about the Groovy plugin for Hudson; Can we execute it with a Groovy script?
Hudson does not run tests, it takes the output and generates a nice report. You should look at how to make Maven run the tests, and then have Hudson pick up the output to generate a report.
As Michael says, this is a Maven integration issue not a Hudson one. I don't know of a Maven plugin for QTP, but you can use the exec-maven-plugin to invoke an arbitrary executable, and provide arguments to that executable. QTP provides an "Automation" API that you should be able to wrap in a script fairly easily. It won't be a slick integration but may serve your purposes.
Here's an example of the configuration you could use:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>[qtp executable]</executable>
<workingDirectory>/target</workingDirectory>
<arguments>
<argument>[an argument to configure QTP]</argument>
<argument>[another argument to configure QTP]</argument>
</arguments>
</configuration>
</plugin>
An answer to a previous question on invoking QTP from Ant is a good starting point for writing the Automation integration.
Update:
Here's an approach that may work for you. It appears that you can directly invoke the QTP server, passing the name of the test you want executing. So you can use the antrun plugin to invoke the url and direct the output to a target directory. Modify the url and test name to match your environment and QTP should be invoked and the results placed in target/qtp/results.html. This assumes that you have a single test you can invoke to do everything you need to in QTP.
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>test</phase>
<configuration>
<tasks>
<get verbose="true" src="http://[servername]/qtp/LaunchQTP.plx?testname=[test name]"
dest="${project.build.directory}/qtp/results.html" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
We have implemented this integration in 3 ways, using VBScript,JScript and RunTestSet utility. In POM, we need to specify like this.
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>test</phase>
<configuration>
<tasks>
<property name="vbs.script" value='qtp.vbs'/>
<exec executable="WScript.exe" spawn="true" resolveExecutable="true">
<arg line="${vbs.script}"/>
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Using RunTestSet,
<exec executable="location of RunTestSet.exe" output="outputFolder">
<arg line="/s:qc url"/>
<arg line="/n:Domain"/>
<arg line="/d:Project"/>
<arg line="/u:username"/>
<arg line="/p:password"/>
<arg line="/f:TestSetFolder"/>
<arg line="/t:TestSet"/>
<arg line="/l"/>
</exec>
Regards,
Ramya.
You can try Quality Center Plugin for Jenkins : https://wiki.jenkins-ci.org/display/JENKINS/Quality+Center+Plugin
I've been using this vbscript
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
qtApp.Open "<fullpathto>\XlTest", True ' Open the test in read-only mode
' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run ' Run the test
qtTest.Close ' Close the test
qtApp.Close ' Close the app
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object
which I call directly

Can I invoke QTP test suits automatically from Maven/Hudson?

We need to integrate QTP with Hudson to automatically invoke test suites against the code deployed in Hudson. The build process is based on Maven.
Is there any plugin or something to achieve this? We heard about the Groovy plugin for Hudson; Can we execute it with a Groovy script?
Hudson does not run tests, it takes the output and generates a nice report. You should look at how to make Maven run the tests, and then have Hudson pick up the output to generate a report.
As Michael says, this is a Maven integration issue not a Hudson one. I don't know of a Maven plugin for QTP, but you can use the exec-maven-plugin to invoke an arbitrary executable, and provide arguments to that executable. QTP provides an "Automation" API that you should be able to wrap in a script fairly easily. It won't be a slick integration but may serve your purposes.
Here's an example of the configuration you could use:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>[qtp executable]</executable>
<workingDirectory>/target</workingDirectory>
<arguments>
<argument>[an argument to configure QTP]</argument>
<argument>[another argument to configure QTP]</argument>
</arguments>
</configuration>
</plugin>
An answer to a previous question on invoking QTP from Ant is a good starting point for writing the Automation integration.
Update:
Here's an approach that may work for you. It appears that you can directly invoke the QTP server, passing the name of the test you want executing. So you can use the antrun plugin to invoke the url and direct the output to a target directory. Modify the url and test name to match your environment and QTP should be invoked and the results placed in target/qtp/results.html. This assumes that you have a single test you can invoke to do everything you need to in QTP.
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>test</phase>
<configuration>
<tasks>
<get verbose="true" src="http://[servername]/qtp/LaunchQTP.plx?testname=[test name]"
dest="${project.build.directory}/qtp/results.html" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
We have implemented this integration in 3 ways, using VBScript,JScript and RunTestSet utility. In POM, we need to specify like this.
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>test</phase>
<configuration>
<tasks>
<property name="vbs.script" value='qtp.vbs'/>
<exec executable="WScript.exe" spawn="true" resolveExecutable="true">
<arg line="${vbs.script}"/>
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Using RunTestSet,
<exec executable="location of RunTestSet.exe" output="outputFolder">
<arg line="/s:qc url"/>
<arg line="/n:Domain"/>
<arg line="/d:Project"/>
<arg line="/u:username"/>
<arg line="/p:password"/>
<arg line="/f:TestSetFolder"/>
<arg line="/t:TestSet"/>
<arg line="/l"/>
</exec>
Regards,
Ramya.
You can try Quality Center Plugin for Jenkins : https://wiki.jenkins-ci.org/display/JENKINS/Quality+Center+Plugin
I've been using this vbscript
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
qtApp.Open "<fullpathto>\XlTest", True ' Open the test in read-only mode
' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run ' Run the test
qtTest.Close ' Close the test
qtApp.Close ' Close the app
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object
which I call directly