我在运行集成测试时遇到问题。
作为测试的一部分,我习惯于exec-maven-plugin从源代码管理中提取其他项目,然后在本地运行它们,以便我的测试可以使用它来执行。
我的 JUnit Maven 依赖项是:
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<useModulePath>false</useModulePath>
<useSystemClassLoader>false</useSystemClassLoader>
<skipTests>false</skipTests>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.4.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我创建了一个名为的配置文件,integration-test以便我可以选择何时启用集成测试,并且还添加了一个参数来maven-surefire-plugin调用,skipUTs以便我可以跳过单元测试。
运行输出: mvn clean verify -Pintegration-test -DskipUTs=true
org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:111)
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:85)
at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:92)
at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:67)
at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:56)
at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:102)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:147)
at …Run Code Online (Sandbox Code Playgroud) 我的想法是,我在加载数据时显示加载.gif文件,然后在加载所有数据后,等待一段x时间,当前为3000毫秒,但会降低,然后在给定的时间后,设置值data.show为true,因此加载.gif不再显示,而表格是.
那么,我如何show从HTML,ng-show中的JavaScript中引用?
任何帮助,将不胜感激!
谢谢 :)
编辑:这适用于此回答 - setTimeout v $ timeout
<div ng-show="!show">
<img id="loader" src="resources/ajax-loader.gif">
</div>
<div ng-show="show">
<div class="ui grid center aligned">
<div class="column thirteen wide">
<table id="errorTable" class="ui compact celled definition table">
<p>Stuff</p>
</table>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
function onSuccess(response) {
controller.errors = response.data;
setTimeout(function () {
$('#errorTable').DataTable({
"lengthMenu": [[6], [6]],
"dom": '<"toolbar">frtip'
});
$("div.toolbar").html('<div class="ui input left floated"><input type="text" placeholder="Search..."></div>');
$scope.show = true;
}, 3000);
}
Run Code Online (Sandbox Code Playgroud) 我有代码在使用AJAX请求时完美地从数组中读取数据.但是,当我将对象推送到数组时,ng-repeat不会呈现新行,我必须刷新页面然后获取发送到服务器的数据.
为什么这样做?谢谢
function processError() {
var responseCode = 404;
var error = {};
error["client"] = document.getElementById('client').value;
error["errorMessage"] = document.getElementById('error-message').value;
error["simpleRes"] = document.getElementById('simple-fix').value;
error["fullRes"] = document.getElementById('full-fix').value;
error["reason"] = document.getElementById('reason').value;
var errorJson = JSON.stringify(error);
$.ajax({
url: "../ErrorChecker/rest/error",
type: "POST",
data: errorJson,
contentType: "application/json"
})
.done(function (data, statusText, xhr, displayMessage) {
$('.form').hide();
responseCode = xhr.status;
reloadData(data);
});
function reloadData(data) {
if (responseCode == 200) {
processPositiveResponse(data);
} else {
$('#negative-message').show(1000);
}
}
}
function processPositiveResponse(data) {
$('#positive-message').show(1000);
updateTable(data);
$('#errorTable').DataTable().destroy();
setupTable();
clearInputs();
console.log($scope.controller.errors); …Run Code Online (Sandbox Code Playgroud)