Alternative to HTMLUnit as headless browser in testing Spring Boot applications - spring-boot

So in our project we are using spring boot with thymeleaf and vanilla javascript to render web pages. Now while writing our UI tests we are currently using HTML Unit as a headless browser as it integrates rather well with spring boot.
However , whenever we use a little advanced calls like array.flatMap etc html unit fails as its engine does nit support those.
So we are looking for an alternative to explore to plugin into our environment.
Can someone please advise a headless browser that we can integrate . into our spring boot application ? Also if possible any documentation to integrate will help?
Appreciate the help.

You can use Cypress running in a Docker container. To make this a bit easier you can use https://github.com/wimdeblauwe/testcontainers-cypress
Disclaimer: I am the author of the testcontainers-cypress library.

Related

How to install React js with Spring framework?

I can't figure out how to install React.js for Spring framework.
A website said to first install NPM. Yes, I did that.
But how can I use React.js in Spring MVC?
mac and windows need to install NPM?
just use use CDN -> this case occur error
how to searching basic course
only use spring boot?
could you give a Web site address for how to install Spring
Frameworks with React.js
could you give to me tips for how to install React.js for Spring
Frameworks?
I'm a beginning developer.
The best answer I can give you is to walk through this tutorial, step by step.
https://spring.io/blog/2015/09/01/react-js-and-spring-data-rest-part-1-basic-features
To answer your first question, no, you do not need to use node.js tools to use React with Spring MVC. The tutorial above says:
This tutorial won’t go into extensive detail on how it uses require.js
to load JavaScript modules. But thanks to the frontend-maven-plugin,
you don’t have to install any of the node.js tools to build and run
the code.
Spring MVC and ReactJS follow some different concepts of designing your webapplication. With Spring MVC your create most of the time server side rendered webapps with JSPs or you use a template engine like Thymeleaf.
With ReactJS you are building a Singe Page Application (SPA) which can be accessed with a SINGLE HTML file, often index.html and your JavaScript is doing the rendering. With Spring MVC you provide several .html files and use Spring to route the different routes to your different .html files and render them on the server side.
The only thing I can guess is to serve your finally built ReactJS which consists only of one .html and several .js and other assets with a Spring MVC application which acts like a simple Webserver.
Furthermore you can use Spring MVC to provide RESTful interfaces for your React application.

Spring boot + Activiti explorer

Is it possible to integrate activiti explorer maven plugin with activiti Spring boot app?, so that we can make use of activit-explorer to view deployed process in activit-spring boot engine.
I know we can use rest-api over spring boot to query process engine, but I want to know if it is possible to run the explorer over spring boot by adding it as a maven plugin during deployment?Or can we tweak the activit-explorer.war somehow to point to spring-boot activiti engine?
activiti-explorer.war is standalone webapp by itself. I've write some guideline on how to manually to embed activiti-explorer to you own app. http://blog.canang.com.my/2016/05/12/embedding-activiti-explorer-to-your-application/
Most probably step 5 in my blog is your solution.
btw, there's reason why the name is 'default'. I can't recall it atm
I thought of answering my own question so that it will be useful for other developers with similar requirement. If you want to make an eco-system where activiti-rest, explorer and your custom end points co-exist, please refer this thread from activit forum. I have tried this and is working fine. link to thread
I would like to give my observation here. In order to avoid getting into pulling source and trying to build myself, I achieved partial success, by installing the activit-explorer as part of the usual standalone installation.Started the standalone activiti-explorer using Apache-Tomcat but I configured the database for Activiti as same as (MYSQL in my case) I used in my spring-boot application to hit the common ground.
But apparently the activiti version in my spring boot app was 5.19.0.0 and that for activiti-explorer was 5.22.0.0, which created some misalignment for spring boot application startup to fail. I am hopeful that with matching versions it might succeed. When I get some more time on me I will try and update. Since then may be someone can use this route.

spring-security, testing the filter chain without webapp

We are using spring-security in many applications with the same configuration. So we have created a library for it.
But today I have to changes many things in this library and I would like to test it so that I'm sure to not breaking anything.
Is it a way to test the filter chain and other spring-security components (like DetailsSource) without a web application ?
Thanks a lot
Spring security has very convenient API for testing with spring mvc testing
http://docs.spring.io/spring-security/site/docs/4.1.3.RELEASE/reference/htmlsingle/#test-mockmvc

can i use Spring framework for developing JSP application?

I have Eclipse-EE 3.6 IDE...I want to develop a Web Application using JSP and Servlet.
I plan to develop this application using Spring framework.
is it possible...can i use Spring framework for developing JSP application?
can you provide some Tutorials for JSP Application development using spring for beginners.
You can use Spring MVC. Try following tutorials:
http://static.springsource.org/docs/Spring-MVC-step-by-step/
http://www.vaannila.com/spring/spring-mvc-tutorial-1.html
http://maestric.com/doc/java/spring
Thanks.
Yes, you can. JSP is a standard view technology for spring-mvc. I'd recommend the official spring-mvc documentation
Yes, I would say, that this is one of the most done use case for Spring.
Anyway: I strongly recommend to use STS (SpringSource Tool Suite), it is free and based on Eclipse 3.6 Java EE, but provides additional Spring features. For example the some templates for Spring Projects (new Project/SpringSource Tool Suite/Spring Template Project).
And one very interesting Feature: Task Base Tutorials. They are great if you want to lern form an example: Dashbord/Tutorials/

How it works? Google app engine + Spring

I wonder how spring and google app engine work together
I know that google app engine cannot run threads.
I think spring is working with threads.
(if i'm wrong, please correct)
So how spring and google app engine work together.
I have used Spring Framework in Google App Engine and it worked just fine. So its not using threads to atleast to controllers etc. normal web application stuff. Most likely Spring cron tasks use threads, so instead of those you most likely have to use App Engines own cron task service.
According to the "Will it play" of GAE, Spring MVC is supported. I'm not sure if this is what you mean. I have tried running Grails application (which is built on top of Spring) on GAE and it works fine. If you are creating your application from scratch, be sure to read the issues related to Spring and related framework addons like the Spring Security and Spring ORM, and some customization you need to perform or additional coding for Google's storage system. Check out their group for more info.

Resources