Skip to content

Commit 85a099c

Browse files
Maven github actions (#3)
* Create maven.yml * updated testng.xml * updated variable name to match with secret variable names * updated workflow file * updated workflow file and env variables in base test
1 parent 99b7676 commit 85a099c

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

.github/workflows/maven.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Java CI with Maven
10+
11+
on:
12+
push:
13+
branches:
14+
- "main"
15+
- "test-*"
16+
pull_request:
17+
branches:
18+
- "main"
19+
- "test-*"
20+
jobs:
21+
build:
22+
23+
runs-on: ubuntu-latest
24+
env:
25+
LT_USERNAME: ${{ secrets.LT_USERNAME }}
26+
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Set up JDK 17
31+
uses: actions/setup-java@v4
32+
with:
33+
java-version: '17'
34+
distribution: 'temurin'
35+
cache: maven
36+
- name: Build and Test with Maven
37+
run: mvn clean install
38+
39+

src/test/java/com/baeldung/BaseTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public class BaseTest {
1717

1818
@BeforeTest
1919
public void setup() {
20-
String userName = System.getenv("LAMBDATEST_USERNAME") == null ? "LAMBDATEST_USERNAME" : System.getenv(
20+
String userName = System.getenv("LT_USERNAME") == null ? "LT_USERNAME" : System.getenv(
2121
"LT_USERNAME");
22-
String accessKey = System.getenv("LAMBDATEST_ACCESS_KEY") == null ? "LAMBDATEST_ACCESS_KEY" : System.getenv(
22+
String accessKey = System.getenv("LT_ACCESS_KEY") == null ? "LT_ACCESS_KEY" : System.getenv(
2323
"LT_ACCESS_KEY");
2424
String gridUrl = "@hub.lambdatest.com/wd/hub";
2525
try {

testng.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<classes>
66
<class name="com.baeldung.LambdaTestEcommerceTests">
77
<methods>
8-
<include name="testSearchProduct"/>
8+
<include name="whenUserSearchesForAProduct_ThenSearchResultsShouldBeDisplayed"/>
99
</methods>
1010
</class>
1111
</classes>

0 commit comments

Comments
 (0)