-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(java): ✅ added tests for session creation
- Loading branch information
Showing
6 changed files
with
127 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
core-java/src/test/java/com/github/wasiqb/boyka/testng/others/SessionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2022 Wasiq Bhamla | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
*/ | ||
|
||
package com.github.wasiqb.boyka.testng.others; | ||
|
||
import static com.github.wasiqb.boyka.enums.PlatformType.WEB; | ||
import static com.github.wasiqb.boyka.manager.ParallelSession.clearAllSessions; | ||
import static com.github.wasiqb.boyka.manager.ParallelSession.clearSession; | ||
import static com.github.wasiqb.boyka.manager.ParallelSession.createSession; | ||
import static com.github.wasiqb.boyka.manager.ParallelSession.getSession; | ||
|
||
import com.github.wasiqb.boyka.exception.FrameworkError; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Test class for testing Parallel Session class. | ||
* | ||
* @author Wasiq Bhamla | ||
* @since 18-Oct-2023 | ||
*/ | ||
public class SessionTest { | ||
private static final String PERSONA = "SessionTest"; | ||
|
||
/** | ||
* Test duplicate clear session. | ||
*/ | ||
@Test (description = "Test duplicate clear session", expectedExceptions = FrameworkError.class, expectedExceptionsMessageRegExp = "Session already cleared for \\(\\) persona...") | ||
public void testDuplicateClearSession () { | ||
try { | ||
createSession (PERSONA, WEB, "test_local_chrome"); | ||
} finally { | ||
clearSession (); | ||
clearSession (); | ||
} | ||
} | ||
|
||
/** | ||
* Test Duplicate Session creation. | ||
*/ | ||
@Test (description = "Test Duplicate Session creation", expectedExceptions = FrameworkError.class, expectedExceptionsMessageRegExp = "Session is already created for \\(SessionTest\\) persona...") | ||
public void testDuplicateSessionCreation () { | ||
try { | ||
createSession (PERSONA, WEB, "test_local_chrome"); | ||
createSession (PERSONA, WEB, "test_local_chrome"); | ||
} finally { | ||
clearAllSessions (); | ||
} | ||
} | ||
|
||
/** | ||
* Test get session without session creation. | ||
*/ | ||
@Test (description = "Test get session without session creation", expectedExceptions = FrameworkError.class, expectedExceptionsMessageRegExp = "Session has not been created for \\(\\) persona...") | ||
public void testGetSessionWithoutSessionCreated () { | ||
getSession (); | ||
} | ||
|
||
/** | ||
* Test session creation with Null persona. | ||
*/ | ||
@Test (description = "Test session creation with Null persona", expectedExceptions = FrameworkError.class, expectedExceptionsMessageRegExp = "Session Persona cannot be empty or null...") | ||
public void testSessionCreationWithNullPersona () { | ||
createSession (null, WEB, "test_local_chrome"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.