cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco SDK4 Integration Tests module. Possible to run tests without an instance of ACS running?

phivuu-2
Confirmed Champ
Confirmed Champ

I have generated a new barebone alfresco project with SDK4. But when running the command mvn integration-test I get the error below from the default sample tests. I don't have an instance of the ACS running at this point but shouldn't the tests spin an instance up if it detects that there is none? That's how I interpret the explaination on this link https://docs.alfresco.com/5.2/tasks/sdk-test-acs.html

Or do I have to make some configurations in the pom.xml besides using the default?

[INFO] Running test.dk.platformsample.DemoComponentIT
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0 s <<< FAILURE! - in test.dk.platformsample.DemoComponentIT
[ERROR] testChildNodesCount(test.dk.platformsample.DemoComponentIT) Time elapsed: 0 s <<< ERROR!
org.apache.http.conn.HttpHostConnectException: Connect to localhost:8080 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Caused by: java.net.ConnectException: Connection refused (Connection refused)

[ERROR] testGetCompanyHome(test.dk.platformsample.DemoComponentIT) Time elapsed: 0 s <<< ERROR!
org.apache.http.conn.HttpHostConnectException: Connect to localhost:8080 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Caused by: java.net.ConnectException: Connection refused (Connection refused)

1 ACCEPTED ANSWER

Yeah, you can run against a different instance as well.

In your project structure you can find pom.xml file. If you open the pom.xml in nodepad, there should be a property named: <test.acs.endpoint.path>

This pom.xml is also known as parent pom. 

Update the property value and provide the URL of your alfresco repository. 

Example:  <test.acs.endpoint.path>http://127.0.0.1:8080/alfresco</test.acs.endpoint.path

here Alfresco instance is running on local machine already so the address is 127.0.0.1. If your repository is running on a different machine then use its IP address and replace the URL with: http://<IPAddressOfAlfrescoInstance>:8080/alfresco

Now, simply run the IT test cases like java junit test cases. All the logs and outputs will be printed in your repository instance log.

Follow this documentation for more details: https://github.com/Alfresco/alfresco-sdk/blob/master/docs/advanced-topics/integration-testing/it-run...

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View answer in original post

5 REPLIES 5

abhinavmishra14
World-Class Innovator
World-Class Innovator

Project structure using SDK4 include the configurarations for docker. Make sure you have installed docker on your machine and its up and running. 

To run the itegration test, you can use the run.bat/run.sh file available as part of project structure. It is the easiest option. You can find the instructions in the ReadMe file on how to use these scripts. 

You can this command, e.g. i you have windows:

1- Open command prompt

2- Go to the project directory

3- ./run.bat build_test 

This command will: build the whole project, recreate the ACS and Share docker images, start the dockerised environment, execute the integration tests from the integration-tests module and stop the environment.

Additionally, you can run all docker-compose commands to build and start the docker containers and then execute mvn verify on integeration test module. I find run.bat/run.sh script much easier than doing these steps one by one. Its up to you. 

For more information refer: https://github.com/Alfresco/alfresco-sdk/blob/master/docs/advanced-topics/integration-testing/it-run...

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Thank you for the information.

I had docker and but it was still failing. Turns out I was missing  Docker Compose as well.

Is it only possible to run Integration Tests with Docker? I tried to spin up my own instance of alfresco and use maven command to run the tests. However it failed with the error, unable to find webscript test.xml.

Yeah, you can run against a different instance as well.

In your project structure you can find pom.xml file. If you open the pom.xml in nodepad, there should be a property named: <test.acs.endpoint.path>

This pom.xml is also known as parent pom. 

Update the property value and provide the URL of your alfresco repository. 

Example:  <test.acs.endpoint.path>http://127.0.0.1:8080/alfresco</test.acs.endpoint.path

here Alfresco instance is running on local machine already so the address is 127.0.0.1. If your repository is running on a different machine then use its IP address and replace the URL with: http://<IPAddressOfAlfrescoInstance>:8080/alfresco

Now, simply run the IT test cases like java junit test cases. All the logs and outputs will be printed in your repository instance log.

Follow this documentation for more details: https://github.com/Alfresco/alfresco-sdk/blob/master/docs/advanced-topics/integration-testing/it-run...

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Hi,

I'm having this issue about the webscript for test.xml is not found, but in my case I always had the ACS instance alive. What could be happening in my case?

If you don't want to have any standing repository you could focus on a mock service mechanism.

They would be instantiated at test time without needing any containers.

Simply add this library into your sdk specifying the version of acs you use and set up a test service-context.xml.

Here you will find the details

   <dependency>
		<groupId>it.vige</groupId>
		<artifactId>alfresco-tests</artifactId>
		<version>${acs.version}</version>
		<scope>test</scope>
   </dependency>