Sapui5 如何启动本地服务器(通过gulp)并在pom.xml中的该服务器上运行自动测试

Sapui5 如何启动本地服务器(通过gulp)并在pom.xml中的该服务器上运行自动测试,sapui5,pom.xml,Sapui5,Pom.xml,我想启动一个本地服务器并在pom.xml文件中按配置运行自动测试,如下所示 <execution> <id>Run GUI</id> <phase>pre-integration-test</phase> <configuration> <target&

我想启动一个本地服务器并在
pom.xml
文件中按配置运行自动测试,如下所示

<execution>
                    <id>Run GUI</id>
                    <phase>pre-integration-test</phase>
                    <configuration>
                        <target>
                            <exec executable="cmd.exe" dir="${project.basedir}\src\main\resources">
                                <arg value="/c"/>
                                <arg value="${project.basedir}\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\RunGUI.bat"/>
                            </exec>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
               </execution>
               <execution>
                    <id>Run AutoTestWB</id>
                    <phase>post-integration-test</phase>
                    <configuration>
                        <target>
                            <exec executable="cmd" dir="${project.basedir}/src/main/resources/webapp/test/AutoTestWB/ui5-automation-framework/UI5Example"
                                failonerror="true" osfamily="windows">
                                <arg line="/c node ..\protractor\bin\protractor conf.js" />
                            </exec>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
               </execution>
但在下一次执行等待第一次执行完成时;第一个是没有反应

所以,我试图阻止第一个港口

 [exec] [17:25:28] gulp-ui5-preload number of files combined to preload file Component-preload.js:  523
 [exec] [17:25:28] Finished 'preload' after 35 s
 [exec] [17:25:28] Starting 'create-dist'...
 [exec] [17:25:28] Finished 'create-dist' after 2.3 μs
 [exec] Result: 1
 [INFO] Executed tasks
[INFO] 
[INFO] --- maven-antrun-plugin:1.6:run (Run AutoTestWB) @ SampleWorkbench ---
[INFO] Executing tasks

main:
     [exec] (node:828) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
     [exec] [17:30:16] I/launcher - Test Coverage:false
     [exec] [17:30:16] I/launcher - Running 1 instances of WebDriver
     [exec] [17:30:16] I/direct - Using ChromeDriver directly...
     [exec] Started
     [exec] Jasmine started
     [exec] F
     [exec]   FORMAT CONVERSATION
     [exec]     × Step 1: Navigate to Format Conversation tab
     [exec]       - Failed: No tab found!
     [exec] F    × Step 2: Click on Source format select box
     [exec]       - Failed: No tab found. The action failed!
     [exec] F    × Step 3: Choose Source format
     [exec]       - Failed: No tab found. The action failed!
     [exec] F    × Step 4: Enter value for Source content
     [exec]       - Failed: No view found. The action failed!
     [exec] F    × Step 5: Click on Target format select box
     [exec]       - Failed: No view found. The action failed!
     [exec] F    × Step 6: Choose Target format
     [exec]       - Failed: No view found. The action failed!
     [exec] F    × Step 7: Do Convert
     [exec]       - Failed: No tab found. The action failed!
     [exec] F    × Step 8: Result
     [exec]       - Failed: No element found!
     [exec] 
下一次执行将运行,但会失败,因为此自动测试(第一次执行时需要服务器)正在启动


请帮帮我!谢谢大家!我在这个博客中找到了解决问题的方法

非常感谢你,作者

在我的
pom.xml
文件中,我编辑了
mvn clean install-p集成测试
clean install-p集成测试

这是我的密码

<profiles>
        <profile>
            <id>integration-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.12.2</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>start-third-parties</id>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <target>
                                        <exec executable="powershell.exe" dir="${project.basedir}\src\main\resources" spawn="true">
                                            <arg value="${project.basedir}\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\RunGUI.bat"/>
                                        </exec>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-third-parties</id>
                                <phase>post-integration-test</phase>
                                <configuration>
                                    <target>
                                        <exec executable="powershell.exe" dir="${project.basedir}\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\UI5Example" spawn="false">
                                            <arg value="${project.basedir}\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\RunAutoTestWB.bat"/>
                                        </exec>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                           </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

帮自己一个忙,升级到。xml是mavens(java dep.tool)的东西,sap一开始就犯了一个大错误,很高兴您能找到解决方案。请单击答案的复选标记,让其他人知道此问题现已解决。
<profiles>
        <profile>
            <id>integration-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.12.2</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>start-third-parties</id>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <target>
                                        <exec executable="powershell.exe" dir="${project.basedir}\src\main\resources" spawn="true">
                                            <arg value="${project.basedir}\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\RunGUI.bat"/>
                                        </exec>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-third-parties</id>
                                <phase>post-integration-test</phase>
                                <configuration>
                                    <target>
                                        <exec executable="powershell.exe" dir="${project.basedir}\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\UI5Example" spawn="false">
                                            <arg value="${project.basedir}\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\RunAutoTestWB.bat"/>
                                        </exec>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                           </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
 --- frontend-maven-plugin:1.8.0:gulp (gulp build) @ SampleWorkbench ---
