PhpStorm HTTP client - intellij-idea

PhpStorm has built-in HTTP Client (https://www.jetbrains.com/help/phpstorm/http-client-in-product-code-editor.html), with JS support, which allows for writing tests. This is really handy, but would be even better, if we had a way to run those tests apart from PhpStorm, in CI environment or in console.
Is the any way to run them separately, or any script/library than accepts same syntax?

It is possible now.
I just built an open-source CLI application that support execute your existing http request files.
You can download the tool from: https://github.com/quangson91/intellij_rest_cli
Usage:
java -jar /path/to/restcli-1.0.jar -e "test" -s get-requests.http
This tool support:
Execute Intellij HTTP request files.
Running test script inside request files.
Loading and inject environment variables from
http-client.env.json
http-client.private.env.json
Cross platform: Windows, macOS, and Linux ready.
Generate test report - JUnit format. 🥰🥰🥰 So you can show test report in the CI system.

Not currently possible.
https://youtrack.jetbrains.com/issue/IDEA-239345 -- watch this ticket (star/vote/comment) to get notified with any progress.

Related

VeriFIX test automation in Jenkins

We are working with a client that uses VeriFIX to test their FIX message flow. Whilst they have built up lots of tests in many suites, it is a manual process to run them and to collate the results.
On the VeriFIX website it says
Incorporate tests into nightly builds using VeriFIX’s command-line script player.
but I cannot find any details on how to to it. Does anyone have any experience in running VeriFIX tests in a continuous integration server (ideally a Jenkins pipeline).
Many thanks.
You can run VeriFIX playlists in batch mode from the command line:
"%VERIFIX_HOME%\verifixbatch\verifixbatch.exe" -version "FIX (x.y)" -playlist "myplaylist" -disablelogging "false"
If you have received the user manual with your installation of veriFIX, the details of how to integrate with CI are in there.
To integrate veriFIX with Jenkins you will create batch files containing tests and run the batch files as jobs in Jenkins.
The placement of your veriFIX installation is important. If your veriFIX is on a users machine, as is often the case, separate from the environment machine Jenkins resides on, there can be difficulties getting the tests to run.
If you have a centralised install of veriFIX things are much easier.

How to get selenium server running locally?

I need to have selenium server running in order to run some tests I'm creating in http://seleniumbuilder.github.io/se-builder/
This is not for the selniumIDE and not for a server grid, I need to be able to export from selenium builder and am directed to run them on a local selenium server, e.g. localhost:4444
I use the download page at http://www.seleniumhq.org/download/ but there isn't much info on basic stuff.
I see the link for the download and I can save the .jar file Now what? I don't know Java. Trying to click thru gets
[
[
How should I be compiling and then using it?
Selenium means different things depending on context.
Do you want to record/playback simple web browser interactions? You want SeleniumIDE or Selenium Builder. You need a standalone jar when replaying the tests from the command line; I think the docs tell you how but I couldn't find it. This small blog post tells you how. Essentially: download the Selenium Standalone Server jar file from SeleniumHQ and run it something like this:
java -jar c:\selenium\selenium-server-standalone-2.21.0.jar -htmlSuite "*firefox" "http://localhost:8080" "c:\test\my-test-suite.html" "c:\test\my-test-result.html"
(Note: even though it is called a "server", in this mode it does not listen on a port for incoming requests or anything like that; to most people's way of thinking, the jar file is actually a client in this mode, and the browser that it connects to is the server! The jar file does include a server, you're just not using it when executing a Selenese file like this.)
Do you want to run tests locally from your unit test runner (JUnit, NUnit, etc.?). You probably don't need a server. All the instructions are on this doc page.
Do you want to run the tests via a grid of multiple browsers, allowing you to distribute the load and do multi-browser testing easily? This is where Selenium server shines. Everything you need to know is on this doc page.

Run automated test cases on local machine's web browser - HUDSON

I use remote hudson server for test automation of webapplication. When I run the automated test cases they ran on the browser of that remote machine. I rather want them to run on my machine.
Is there a way I can achieve this.
Regards
You can run Jenkins slave on your machine and tie the job to it (there is such an option on the job definition page). Moreover, you can use NodeLabel Parameter plugin and use a parameter to specify to which node you want to tie your job. For example: by default it will run on Master, but you also can specify your slave when running it manually.
You don't say what tool you're using to drive the browser. If you're using selenium, you can set up a selenium server on your machine, then direct your tests to use your machine.
Considering you are talking about a test browser , I assume you use the selenium plugin for hudson/jenkins. you can change the location/capabilities of the node where the test are run against in your testcode.
capabilities.setBrowserName("firefox");
capabilities.setPlatform(org.openqa.selenium.Platform.WINDOWS);
also it's possible to exclude the master from the node list by editing the config file in the jenkins plugin folder
If you are refering to just restricting where the project can be run, this can be found
https://[jenkins name]/job/[jobname]/configure
under Restrict where this project can be run

Play framework 2.0 continuous integration setup

I am looking for ideas for a Play 2.0 continuous integration setup. It would contain typical jobs like build after a git push, nightly builds with deployment to a test Heroku instance etc. Also code quality and test coverage metrics generation would be handy.
At the moment the stack looks like Play 2.0 with Java but that might change to Scala.
For "traditional" Java web app I would use Hudson/Jenkins. I found a Hudson plugin for Play but it doesn't seem to support Play 2.0. Is Hudson suitable tool here in general or what is your setup for Play 2.0 applications?
Play 2.0's build tool is just a thin wrapper around SBT. You should be able to use Hudson's sbt plugin to execute SBT build commands that are the equivalent of the Play commands you would execute from the console.
We execute the following under Bamboo for our builds:
SBT_OPTS="-Dsbt.log.noformat=true"
sbt clean compile test
(The SBT_OPTS variable turns off the colour formatting, making test output legible in log files.)
I found useful to add JUnit reporting plugin as I couldn't get test results to be displayed otherwise.
https://github.com/bseibel/sbt-simple-junit-xml-reporter-plugin
For PMD and Checkstyle I used this:
https://github.com/ymasory/sbt-code-quality.g8
For test coverage I am using JaCoCo at the moment:
http://ronalleva.com/2012/04/25/jacoco-and-play.html
Scct could be other option for coverage: http://mtkopone.github.com/scct/
With those and PMD, CheckStyle and JaCoCo plugins for Jenkins I have now quite ok setup for a Play 2 Java project.
here Is some detailed tutorial about doing It
http://wiki.cloudbees.com/bin/view/DEV/Playframework
It based on cloudbees but it would work fro any Jenkins Installation
You actually don't even need to use the SBT Plugin. I am running Play 2.1.1 on Jenkins and simply use the Execute Shell. I run something like the following:
cd ./your-play-project-root
play clean compile test stage
exit
This works quite well. "play" is simply just a thin wrapper around sbt.
"stage" will create a runnable in your target/server directory. Then, you can simply shell again to actually start your play application!

How can I start a Play! Framework server from within a test

I want to write webdriver tests against my Play application. Normally when I do this in Java, I use Jetty to pull up a web server from within the test and run my webdriver tests against that server. I've been trying to look in the endless amounts of Python code which is the Play framework scripts, but I haven't found anything so far.
How can I bootstrap a Play server from within a test?
EDIT: I do not wish to use the selenium integration in Play.
Play provides a test mode, which launches your app and let's you run your unit as well as integration tests (based on selenium).
http://www.playframework.org/documentation/1.2.4/guide10 is a good starting point for reading.
There is also a plugin for webdriver suport:
http://www.playframework.org/modules/webdrive-0.2/home
If you want to see how the play jvm is actually started (without the python-stuff), you can start it with 'play run', then use "Process Explorer" to inspect the process and look at the arguments. They can look something like this:
"C:\Program Files\Java\jdk1.6.0_27\bin\java" -javaagent:c:\playPath/play-1.2.4.jar -XX:-UseSplitVerifier -Dfile.encoding=utf-8 -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Dplay.debug=yes -classpath C:\p\app\conf;c:\playPath\play-1.2.4.jar;[ALL JARS YOU NEED] -Dapplication.path=C:\p\app -Dplay.id= play.server.Server ""
Maybe this info helps you to start it manually in your test.