Revize bc95eeca
Přidáno uživatelem Vojtěch Bartička před asi 3 roky(ů)
Backend/BackendTesting/AnotationTesting.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class AnotationTesting |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Backend/BackendTesting/BackendTesting.csproj | ||
---|---|---|
1 |
<Project Sdk="Microsoft.NET.Sdk"> |
|
2 |
|
|
3 |
<PropertyGroup> |
|
4 |
<TargetFramework>net6.0</TargetFramework> |
|
5 |
<Nullable>enable</Nullable> |
|
6 |
|
|
7 |
<IsPackable>false</IsPackable> |
|
8 |
</PropertyGroup> |
|
9 |
|
|
10 |
<ItemGroup> |
|
11 |
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4" /> |
|
12 |
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.4"> |
|
13 |
<PrivateAssets>all</PrivateAssets> |
|
14 |
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|
15 |
</PackageReference> |
|
16 |
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.4" /> |
|
17 |
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.4" /> |
|
18 |
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.4"> |
|
19 |
<PrivateAssets>all</PrivateAssets> |
|
20 |
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|
21 |
</PackageReference> |
|
22 |
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" /> |
|
23 |
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> |
|
24 |
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" /> |
|
25 |
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" /> |
|
26 |
<PackageReference Include="coverlet.collector" Version="3.1.0" /> |
|
27 |
<PackageReference Include="Selenium.WebDriver" Version="4.1.0" /> |
|
28 |
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="100.0.4896.6000" /> |
|
29 |
<PackageReference Include="Selenium.WebDriver.GeckoDriver" Version="0.30.0.1" /> |
|
30 |
</ItemGroup> |
|
31 |
|
|
32 |
</Project> |
Backend/BackendTesting/Constants.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class Constants |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Backend/BackendTesting/DocumentManagementTesting.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class DocumentManagementTesting |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Backend/BackendTesting/FiltersTesting.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class FiltersTesting |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Backend/BackendTesting/ImportExportTesting.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class ImportExportTesting |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Backend/BackendTesting/LoginTesting.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class LoginTesting |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Backend/BackendTesting/Main_Testing_Class.cs | ||
---|---|---|
1 |
using Microsoft.VisualStudio.TestTools.UnitTesting; |
|
2 |
using OpenQA.Selenium; |
|
3 |
using OpenQA.Selenium.Chrome; |
|
4 |
using OpenQA.Selenium.Firefox; |
|
5 |
|
|
6 |
using System; |
|
7 |
using System.Collections; |
|
8 |
using System.Collections.Generic; |
|
9 |
using System.Threading; |
|
10 |
|
|
11 |
namespace BackendTesting |
|
12 |
{ |
|
13 |
[TestClass] |
|
14 |
public class Main_Testing_Class |
|
15 |
{ |
|
16 |
public IWebDriver fDriver = new FirefoxDriver(); |
|
17 |
public IWebDriver cDriver = new ChromeDriver(); |
|
18 |
|
|
19 |
|
|
20 |
[TestMethod] |
|
21 |
public void DummyTutorial() |
|
22 |
{ |
|
23 |
var webDriver = cDriver; //potrebuje "using selenium a chrome (firefox) |
|
24 |
//priprava promennych |
|
25 |
By googleSearchBar = By.Name("q"); |
|
26 |
By googleSearchButton = By.Name("btnK"); |
|
27 |
By searchName = By.XPath("//h2//span[text()='Elden Ring']"); |
|
28 |
By googleCoockieAggreementButton = By.Id("L2AGLb"); |
|
29 |
|
|
30 |
//prace s driverem |
|
31 |
webDriver.Manage().Window.Maximize(); |
|
32 |
webDriver.Navigate().GoToUrl("https://www.google.com/"); //zakladni stranka |
|
33 |
Thread.Sleep(500); |
|
34 |
|
|
35 |
webDriver.FindElement(googleCoockieAggreementButton).Click(); //odsouhlaseni coockies |
|
36 |
Thread.Sleep(500); |
|
37 |
|
|
38 |
webDriver.FindElement(googleSearchBar).SendKeys("Elden Ring"); //napsat Elden Ring do hledani |
|
39 |
Thread.Sleep(500); |
|
40 |
webDriver.FindElement(googleSearchButton).Click(); //kliknout na button pro poslani prikazu |
|
41 |
Thread.Sleep(500); |
|
42 |
|
|
43 |
var resultText = webDriver.FindElement(searchName); //najit pomoci xpath pozadovany element a ulozit si ho |
|
44 |
|
|
45 |
Assert.IsTrue(resultText.Text == "Elden Ring"); //samotny test pro otestovani stazene hodnoty |
|
46 |
|
|
47 |
|
|
48 |
webDriver.Quit(); //ukonceni webdriveru |
|
49 |
} |
|
50 |
|
|
51 |
|
|
52 |
} |
|
53 |
} |
Backend/BackendTesting/TagsManagementTesting.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class TagsManagementTesting |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Backend/BackendTesting/UserManagementTesting.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class UserManagementTesting |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Backend/BackendTesting/Utils.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace BackendTesting |
|
8 |
{ |
|
9 |
internal class Utils |
|
10 |
{ |
|
11 |
} |
|
12 |
} |
Také k dispozici: Unified diff
Backend testing skeleton