[INFO] Running 'gulp.js ' in C:\Users\**********\Desktop\BaseWB\SampleWorkbench\SampleWorkbench\src\main\resources
[INFO] [15:53:51] Using gulpfile ~\Desktop\BaseWB\SampleWorkbench\SampleWorkbench\src\main\resources\gulpfile.js
[INFO] [15:53:51] Starting 'default'...
[INFO] [15:53:51] Finished 'default' after 68 μs
[INFO] [15:53:51] Starting 'preload'...
[INFO] [15:53:51] Starting 'minify-css'...
[INFO] [15:53:51] Finished 'minify-css' after 4.3 μs
[INFO] [15:53:51] Starting 'copy-file'...
[INFO] [15:53:51] Finished 'copy-file' after 1.38 ms
[INFO] [15:53:51] Finished 'clean' after 25 ms
[INFO] [15:53:51] Finished 'sass' after 74 ms
[INFO] [15:54:23] SyntaxError in plugin "gulp-uglify-es"
[INFO] Message:
[INFO]     'return' outside of function
[INFO] Details:
[INFO]     filename: test\AutoTestWB\ui5-automation-framework\node_modules\mkdirp\bin\cmd.js
[INFO]     line: 13
[INFO]     col: 4
[INFO]     pos: 313
[INFO] 
[INFO] [15:54:23] gulp-ui5-preload number of files combined to preload file Component-preload.js:  523
[INFO] [15:54:23] Finished 'preload' after 33 s
[INFO] [15:54:23] Starting 'create-dist'...
[INFO] [15:54:23] Finished 'create-dist' after 2.3 μs
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ SampleWorkbench ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 7 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ SampleWorkbench ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 3 source files to C:\Users\*********\Desktop\BaseWB\SampleWorkbench\SampleWorkbench\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ SampleWorkbench ---
[INFO] Not copying test resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ SampleWorkbench ---
[INFO] Not compiling test sources
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ SampleWorkbench ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-bundle-plugin:4.2.1:bundle (default-bundle) @ SampleWorkbench ---
[INFO] 
[INFO] --- maven-antrun-plugin:1.6:run (start-third-parties) @ SampleWorkbench ---
[INFO] Executing tasks

main:
[INFO] Executed tasks
[INFO] 
[INFO] --- maven-failsafe-plugin:2.12.2:integration-test (default) @ SampleWorkbench ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-antrun-plugin:1.6:run (stop-third-parties) @ SampleWorkbench ---
[INFO] Executing tasks

main:
     [exec] =================== Started running Autotest ...    ==================
     [exec] 
     [exec] C:\Users\*******\Desktop\BaseWB\SampleWorkbench\SampleWorkbench\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\UI5Example>node ..\protractor\bin\protractor conf.js 
     [exec] [15:54:28] I/launcher - Test Coverage:false
     [exec] [15:54:28] I/launcher - Running 1 instances of WebDriver
     [exec] [15:54:28] I/direct - Using ChromeDriver directly...
     [exec] C:\Users\*******\Desktop\BaseWB\SampleWorkbench\SampleWorkbench\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\RunAutoTestWB.b
     [exec] at : (node:11592) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
     [exec] At line:1 char:1
     [exec] + C:\Users\*******\Desktop\BaseWB\SampleWorkbench\SampleWorkbe ...
     [exec] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     [exec]     + CategoryInfo          : NotSpecified: ((node:11592) [D...pdir() instead.:String) [], RemoteException
     [exec]     + FullyQualifiedErrorId : NativeCommandError
     [exec]  
     [exec] Started
     [exec] Jasmine started
     [exec] .
     [exec]   FORMAT CONVERSATION
     [exec]     √ Step 1: Navigate to Format Conversation tab
     [exec] .    √ Step 2: Click on Source format select box
     [exec] .    √ Step 3: Choose Source format
     [exec] .    √ Step 4: Enter value for Source content
     [exec] .    √ Step 5: Click on Target format select box
     [exec] .    √ Step 6: Choose Target format
     [exec] .    √ Step 7: Do Convert
     [exec] .    √ Step 8: Result
     [exec] 
     [exec] 
     [exec] 
     [exec] 
     [exec] 8 specs, 0 failures
     [exec] Finished in 88.925 seconds
     [exec] 
     [exec] Executed 8 of 8 specs SUCCESS.
     [exec] [15:55:59] I/launcher - 0 instance(s) of WebDriver still running
     [exec] [15:55:59] I/launcher - chrome #01 passed
     [exec] 
     [exec] C:\Users\*******.'js' is not recognized as an internal or external command,
     [exec] operable program or batch file.
     [exec] *******\Desktop\BaseWB\SampleWorkbench\SampleWorkbench\src\main\resources\webapp\test\AutoTestWB\ui5-automation-framework\UI5Example>js
     [exec] Result: 1
[INFO] Executed tasks
[INFO] 
[INFO] --- maven-failsafe-plugin:2.12.2:verify (default) @ SampleWorkbench ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-install-plugin:3.0.0-M1:install (default-install) @ SampleWorkbench ---
[INFO] Installing C:\Users\*******\Desktop\BaseWB\SampleWorkbench\SampleWorkbench\target\SampleWorkbench.jar to C:\Users\*******\.m2\repository\SampleWorkbench\SampleWorkbench\1.0.0\SampleWorkbench-1.0.0.jar
[INFO] Installing C:\Users\*******\Desktop\BaseWB\SampleWorkbench\SampleWorkbench\pom.xml to C:\Users\*******\.m2\repository\SampleWorkbench\SampleWorkbench\1.0.0\SampleWorkbench-1.0.0.pom
[INFO] 
[INFO] --- maven-bundle-plugin:4.2.1:install (default-install) @ SampleWorkbench ---
[INFO] Installing SampleWorkbench/SampleWorkbench/1.0.0/SampleWorkbench-1.0.0.jar
[INFO] Writing OBR metadata
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:20 min
[INFO] Finished at: 2019-10-01T15:56:00+07:00
[INFO] ------------------------------------------------------------------------