Skip to content

Commit

Permalink
[java] Adding more small tests to bazel build
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Nov 29, 2018
1 parent 49c132f commit 9ba8800
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 13 deletions.
1 change: 1 addition & 0 deletions java/client/src/org/openqa/selenium/io/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ java_library(
visibility = [
"//java/client/src/org/openqa/selenium/os:__pkg__",
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//java/client/test/org/openqa/selenium/io:__pkg__",
],
deps = [
"//java/client/src/org/openqa/selenium",
Expand Down
1 change: 1 addition & 0 deletions java/client/src/org/openqa/selenium/json/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ java_library(
srcs = glob(["*.java"]),
visibility = [
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//java/client/test/org/openqa/selenium/json:__pkg__",
],
deps = [
"//java/client/src/org/openqa/selenium",
Expand Down
1 change: 1 addition & 0 deletions java/client/src/org/openqa/selenium/net/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ java_library(
srcs = glob(["*.java"]),
visibility = [
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//java/client/test/org/openqa/selenium/net:__pkg__",
],
deps = [
"//java/client/src/org/openqa/selenium",
Expand Down
1 change: 1 addition & 0 deletions java/client/src/org/openqa/selenium/os/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ java_library(
visibility = [
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//java/client/test/org/openqa/selenium/build:__pkg__",
"//java/client/test/org/openqa/selenium/os:__pkg__",
],
deps = [
"//java/client/src/org/openqa/selenium",
Expand Down
16 changes: 16 additions & 0 deletions java/client/test/org/openqa/selenium/io/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
load("//java:bazel-rules.bzl", "gen_java_tests")

gen_java_tests(
size = "small",
srcs = glob(
["*Test.java"],
),
deps = [
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/io",
"//third_party/java/assertj",
"//third_party/java/guava",
"//third_party/java/junit",
"//third_party/java/mockito:mockito-core",
],
)
18 changes: 18 additions & 0 deletions java/client/test/org/openqa/selenium/json/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("//java:bazel-rules.bzl", "gen_java_tests")

gen_java_tests(
size = "small",
srcs = glob(
["*Test.java"],
),
deps = [
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/json",
"//java/client/src/org/openqa/selenium/remote",
"//third_party/java/assertj",
"//third_party/java/gson",
"//third_party/java/guava",
"//third_party/java/junit",
"//third_party/java/mockito:mockito-core",
],
)
8 changes: 2 additions & 6 deletions java/client/test/org/openqa/selenium/json/JsonOutputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import org.openqa.selenium.remote.DriverCommand;
import org.openqa.selenium.remote.SessionId;

import java.awt.*;
import java.awt.Point;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
Expand All @@ -71,9 +71,6 @@
import java.util.logging.Level;
import java.util.stream.Stream;

//import com.google.gson.JsonPrimitive;


public class JsonOutputTest {

@Test
Expand Down Expand Up @@ -353,8 +350,7 @@ private void verifyStackTraceInJson(String json, StackTraceElement[] stackTrace)
"\"methodName\": \"" + e.getMethodName() + "\"");

int posOfCurrStackTraceElement = json.indexOf(e.getMethodName());
assertThat(posOfCurrStackTraceElement).isGreaterThan(posOfLastStackTraceElement)
.describedAs("Mismatch in order of stack trace elements");
assertThat(posOfCurrStackTraceElement).isGreaterThan(posOfLastStackTraceElement);
}
}

Expand Down
29 changes: 29 additions & 0 deletions java/client/test/org/openqa/selenium/net/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
load("//java:bazel-rules.bzl", "gen_java_tests")

java_library(
name = "net",
srcs = [
"StubNetworkInterfaceProvider.java",
],
deps = [
"//java/client/src/org/openqa/selenium/net",
],
)

gen_java_tests(
size = "small",
srcs = glob(
["*Test.java"],
),
deps = [
":net",
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/net",
"//java/client/src/org/openqa/selenium/remote",
"//java/client/test/org/openqa/selenium/environment",
"//third_party/java/assertj",
"//third_party/java/guava",
"//third_party/java/junit",
"//third_party/java/mockito:mockito-core",
],
)
16 changes: 16 additions & 0 deletions java/client/test/org/openqa/selenium/os/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
load("//java:bazel-rules.bzl", "gen_java_tests")

gen_java_tests(
size = "small",
srcs = glob(
["*Test.java"],
),
deps = [
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/os",
"//third_party/java/assertj",
"//third_party/java/guava",
"//third_party/java/junit",
"//third_party/java/mockito:mockito-core",
],
)
13 changes: 6 additions & 7 deletions java/client/test/org/openqa/selenium/remote/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
load("//java:bazel-rules.bzl", "gen_java_tests")

SMALL_TESTS = [
"DesiredCapabilitiesTest.java",
"RemoteCommonTests.java",
"http/JsonHttpCommandCodecTest.java",
"http/JsonHttpResponseCodecTest.java",
"http/W3CHttpResponseCodecTest.java",
LARGE_TESTS = [
"RemoteWebDriverScreenshotTest.java",
]

gen_java_tests(
size = "small",
srcs = SMALL_TESTS,
srcs = glob(["*Test.java"], exclude = LARGE_TESTS),
deps = [
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/chrome",
"//java/client/src/org/openqa/selenium/firefox",
"//java/client/src/org/openqa/selenium/ie",
"//java/client/src/org/openqa/selenium/remote",
"//third_party/java/assertj",
"//third_party/java/guava",
Expand Down
16 changes: 16 additions & 0 deletions java/client/test/org/openqa/selenium/remote/http/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
load("//java:bazel-rules.bzl", "gen_java_tests")

gen_java_tests(
size = "small",
srcs = glob(
["*Test.java"],
),
deps = [
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/remote",
"//third_party/java/assertj",
"//third_party/java/guava",
"//third_party/java/junit",
"//third_party/java/mockito:mockito-core",
],
)
33 changes: 33 additions & 0 deletions java/client/test/org/openqa/selenium/remote/internal/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
load("//java:bazel-rules.bzl", "gen_java_tests")

java_library(
name = "testbase",
srcs = [
"HttpClientTestBase.java",
],
deps = [
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/remote",
"//third_party/java/assertj",
"//third_party/java/guava",
"//third_party/java/jetty",
"//third_party/java/junit",
"//third_party/java/servlet:javax.servlet-api",
],
)

gen_java_tests(
size = "small",
srcs = glob(
["*Test.java"],
),
deps = [
":testbase",
"//java/client/src/org/openqa/selenium",
"//java/client/src/org/openqa/selenium/remote",
"//java/client/test/org/openqa/selenium",
"//third_party/java/assertj",
"//third_party/java/guava",
"//third_party/java/junit",
],
)
1 change: 1 addition & 0 deletions third_party/java/gson/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ java_import(
"maven_coordinates=com.google.code.gson:gson:jar:2.8.4",
],
visibility = [
"//java/client/test/org/openqa/selenium/json:__pkg__",
"//third_party/java/github:__pkg__",
],
)
1 change: 1 addition & 0 deletions third_party/java/jetty/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ java_library(
visibility = [
"//java/client/test/org/openqa/selenium:__pkg__",
"//java/client/test/org/openqa/selenium/environment:__pkg__",
"//java/client/test/org/openqa/selenium/remote/internal:__pkg__",
"//java/server/src/org/openqa:__subpackages__",
],
exports = [
Expand Down
1 change: 1 addition & 0 deletions third_party/java/servlet/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ java_import(
visibility = [
"//java/client/test/org/openqa/selenium:__pkg__",
"//java/client/test/org/openqa/selenium/environment:__pkg__",
"//java/client/test/org/openqa/selenium/remote/internal:__pkg__",
"//java/server/src/org/openqa/selenium/grid/server:__pkg__",
"//third_party/java/jetty:__pkg__",
],
Expand Down

0 comments on commit 9ba8800

Please sign in to comment.