Skip to content

Feat : Run tests with Java Serenity #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/tools/sdk-utils/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const JAVA_FRAMEWORK_MAP: Record<string, string> = {
junit5: "junit5",
junit4: "junit4",
cucumber: "cucumber-testng",
serenity: "serenity",
};

// Common Gradle setup instructions (platform-independent)
Expand Down
61 changes: 61 additions & 0 deletions src/tools/sdk-utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,66 @@ const pytestInstructions = generatePythonFrameworkInstructions("pytest");
const argsInstruction =
'<argLine>-javaagent:"${com.browserstack:browserstack-java-sdk:jar}"</argLine>';

const serenityInstructions = `
---STEP---

Set BrowserStack credentials as environment variables:

For macOS/Linux:
\`\`\`bash
export BROWSERSTACK_USERNAME=${config.browserstackUsername}
export BROWSERSTACK_ACCESS_KEY=${config.browserstackAccessKey}
\`\`\`

For Windows Command Prompt:
\`\`\`cmd
set BROWSERSTACK_USERNAME=${config.browserstackUsername}
set BROWSERSTACK_ACCESS_KEY=${config.browserstackAccessKey}
\`\`\`

---STEP---

Add serenity-browserstack dependency in pom.xml:
Add the following dependency to your pom.xml file and save it:

\`\`\`xml
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-browserstack</artifactId>
<version>3.3.4</version>
</dependency>
\`\`\`

---STEP---

Set up serenity.conf file:
Create or update your serenity.conf file in the project root with the following configuration:

\`\`\`
webdriver {
driver = remote
remote.url = "https://hub.browserstack.com/wd/hub"
}
browserstack.user="${config.browserstackUsername}"
browserstack.key="${config.browserstackAccessKey}"
\`\`\`

---STEP---

Run your Serenity tests:
You can continue running your tests as you normally would. For example:

Using Maven:
\`\`\`bash
mvn clean verify
\`\`\`

Using Gradle:
\`\`\`bash
gradle clean test
\`\`\`
`;

const javaInstructions = `
---STEP---

Expand Down Expand Up @@ -480,6 +540,7 @@ export const SUPPORTED_CONFIGURATIONS: ConfigMapping = {
cucumber: { instructions: javaInstructions },
junit4: { instructions: javaInstructions },
junit5: { instructions: javaInstructions },
serenity: { instructions: serenityInstructions },
},
},
csharp: {
Expand Down
1 change: 1 addition & 0 deletions src/tools/sdk-utils/percy/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const PERCY_INSTRUCTIONS: PercyConfigMapping = {
cucumber: { script_updates: javaSeleniumInstructions },
junit4: { script_updates: javaSeleniumInstructions },
junit5: { script_updates: javaSeleniumInstructions },
serenity: { script_updates: javaSeleniumInstructions },
},
},
csharp: {
Expand Down
1 change: 1 addition & 0 deletions src/tools/sdk-utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export enum SDKSupportedTestingFrameworkEnum {
nunit = "nunit",
mstest = "mstest",
xunit = "xunit",
serenity = "serenity",
specflow = "specflow",
reqnroll = "reqnroll",
}
Expand Down