facing issue while integrating cucumber and apickli for api proxies.

Not applicable

cucumberintegration.jpgI am working on test framework api for API Proxies using cucumber and apicklis.

As suggested github I have followed the steps but while packing the proxies (deployed proxies in edge successfully) integration testcases got failed and tried so many ways.

Taken sample project from the below url:

https://github.com/sauliuz/amok/tree/master/examples/apigee-amok

Below changes are updated in the pom file.

<!-- run cucumber / apickli tests --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.3.2</version> <executions> <!-- run integration tests --> <execution> <id>integration</id> <phase>install</phase> <goals> <goal>exec</goal> </goals> <configuration> <environmentVariables> <NODE_ENV> test </NODE_ENV> </environmentVariables> <executable>C:/Users/kumarpuli/AppData/Roaming/npm/cucumberjs</executable> <commandlineArgs> tests/integration </commandlineArgs> </configuration> </execution> </executions> </plugin>

Please help me to resolve the issue.

Solved Solved
0 10 1,187
1 ACCEPTED SOLUTION

You did not correct the pom file as per provided instructions.

Your current pom fragment is:

							<executable>tests/node_modules/cucumber/bin/cucumber.js</executable>
							<commandlineArgs>
								tests/integration
							</commandlineArgs>

It should be:

<executable>node</executable><commandlineArgs>
                               tests/node_modules/cucumber/bin/cucumber.js tests/integration
                            </commandlineArgs>

View solution in original post

10 REPLIES 10

@Nagendra - unfortunately you have cropped the error message in your screenshot so can't read it in full. It starts with "Cannot run program "C:\Users\kuma...

Can you paste the full error message?

Not applicable

@Nagendra: Could you please run the maven command using -X and share it.

Have you ever tried to deploy manually? try to deploy manually and see whether it gives any error or not.

Hi @Nagendra - You do not need to change anything in the pom file

1. Just clone the repo

2. Run npm install from the node directory and also on the test directory as mentioned here

3. Execute the mvn command with the appropriate args (org, username, password, env, etc)

The pom requires no change as it points to the cucumber available as part of the node_modules directory that gets created with step 2

I followed the same steps in a fresh directory and was able to run the maven command successfully.

Please provide more info and complete error logs

@Nagendra - Any luck ?

Based on your screenshot, you're using Windows.

The .pom file expects cucumber.js to be executed according to the Unix conventions, ie., using shebang.

To be able to run cucumber in Windows you need to account for this discrepancy.

In the .pom file locate the following section:

                       <configuration>
                            <environmentVariables>
                                <NODE_ENV>
                                    ${apigee.env}
                                </NODE_ENV>
                            </environmentVariables>
                            <executable>tests/node_modules/cucumber/bin/cucumber.js</executable>
                            <commandlineArgs>
                                tests/integration
                            </commandlineArgs>
                        </configuration>
                    </execution>

and adjust executable and commandlineArgs tags to:

                            <executable>node</executable>
                            <commandlineArgs>
                               tests/node_modules/cucumber/bin/cucumber.js tests/integration
                            </commandlineArgs>

Thank you for giving the quick reply.

I have followed as you mentioned above but Still issue not resolved.

I am attaching the POM file and error message also.

[INFO] [INFO] --- maven-clean-plugin:2.5:clean (auto-clean-install) @ amok --- [INFO] Deleting C:\Users\kumarpuli\Downloads\amok-master\amok-master\examples\apigee-amok\target [INFO] [INFO] --- exec-maven-plugin:1.3.2:exec (integration) @ amok --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 43.819 s [INFO] Finished at: 2017-02-04T12:19:03-08:00 [INFO] Final Memory: 19M/356M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:exec (integration) on project amok: Command execution failed. Cannot run program "C:\Users\kumarpuli\Downloads\amok-master\amok-master\examples\apigee-amok\tests\node_modules\cucumber\bin\cucumber.js" (in directory "C:\Users\kumarpuli\Downloads\amok-master\amok-master\examples\apigee-amok"): CreateProcess error=193, %1 is not a valid Win32 application -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Let me know, if any info is required.

pom.txt

How can I configure

tests/node_modules/cucumber/bin/cucumber.js to multiple proxies with out npm installing in test folder and node folder to every proxy project?

How can I maintain as common point and giving common path for all the proxies?

You did not correct the pom file as per provided instructions.

Your current pom fragment is:

							<executable>tests/node_modules/cucumber/bin/cucumber.js</executable>
							<commandlineArgs>
								tests/integration
							</commandlineArgs>

It should be:

<executable>node</executable><commandlineArgs>
                               tests/node_modules/cucumber/bin/cucumber.js tests/integration
                            </commandlineArgs>

Thanks resloved my issue.

running on test environment Feature: Validating the existing out of the box funcionality of amock As an API developer, I want to make sure that my Mock API has all the described funcionality Scenario: I should get default response code if no mock headers are supplied # tests\integration\FuncionalTests.feature:4 When I POST to /html # tests\integration\FuncionalTests.feature:5 Then response code should be 200 # tests\integration\FuncionalTests.feature:6 Scenario: I should get response code specified in the request header # tests\integration\FuncionalTests.feature:8 Given I set x-mock-response-code header to 500 # tests\integration\FuncionalTests.feature:9 When I POST to /html # tests\integration\FuncionalTests.feature:10 Then response code should be 500 # tests\integration\FuncionalTests.feature:11 Scenario: I should get response code specified in the request header # tests\integration\FuncionalTests.feature:13 Given I set x-mock-response-code header to 404 # tests\integration\FuncionalTests.feature:14 When I POST to /html # tests\integration\FuncionalTests.feature:15 Then response code should be 404 # tests\integration\FuncionalTests.feature:16 Scenario: I should get successful response by suplying mock filename in the request header # tests\integration\FuncionalTests.feature:18 Given I set x-mock-filename header to html # tests\integration\FuncionalTests.feature:19 When I POST to / # tests\integration\FuncionalTests.feature:20 Then response code should be 200 # tests\integration\FuncionalTests.feature:21 4 scenarios (4 passed) 11 steps (11 passed) [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 33.310 s [INFO] Finished at: 2017-02-05T02:53:57-08:00 [INFO] Final Memory: 18M/357M [INFO] ------------------------------------------------------------------------

How can I configure

tests/node_modules/cucumber/bin/cucumber.js to multiple proxies with out npm installing in test folder and node folder?

How can I maintain as common point and giving common path for all the proxies?