Enable tests (#180)
* Update mvn command to hide verbose downloading packages logs
This commit is contained in:
Родитель
6b35caa97d
Коммит
e94c1bcdc9
|
@ -15,12 +15,12 @@ environment:
|
|||
- JAVA_HOME: C:\Program Files\Java\jdk1.8.0
|
||||
|
||||
install:
|
||||
- cmd: echo %JAVA_HOME%
|
||||
- ps: Get-Command mvn
|
||||
- cmd: mvn -v
|
||||
- ps: Get-Command nuget
|
||||
|
||||
- cmd: echo %JAVA_HOME%
|
||||
build_script:
|
||||
- cmd: mvn clean package -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
|
||||
- ps: |
|
||||
$buildNumber = 0
|
||||
if($env:APPVEYOR_REPO_TAG -eq "true") {
|
||||
|
|
|
@ -11,9 +11,7 @@ function StopOnFailedExecution {
|
|||
}
|
||||
|
||||
Write-Host "buildNumber: " $buildNumber
|
||||
Get-Command mvn
|
||||
Get-Command nuget
|
||||
mvn clean install -DskipTests
|
||||
StopOnFailedExecution
|
||||
remove-item pkg -Recurse -ErrorAction Ignore
|
||||
mkdir pkg
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.microsoft.azure.functions.worker.functional.tests;
|
||||
|
||||
import com.microsoft.azure.functions.rpc.messages.*;
|
||||
import com.microsoft.azure.functions.annotation.*;
|
||||
import com.microsoft.azure.functions.worker.test.utilities.*;
|
||||
import org.junit.*;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.runners.Parameterized.Parameter;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class SimpleParamReturnTest extends FunctionsTestBase {
|
||||
|
||||
@Parameters
|
||||
public static Object[] data() {
|
||||
return new Object[] { "test String", "" };
|
||||
}
|
||||
|
||||
@Parameter
|
||||
public String stringInput;
|
||||
private static String stringReturnValue;
|
||||
|
||||
public String ReturnStringFunction() {
|
||||
|
||||
return stringReturnValue;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringData() throws Exception {
|
||||
stringReturnValue = stringInput;
|
||||
try (FunctionsTestHost host = new FunctionsTestHost()) {
|
||||
this.loadFunction(host, "returnStringTestId", "ReturnStringFunction");
|
||||
InvocationResponse stringResponse = host.call("getret", "returnStringTestId");
|
||||
assertEquals(TypedData.DataCase.STRING, stringResponse.getReturnValue().getDataCase());
|
||||
assertEquals(stringInput, stringResponse.getReturnValue().getString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package com.microsoft.azure.functions.worker.functional.tests;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.microsoft.azure.functions.rpc.messages.*;
|
||||
import com.microsoft.azure.functions.worker.test.categories.*;
|
||||
import com.microsoft.azure.functions.worker.test.utilities.*;
|
||||
import org.junit.*;
|
||||
import org.junit.experimental.categories.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class SimpleParamReturnTests extends FunctionsTestBase {
|
||||
public static String EmptyParameterFunction() {
|
||||
return "Empty Parameter Result";
|
||||
}
|
||||
|
||||
private static int intReturnValue = 0;
|
||||
public static int ReturnIntFunction() {
|
||||
return intReturnValue;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Category({IntegrationTesting.class, SmokeTesting.class, FunctionalTesting.class})
|
||||
public void testEmptyParameter() throws Exception {
|
||||
try (FunctionsTestHost host = new FunctionsTestHost()) {
|
||||
this.loadFunction(host, "emptyparam", "EmptyParameterFunction");
|
||||
InvocationResponse response = host.call("getret", "emptyparam");
|
||||
assertEquals(TypedData.DataCase.STRING, response.getReturnValue().getDataCase());
|
||||
assertEquals("Empty Parameter Result", response.getReturnValue().getString());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Category({IntegrationTesting.class, SmokeTesting.class, FunctionalTesting.class})
|
||||
public void testIntReturn() throws Exception {
|
||||
try (FunctionsTestHost host = new FunctionsTestHost()) {
|
||||
this.loadFunction(host, "intreturn", "ReturnIntFunction");
|
||||
|
||||
intReturnValue = 13579;
|
||||
InvocationResponse response = host.call("getret13579", "intreturn");
|
||||
assertEquals(TypedData.DataCase.INT, response.getReturnValue().getDataCase());
|
||||
assertEquals(intReturnValue, response.getReturnValue().getInt());
|
||||
|
||||
intReturnValue = 24680;
|
||||
response = host.call("getret24680", "intreturn");
|
||||
assertEquals(TypedData.DataCase.INT, response.getReturnValue().getDataCase());
|
||||
assertEquals(intReturnValue, response.getReturnValue().getInt());
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
intReturnValue = new Random().nextInt();
|
||||
response = host.call("getretloop" + intReturnValue, "intreturn");
|
||||
assertEquals(TypedData.DataCase.INT, response.getReturnValue().getDataCase());
|
||||
assertEquals(intReturnValue, response.getReturnValue().getInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче