├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── csharp
├── Api
│ ├── Api.csproj
│ ├── Auth.cs
│ ├── Booking.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── Payloads
│ ├── Payloads.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Requests
│ │ ├── AuthPayload.cs
│ │ ├── BookingDatesPayload.cs
│ │ └── BookingPayload.cs
│ └── Responses
│ │ ├── AuthResponsePayload.cs
│ │ └── BookingResponsePayload.cs
├── Tests
│ ├── BookingTestsMsTest.cs
│ ├── BookingTestsNUnit.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Tests.csproj
│ └── packages.config
├── csharp.sln
└── packages
│ ├── NUnit.3.6.1
│ ├── CHANGES.txt
│ ├── LICENSE.txt
│ ├── NOTICES.txt
│ ├── NUnit.3.6.1.nupkg
│ └── lib
│ │ ├── MonoAndroid
│ │ ├── nunit.framework.dll
│ │ └── nunit.framework.xml
│ │ ├── Xamarin.iOS10
│ │ ├── nunit.framework.dll
│ │ └── nunit.framework.xml
│ │ ├── net20
│ │ ├── NUnit.System.Linq.dll
│ │ ├── nunit.framework.dll
│ │ └── nunit.framework.xml
│ │ ├── net35
│ │ ├── nunit.framework.dll
│ │ └── nunit.framework.xml
│ │ ├── net40
│ │ ├── nunit.framework.dll
│ │ └── nunit.framework.xml
│ │ ├── net45
│ │ ├── nunit.framework.dll
│ │ └── nunit.framework.xml
│ │ ├── netstandard1.6
│ │ ├── nunit.framework.dll
│ │ └── nunit.framework.xml
│ │ └── portable-net45+win8+wp8+wpa81
│ │ ├── nunit.framework.dll
│ │ └── nunit.framework.xml
│ ├── NUnit3TestAdapter.3.7.0
│ ├── LICENSE.txt
│ ├── NUnit3TestAdapter.3.7.0.nupkg
│ └── tools
│ │ ├── Mono.Cecil.Mdb.dll
│ │ ├── Mono.Cecil.Pdb.dll
│ │ ├── Mono.Cecil.Rocks.dll
│ │ ├── Mono.Cecil.dll
│ │ ├── NUnit3.TestAdapter.dll
│ │ ├── nunit.engine.api.dll
│ │ └── nunit.engine.dll
│ └── Newtonsoft.Json.9.0.1
│ ├── Newtonsoft.Json.9.0.1.nupkg
│ ├── lib
│ ├── net20
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── net35
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── net40
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── net45
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── netstandard1.0
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── portable-net40+sl5+wp80+win8+wpa81
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ └── portable-net45+wp80+win8+wpa81
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ └── tools
│ └── install.ps1
├── go.mod
├── go.sum
├── go
├── README.md
├── api
│ └── api.go
├── booking_test.go
├── main_test.go
└── payloads
│ └── payloads.go
├── java
├── restassured
│ ├── README.md
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── restfulbooker
│ │ │ └── api
│ │ │ ├── api
│ │ │ ├── AuthApi.java
│ │ │ ├── BaseApi.java
│ │ │ └── BookingApi.java
│ │ │ └── payloads
│ │ │ ├── Auth.java
│ │ │ ├── AuthResponse.java
│ │ │ ├── Booking.java
│ │ │ ├── BookingDates.java
│ │ │ └── BookingResponse.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── restfulbooker
│ │ └── api
│ │ ├── ApiTest.deleteBookingReturns201.approved.txt
│ │ ├── ApiTest.getBookingIdShouldReturn200.approved.txt
│ │ ├── ApiTest.getBookingIdWithBadAcceptShouldReturn418.approved.txt
│ │ ├── ApiTest.getBookingShouldReturn200.approved.txt
│ │ ├── ApiTest.java
│ │ └── ApiTest.postBookingReturns200.approved.txt
└── springmvc
│ ├── README.md
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── restfulbooker
│ │ └── api
│ │ ├── api
│ │ ├── Auth.java
│ │ └── Booking.java
│ │ └── payloads
│ │ ├── request
│ │ ├── AuthPayload.java
│ │ ├── BookingDatesPayload.java
│ │ └── BookingPayload.java
│ │ └── response
│ │ ├── AuthResponse.java
│ │ ├── BookingDetails.java
│ │ ├── BookingDetailsDates.java
│ │ └── BookingResponse.java
│ └── test
│ └── java
│ └── com
│ └── restfulbooker
│ └── api
│ ├── ApiTest.deleteBookingReturns201.approved.txt
│ ├── ApiTest.getBookingIdShouldReturn200.approved.txt
│ ├── ApiTest.getBookingIdWithBadAcceptShouldReturn418.approved.txt
│ ├── ApiTest.getBookingShouldReturn200.approved.txt
│ ├── ApiTest.java
│ └── ApiTest.postBookingReturns200.approved.txt
├── js
├── README.md
├── api
│ ├── authorise.js
│ └── booking.js
├── package-lock.json
├── package.json
├── payloads
│ ├── auth_payload.js
│ └── booking_payload.js
└── test
│ └── integration_tests.js
├── python
├── README.md
├── api
│ ├── __init__.py
│ ├── authorise.py
│ ├── booking.py
│ └── endpoints.py
├── payloads
│ ├── __init__.py
│ ├── authorise_payload.py
│ └── booking_payload.py
├── requirements.txt
└── test_integration.py
└── ruby
├── Gemfile
├── Gemfile.lock
├── README.md
├── Rakefile
├── api
├── authorise.rb
└── booking.rb
├── payloads
├── authorise_payload.rb
└── booking_payload.rb
└── spec
├── integration_spec.rb
└── spec_helper.rb
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.pyc
3 | *.pyo
4 | .DS_Store
5 | node_modules
6 | *.iml
7 | target
8 | /csharp/.vs
9 | /csharp/Api/bin
10 | /csharp/Api/obj
11 | /csharp/Payloads/bin
12 | /csharp/Payloads/obj
13 | /csharp/Tests/bin
14 | /csharp/Tests/obj
15 | /csharp/TestResults
16 | /csharp/packages
17 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Mark Winteringham
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # api-framework
2 |
3 | The frameworks all have the same structure that is based upon the tutorial series I wrote last year on [how to build an automated API test framework](http://www.mwtestconsultancy.co.uk/build-automated-api-test-framework/). The key to these templates is to demonstrate a way of structuring your API test framework regardless of what tools or languages that are used and is loosely based upon the principles of Page object architecture used for WebDriver. The idea being that the structure will increase readability, reduce maintenance and prevent brittle tests from appearing.
4 |
5 | The framework contains three areas:
6 |
7 |
8 | Tests - Surprisingly where the tests themselves are stored. The tests will call functions from the API and Payload areas of the framework and be responsible for asserting responses.
9 | API - All of the HTTP requests that you want to make are stored here. They are grouped based on the resource you are calling so if there are two resources called Booking and Auth then we create two classes named Booking and Auth. Each function is tied to an individual request that can be called multiple times. This means if the request changes it requires a single change to propagate through the framework.
10 | Payloads - Payloads that are required for requests and responses are stored in this area. The idea is similar to the API area in that one class is responsible for one payload that may be called multiple times. Again, this means if the payload changes it requires a single change to propagate through the framework.
11 |
12 |
13 | ## Setup
14 |
15 | Each framework has been setup using their respective package manager and there is an assumption you know how to use it. Simply use the package manager in each to pull down dependencies to get running.
16 |
17 | All frameworks have been designed to run tests against [https://restful-booker.herokuapp.com/](https://restful-booker.herokuapp.com/). If you would like to play with the code locally you can find it here: [https://github.com/mwinteringham/restful-booker](https://github.com/mwinteringham/restful-booker)
18 |
--------------------------------------------------------------------------------
/csharp/Api/Api.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {7C2F491A-AB79-4D7B-A272-9E725019026C}
8 | Library
9 | Properties
10 | Api
11 | Api
12 | v4.5.2
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 | ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
35 | True
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {a05b9ed7-d275-41b9-a500-9baabe44cb70}
55 | Payloads
56 |
57 |
58 |
59 |
60 |
61 |
62 |
69 |
--------------------------------------------------------------------------------
/csharp/Api/Auth.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Text;
4 | using Newtonsoft.Json;
5 | using Payloads.Responses;
6 | using Payloads.Requests;
7 |
8 | namespace Api
9 | {
10 | public class Auth
11 | {
12 | private static HttpClient _httpClient = new HttpClient();
13 |
14 | public static AuthResponsePayload PostAuth(AuthPayload payload)
15 | {
16 | try
17 | {
18 | string requestBody = JsonConvert.SerializeObject(payload);
19 | using (HttpRequestMessage request = new HttpRequestMessage { RequestUri = new Uri("https://restful-booker.herokuapp.com/auth"), Method = HttpMethod.Post })
20 | {
21 | request.Content = new StringContent(requestBody, Encoding.UTF8, "application/json");
22 | var response = _httpClient.SendAsync(request).Result;
23 | var responseString = response.Content.ReadAsStringAsync().Result;
24 | return JsonConvert.DeserializeObject(responseString);
25 | }
26 |
27 | }
28 | catch (Exception e)
29 | {
30 | Console.WriteLine("Exception caught: " + e);
31 | return null;
32 | }
33 |
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/csharp/Api/Booking.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Net.Http.Headers;
4 | using System.Text;
5 | using Newtonsoft.Json;
6 | using System.Web;
7 | using System.Net;
8 | using Payloads.Requests;
9 |
10 | namespace Api
11 | {
12 | public class Booking
13 | {
14 | private static string _baseUrl = "https://restful-booker.herokuapp.com";
15 |
16 | public static HttpResponseMessage GetBookings()
17 | {
18 | var bookingUrl = _baseUrl + "/booking/";
19 | using (var httpClient = new HttpClient())
20 | {
21 | using (HttpRequestMessage request = new HttpRequestMessage { RequestUri = new Uri(bookingUrl), Method = HttpMethod.Get })
22 | {
23 | var response = httpClient.SendAsync(request).Result;
24 | CheckFor200Response(response);
25 | return response;
26 | }
27 | }
28 | }
29 |
30 | public static HttpResponseMessage GetBooking(int id, MediaTypeHeaderValue accept)
31 | {
32 | var bookingUrl = _baseUrl + "/booking/" + id.ToString();
33 | using (var httpClient = new HttpClient())
34 | {
35 | using (HttpRequestMessage request = new HttpRequestMessage { RequestUri = new Uri(bookingUrl), Method = HttpMethod.Get })
36 | {
37 | request.Headers.Add("Accept", accept.ToString());
38 | var response = httpClient.SendAsync(request).Result;
39 | CheckFor200Response(response);
40 | return response;
41 | }
42 | }
43 | }
44 |
45 | public static HttpResponseMessage PostBooking(BookingPayload payload)
46 | {
47 | var bookingUrl = _baseUrl + "/booking/";
48 | string requestBody = JsonConvert.SerializeObject(payload);
49 | using (var httpClient = new HttpClient())
50 | {
51 | using (HttpRequestMessage request = new HttpRequestMessage { RequestUri = new Uri(bookingUrl), Method = HttpMethod.Post })
52 | {
53 | request.Content = new StringContent(requestBody, Encoding.UTF8, "application/json");
54 | //request.Headers.Add("Content-Type", "application/json");
55 | request.Headers.Add("Accept", "application/json");
56 | var response = httpClient.SendAsync(request).Result;
57 | CheckFor200Response(response);
58 | return response;
59 | }
60 | }
61 | }
62 |
63 | public static HttpResponseMessage DeleteBooking(int id, string tokenValue)
64 | {
65 | try
66 | {
67 | var cookieContainer = new CookieContainer();
68 | using (var handler = new HttpClientHandler())
69 | {
70 | handler.CookieContainer = cookieContainer;
71 | var bookingUrl = _baseUrl + "/booking/" + id.ToString();
72 | using (var httpClient = new HttpClient(handler))
73 | {
74 | using (HttpRequestMessage request = new HttpRequestMessage { RequestUri = new Uri(bookingUrl), Method = HttpMethod.Delete })
75 | {
76 | cookieContainer.Add(new Uri(bookingUrl), new Cookie("token", tokenValue));
77 | return httpClient.SendAsync(request).Result;
78 | }
79 | }
80 | }
81 | }
82 | catch (Exception e)
83 | {
84 | Console.WriteLine("Exception caught: " + e);
85 | return null;
86 | }
87 | }
88 |
89 | public static void CheckFor200Response(HttpResponseMessage response)
90 | {
91 | if ((int)response.StatusCode != 200)
92 | {
93 | throw new HttpException((int)response.StatusCode, "Request returned a non-200 response:" + response.RequestMessage);
94 | }
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/csharp/Api/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Api")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Api")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("7c2f491a-ab79-4d7b-a272-9e725019026c")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/csharp/Api/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/csharp/Payloads/Payloads.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {A05B9ED7-D275-41B9-A500-9BAABE44CB70}
8 | Library
9 | Properties
10 | Payloads
11 | Payloads
12 | v4.5.2
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
58 |
--------------------------------------------------------------------------------
/csharp/Payloads/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Payloads")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Payloads")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a05b9ed7-d275-41b9-a500-9baabe44cb70")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/csharp/Payloads/Requests/AuthPayload.cs:
--------------------------------------------------------------------------------
1 | namespace Payloads.Requests
2 | {
3 | public class AuthPayload
4 | {
5 | public string username { get; private set; }
6 | public string password { get; private set; }
7 |
8 | private AuthPayload(string username, string password)
9 | {
10 | this.username = username;
11 | this.password = password;
12 | }
13 |
14 | public AuthPayload()
15 | {
16 | }
17 |
18 |
19 | public void SetUsername(string username)
20 | {
21 | this.username = username;
22 | }
23 |
24 | public void SetPassword(string password)
25 | {
26 | this.password = password;
27 | }
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/csharp/Payloads/Requests/BookingDatesPayload.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Payloads.Requests
4 | {
5 | public class BookingDatesPayload
6 | {
7 | public DateTime checkin { get; private set; }
8 | public DateTime checkout { get; private set; }
9 |
10 | public BookingDatesPayload(DateTime checkin, DateTime checkout)
11 | {
12 | this.checkin = checkin;
13 | this.checkout = checkout;
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/csharp/Payloads/Requests/BookingPayload.cs:
--------------------------------------------------------------------------------
1 | namespace Payloads.Requests
2 | {
3 | public class BookingPayload
4 | {
5 | public string firstname { get; private set; }
6 | public string lastname { get; private set; }
7 | public int totalprice { get; private set; }
8 | public bool depositpaid { get; private set; }
9 | public BookingDatesPayload bookingdates { get; private set; }
10 | public string additionalneeds { get; private set; }
11 |
12 | public void SetFirstname(string firstname)
13 | {
14 | this.firstname = firstname;
15 | }
16 |
17 | public void SetLastname(string lastname)
18 | {
19 | this.lastname = lastname;
20 | }
21 |
22 | public void SetTotalPrice(int totalprice)
23 | {
24 | this.totalprice = totalprice;
25 | }
26 |
27 | public void SetDepositPaid(bool depositpaid)
28 | {
29 | this.depositpaid = depositpaid;
30 | }
31 |
32 | public void SetBookingDates(BookingDatesPayload bookingdates)
33 | {
34 | this.bookingdates = bookingdates;
35 | }
36 |
37 | public void SetAdditionalNeeds(string additionalneeds)
38 | {
39 | this.additionalneeds = additionalneeds;
40 | }
41 |
42 | private BookingPayload(string firstname, string lastname, int totalprice, bool depositpaid, BookingDatesPayload bookingdates, string additionalneeds)
43 | {
44 | this.firstname = firstname;
45 | this.lastname = lastname;
46 | this.totalprice = totalprice;
47 | this.depositpaid = depositpaid;
48 | this.bookingdates = bookingdates;
49 | this.additionalneeds = additionalneeds;
50 | }
51 |
52 | public BookingPayload()
53 | {
54 | }
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/csharp/Payloads/Responses/AuthResponsePayload.cs:
--------------------------------------------------------------------------------
1 | namespace Payloads.Responses
2 | {
3 | public class AuthResponsePayload
4 | {
5 | public string token { get; set; }
6 |
7 | public void SetToken(string token)
8 | {
9 | this.token = token;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/csharp/Payloads/Responses/BookingResponsePayload.cs:
--------------------------------------------------------------------------------
1 | using Payloads.Requests;
2 |
3 | namespace Payloads.Responses
4 | {
5 | public class BookingResponsePayload
6 | {
7 | public int bookingid { get; set; }
8 | public BookingPayload booking { get; set; }
9 |
10 | public void SetBookingiId(int bookingid)
11 | {
12 | this.bookingid = bookingid;
13 | }
14 |
15 | public void SetBooking(BookingPayload booking)
16 | {
17 | this.booking = booking;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/csharp/Tests/BookingTestsMsTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 | using Api;
4 | using System.Net.Http.Headers;
5 | using System.Net;
6 | using Newtonsoft.Json;
7 | using System.Web;
8 | using Payloads.Requests;
9 | using Payloads.Responses;
10 |
11 | namespace Tests
12 | {
13 | [TestClass]
14 | public class BookingTestsMsTest
15 | {
16 | [TestMethod]
17 | public void GetBookingShouldReturn200()
18 | {
19 | var response = Booking.GetBookings();
20 | Assert.IsTrue(response.IsSuccessStatusCode, "Status Code is not 200");
21 | }
22 |
23 | [TestMethod]
24 | public void GetBookingIdShouldReturn200()
25 | {
26 | var response = Booking.GetBooking(1,new MediaTypeHeaderValue("application/json"));
27 | Assert.IsTrue(response.IsSuccessStatusCode, "Status Code is not 200");
28 | }
29 |
30 | [TestMethod]
31 | public void GetBookingIdWithBadAcceptShouldReturn418()
32 | {
33 | try
34 | {
35 | var response = Booking.GetBooking(1, new MediaTypeHeaderValue("text/plain"));
36 | Assert.Fail("HttpException not thrown");
37 | }
38 | catch (HttpException e)
39 | {
40 | Assert.AreEqual(418, (int)e.GetHttpCode());
41 | }
42 | }
43 |
44 | [TestMethod]
45 | public void PostBookingReturns200()
46 | {
47 | BookingPayload payload = new BookingPayload();
48 | payload.SetFirstname("Mary");
49 | payload.SetLastname("White");
50 | payload.SetTotalPrice(200);
51 | payload.SetDepositPaid(true);
52 | payload.SetBookingDates(new BookingDatesPayload(new DateTime(2017, 3, 31), new DateTime(2017, 4, 3)));
53 | payload.SetAdditionalNeeds("None");
54 |
55 | var response = Booking.PostBooking(payload);
56 | Assert.IsTrue(response.IsSuccessStatusCode, "Status Code is not 200");
57 | }
58 |
59 | [TestMethod]
60 | public void DeleteBookingReturns201()
61 | {
62 | BookingPayload payload = new BookingPayload();
63 | payload.SetFirstname("Mary");
64 | payload.SetLastname("White");
65 | payload.SetTotalPrice(200);
66 | payload.SetDepositPaid(true);
67 | payload.SetBookingDates(new BookingDatesPayload(new DateTime(2017, 3, 31), new DateTime(2017, 4, 3)));
68 | payload.SetAdditionalNeeds("None");
69 |
70 | var response = Booking.PostBooking(payload);
71 | string responsePayload = response.Content.ReadAsStringAsync().Result;
72 | BookingResponsePayload bookingResponse = JsonConvert.DeserializeObject(responsePayload);
73 |
74 | AuthPayload authPayload = new AuthPayload();
75 | authPayload.SetUsername("admin");
76 | authPayload.SetPassword("password123");
77 |
78 | AuthResponsePayload authResponse = Auth.PostAuth(authPayload);
79 |
80 | var deleteResponse = Booking.DeleteBooking(bookingResponse.bookingid, authResponse.token);
81 |
82 | Assert.IsTrue(deleteResponse.StatusCode == HttpStatusCode.Created, "Http Status Code is not 201");
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/csharp/Tests/BookingTestsNUnit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Api;
3 | using System.Net.Http.Headers;
4 | using System.Net;
5 | using Newtonsoft.Json;
6 | using System.Web;
7 | using NUnit.Framework;
8 | using Payloads.Responses;
9 | using Payloads.Requests;
10 |
11 | namespace Tests
12 | {
13 | [TestFixture]
14 | public class BookingTestsNUnit
15 | {
16 | [Test]
17 | public void GetBookingShouldReturn200()
18 | {
19 | var response = Booking.GetBookings();
20 | Assert.IsTrue(response.IsSuccessStatusCode, "Status Code is not 200");
21 | }
22 |
23 | [Test]
24 | public void GetBookingIdShouldReturn200()
25 | {
26 | var response = Booking.GetBooking(1,new MediaTypeHeaderValue("application/json"));
27 | Assert.IsTrue(response.IsSuccessStatusCode, "Status Code is not 200");
28 | }
29 |
30 | [Test]
31 | public void GetBookingIdWithBadAcceptShouldReturn418()
32 | {
33 | try
34 | {
35 | Booking.GetBooking(1, new MediaTypeHeaderValue("text/plain"));
36 | Assert.Fail("HttpException not thrown");
37 | }
38 | catch (HttpException e)
39 | {
40 | Assert.AreEqual(418, (int)e.GetHttpCode());
41 | }
42 | }
43 |
44 | [Test]
45 | public void PostBookingReturns200()
46 | {
47 | BookingPayload payload = new BookingPayload();
48 | payload.SetFirstname("Mary");
49 | payload.SetLastname("White");
50 | payload.SetTotalPrice(200);
51 | payload.SetDepositPaid(true);
52 | payload.SetBookingDates(new BookingDatesPayload(new DateTime(2017, 3, 31), new DateTime(2017, 4, 3)));
53 | payload.SetAdditionalNeeds("None");
54 |
55 | var response = Booking.PostBooking(payload);
56 | Assert.IsTrue(response.IsSuccessStatusCode, "Status Code is not 200");
57 | }
58 |
59 | [Test]
60 | public void DeleteBookingReturns201()
61 | {
62 | BookingPayload payload = new BookingPayload();
63 | payload.SetFirstname("Mary");
64 | payload.SetLastname("White");
65 | payload.SetTotalPrice(200);
66 | payload.SetDepositPaid(true);
67 | payload.SetBookingDates(new BookingDatesPayload(new DateTime(2017, 3, 31), new DateTime(2017, 4, 3)));
68 | payload.SetAdditionalNeeds("None");
69 |
70 | var response = Booking.PostBooking(payload);
71 | string responsePayload = response.Content.ReadAsStringAsync().Result;
72 | BookingResponsePayload bookingResponse = JsonConvert.DeserializeObject(responsePayload);
73 |
74 | AuthPayload authPayload = new AuthPayload();
75 | authPayload.SetUsername("admin");
76 | authPayload.SetPassword("password123");
77 |
78 | AuthResponsePayload authResponse = Auth.PostAuth(authPayload);
79 |
80 | var deleteResponse = Booking.DeleteBooking(bookingResponse.bookingid, authResponse.token);
81 |
82 | Assert.IsTrue(deleteResponse.StatusCode == HttpStatusCode.Created, "Http Status Code is not 201");
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/csharp/Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Tests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Tests")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("b44824bc-023d-48a0-b1e8-abde77eda444")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/csharp/Tests/Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {B44824BC-023D-48A0-B1E8-ABDE77EDA444}
7 | Library
8 | Properties
9 | Tests
10 | Tests
11 | v4.5.2
12 | 512
13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 10.0
15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
17 | False
18 | UnitTest
19 |
20 |
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 |
39 | ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
40 | True
41 |
42 |
43 | ..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll
44 | True
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | {7c2f491a-ab79-4d7b-a272-9e725019026c}
70 | Api
71 |
72 |
73 | {a05b9ed7-d275-41b9-a500-9baabe44cb70}
74 | Payloads
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | False
85 |
86 |
87 | False
88 |
89 |
90 | False
91 |
92 |
93 | False
94 |
95 |
96 |
97 |
98 |
99 |
100 |
107 |
--------------------------------------------------------------------------------
/csharp/Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/csharp/csharp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Payloads", "Payloads\Payloads.csproj", "{A05B9ED7-D275-41B9-A500-9BAABE44CB70}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{B44824BC-023D-48A0-B1E8-ABDE77EDA444}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api", "Api\Api.csproj", "{7C2F491A-AB79-4D7B-A272-9E725019026C}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {A05B9ED7-D275-41B9-A500-9BAABE44CB70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {A05B9ED7-D275-41B9-A500-9BAABE44CB70}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {A05B9ED7-D275-41B9-A500-9BAABE44CB70}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {A05B9ED7-D275-41B9-A500-9BAABE44CB70}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {B44824BC-023D-48A0-B1E8-ABDE77EDA444}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {B44824BC-023D-48A0-B1E8-ABDE77EDA444}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {B44824BC-023D-48A0-B1E8-ABDE77EDA444}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {B44824BC-023D-48A0-B1E8-ABDE77EDA444}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {7C2F491A-AB79-4D7B-A272-9E725019026C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {7C2F491A-AB79-4D7B-A272-9E725019026C}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {7C2F491A-AB79-4D7B-A272-9E725019026C}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {7C2F491A-AB79-4D7B-A272-9E725019026C}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/CHANGES.txt:
--------------------------------------------------------------------------------
1 | NUnit 3.6.1 - February 26, 2017
2 |
3 | This is a hotfix release of the framework that addresses critical issues found in
4 | the 3.6 release.
5 |
6 | Issues Resolved
7 |
8 | * 1962 A Theory with no data passes
9 | * 1986 NUnitLite ignores --workers option
10 | * 1994 NUnitLite runner crashing when --trace is specified
11 | * 2017 Two NUnit project's tests fail on systems with comma decimal mark settings
12 | * 2043 Regression in 3.6.0 when catching AssertionException
13 |
14 | NUnit 3.6 - January 9, 2017
15 |
16 | This release of the framework no longer includes builds for Compact Framework or
17 | for SilverLight, but adds a .NET Standard 1.6 build. If anyone still using
18 | Compact Framework or SilverLight and would like to continue development on those
19 | versions of the framework, please contact the NUnit team.
20 |
21 | Framework
22 |
23 | * .NET Standard 1.6 is now supported
24 | * Adds support for Multiple Assert blocks
25 | * Added the --params option to NUnitLite
26 | * Theories now support Nullable enums
27 | * Improved assert error messages to help differentiate differences in values
28 | * Added warnings with Warn.If(), Warn.Unless() and Assert.Warn()
29 | * Enabled Path, File and Directory Asserts/Contraints for .NET Core testing
30 | * Added NonTestAssemblyAttribute for use by third-party developers to indicate
31 | that their assemblies reference the NUnit framework, but do not contain tests
32 |
33 | Issues Resolved
34 |
35 | * 406 Warning-level Assertions
36 | * 890 Allow file references anywhere in the command line.
37 | * 1380 Appveyor Failures when branch name is too long
38 | * 1589 Split the nunit repository into multiple repositories
39 | * 1599 Move Compact Framework to separate project
40 | * 1601 Move Silverlight to a separate project
41 | * 1609 Upgrade Cake build to latest version
42 | * 1661 Create .NET Standard Framework Build
43 | * 1668 Need implementation-independent way to test number of items in a collection
44 | * 1743 Provide multiple results for a test case in the XML output
45 | * 1758 No direct inverse for Contains.Key
46 | * 1765 TestCaseSourceAttribute constructor for method with parameters
47 | * 1802 Design Multiple Assert syntax as seen by users
48 | * 1808 Disambiguate error messages from EqualConstraint
49 | * 1811 Build.ps1 fails if spaces in path
50 | * 1823 Remove engine nuspecs and old global.json
51 | * 1827 Remove unused repository paths from repositories.config
52 | * 1828 Add Retry for failed tests only
53 | * 1829 NUnitLite accepts --params option but does not make any use of it.
54 | * 1836 Support nullable enums in Theories
55 | * 1837 [Request] AfterContraint to support more readable usage
56 | * 1840 Remove SL and CF #Defined source
57 | * 1866 [Request] More readable way to set polling interval in After constraint
58 | * 1870 EqualConstraint result failure message for DateTime doesn't show sufficient resolution
59 | * 1872 Parameterized method being called with no parameter
60 | * 1876 What should we do about Env.cs
61 | * 1880 AttributeUsage for various Attributes
62 | * 1889 Modify nunitlite to display multiple assert information
63 | * 1891 TestContext.Progress and TestContext.Error silently drop text that is not properly XML encoded
64 | * 1901 Make nunitlite-runner Prefer32Bit option consistent across Debug/Release
65 | * 1904 Add .NET Standard 1.6 Dependencies to the Nuspec Files
66 | * 1907 Handle early termination of multiple assert block
67 | * 1911 Changing misleading comment that implies that every ICollection is a list
68 | * 1912 Add new warning status and result state
69 | * 1913 Report Warnings in NUnitLite
70 | * 1914 Extra AssertionResult entries in TestResults
71 | * 1915 Enable Path, File and Directory Assert/Constraints in the .NET Standard Build
72 | * 1917 Use of IsolatedContext breaks tests in user-created AppDomain
73 | * 1924 Run tests using the NUnit Console Runner
74 | * 1929 Rename zip and remove source zip
75 | * 1933 Tests should pass if test case source provides 0 test cases
76 | * 1941 Use dictionary-based property for test run parameters
77 | * 1945 Use high-quality icon for nuspecs
78 | * 1947 Add NonTestAssemblyAttribute
79 | * 1954 Change Error Message for Assert.Equals
80 | * 1960 Typo fixes
81 | * 1966 Xamarin Runner cannot reference NUnit NuGet Package
82 |
83 | NUnit 3.5 - October 3, 2015
84 |
85 | This is the first version of NUnit where the framework will be released separately from the
86 | console runner, engine and other extensions. From this point forward, the NUnit Framework will be
87 | released on its own schedule that is not bound to that of any other NUnit project and version numbers
88 | may diverge over time.
89 |
90 | This is also the first release where the NUnit Framework will not be included in the installer. Only
91 | the console runner, engine and extensions will be available as an MSI installer. We recommend that you
92 | use the NUnit NuGet packages for the framework, but a ZIP file with the binaries will also be available.
93 |
94 | Framework
95 |
96 | * Added Assert.Zero and Assert.NotZero methods
97 | * You can now pass a Func to Asserts to lazily evaluate exception messages
98 | * Added the ability to Assert on the order of multiple properties in a collection
99 | * Tests with a Timeout will no longer timeout while you are debugging
100 |
101 | Issues Resolved
102 |
103 | * 144 Pass a Func to lazily evaluate an exception message
104 | * 995 Enable Warning as Error
105 | * 1106 Move various Assembly Info files under Properties for CF
106 | * 1334 Add Assert.Zero and Assert.NotZero
107 | * 1479 Don't enforce [Timeout] when debugger is attached
108 | * 1540 Remove old .NET Core Projects
109 | * 1553 Allow ordering tests to be done in multiple properties
110 | * 1575 Escaping control chars in custom message
111 | * 1596 Eliminate code sharing across projects to be split
112 | * 1598 Split framework and console/engine into separate projects
113 | * 1610 Refactor dependencies in build.cake
114 | * 1615 Appveyor error in TestCF
115 | * 1621 Remove console and command-line option files from common
116 | * 1640 When submitting only part of optional parameters, all are overriden by defaults
117 | * 1641 Create OSX CI Build on Travis
118 | * 1663 Find way to hide NUnit.Compatability.Path from intellisense
119 | * 1681 NUnitLite under .net core doesn't support TeamCity output
120 | * 1683 Existence of SerializableAttribute in .NET Core
121 | * 1693 2 unit tests fail due to localization
122 | * 1716 Move installer to new repository
123 | * 1717 Change suffix for master builds
124 | * 1723 Remove Cake target TestAll
125 | * 1739 Create separate copies of MockAssembly for framework, engine and extensions
126 | * 1751 Serializable attribute exists in both System.Runtime.Serialization.Formatters and nunit.framework
127 | * 1775 Support NUnit assertions in partial trust code.
128 | * 1800 Remove Console/Engine projects from nunit.linux.sln
129 | * 1805 Error message "arguments provided for method not taking any" seems incomplete / doesn't make much sense
130 | * 1815 Prevent NullReferenceException in SubPathConstraint
131 |
132 | NUnit 3.4.1 - June 30, 2016
133 |
134 | Console Runner
135 |
136 | * A new option, --list-extensions, will display all the engine extensions that
137 | have been installed by the engine.
138 |
139 | Issues Resolved
140 |
141 | * 1623 NUnit 3.4 is not integrated with TeamCity
142 | * 1626 NUnit.ConsoleRunner is not picking up NUnit.Extension.NUnitV2ResultWriter
143 | * 1628 Agent's process stays in memory when it was failed to unload AppDomain
144 | * 1635 Console option to list loaded extensions
145 |
146 | NUnit 3.4 - June 25, 2016
147 |
148 | Framework
149 |
150 | * Improvements in comparing equality using IEquatable
151 | * Test case names will only be truncated if the runner requests it or it is overridden on the command line
152 | with the --test-name-format option
153 | * The .NET 2.0 version of the framework now includes LINQ. If your tests target .NET 2.0, you can now use
154 | LINQ queries in your tests
155 |
156 | Engine
157 |
158 | * The TeamCity event listener has been separated out into an engine extension
159 | * Fixed numerous issues around thread safety of parallel test runs
160 | * Additional fixes to reduce memory usage
161 | * Fixes for Mono 4.4
162 |
163 | Console Runner
164 |
165 | * There is a new --params command line option that allows you to pass parameters to your tests
166 | which can be retrieved using TestContext.Parameters
167 | * Another new command line option --loaduserprofile causes the User Profile to be loaded into the
168 | NUnit Agent process.
169 |
170 | Issues Resolved
171 |
172 | * 329 (CLI) Runner does not report AppDomain unloading timeout
173 | * 720 Need a way to get test-specific command-line arguments at runtime
174 | * 1010 Need to control engine use of extensions
175 | * 1139 Nunit3 console doesn't show test output continously
176 | * 1225 The --teamcity option should really be an extension
177 | * 1241 Make TestDirectory accessible when TestCaseSource attributes are evaluated
178 | * 1366 Classname for inherited test is not correct
179 | * 1371 Support `dotnet test` in .NET CLI and .NET Core
180 | * 1379 Console returns 0 for invalid fixtures
181 | * 1422 Include TestListWithEmptyLine.tst in ZIP Package
182 | * 1423 SingleThreaded attribute should raise an error if a thread is required
183 | * 1425 Lazy initialization of OutWriter in TestResult is not thread safe
184 | * 1427 Engine extensions load old packages
185 | * 1430 TestObjects are retained for lifetime of test run, causing high memory usage
186 | * 1432 NUnit hangs when reporting to TeamCity
187 | * 1434 TestResult class needs to be thread-safe
188 | * 1435 Parallel queue creation needs to be thread-safe
189 | * 1436 CurrentFramework and Current Platform need to be more thread-safe
190 | * 1439 EqualConstraint does Not use Equals Override on the Expected Object
191 | * 1441 Add Linq for use internally in .NET 2.0 code
192 | * 1446 TestOrderAttributeTests is not public
193 | * 1450 Silverlight detection doesn't work when building on 32-bit OS
194 | * 1457 Set the 2.0 build to ignore missing xml dcoumentation
195 | * 1463 Should TestResult.AssertCount have a public setter?
196 | * 1464 TNode.EscapeInvalidXmlCharacters recreates Regex continually
197 | * 1470 Make EventQueue and associated classes lock-less and thread safe
198 | * 1476 Examine need for "synchronous" events in event queue
199 | * 1481 TestCase with generic return type causes NullReferenceException
200 | * 1483 Remoting exceptions during test execution
201 | * 1484 Comparing Equality using IEquatable Should Use Most Specific Method
202 | * 1493 NUnit 2 test results report ParameterizedMethod but should be ParameterizedTest
203 | * 1507 NullReferenceException when null arguments are used in TestFixtureAttribute
204 | * 1513 Add new teamcity extension to packages
205 | * 1518 NUnit does not send the "testStarted" TeamCity service message when exception was thrown from SetUp/OneTimeSetUp
206 | * 1520 Detect Portable, Silverlight and Compact and give error message
207 | * 1528 Use of Sleep(0) in NUnit
208 | * 1543 Blank name attribute in nunit2-formatted XML result file test-run element
209 | * 1547 Create separate assembly for System.Linq compatibility classes
210 | * 1548 Invalid Exception when engine is in a 32-bit process
211 | * 1549 Changing default behavior for generating test case names
212 | * 1551 Path in default .addins file for ConsoleRunner package may not exist
213 | * 1555 EndsWith calls in Constraint constructor can cause major perf issues
214 | * 1560 Engine writes setting file unnecessarily
215 | * 1573 Move Nunit.Portable.Agent to new Repo
216 | * 1579 NUnit v3 dangerously overrides COMPLUS_Version environment variable
217 | * 1582 Mono 4.4.0 Causes Test Failures
218 | * 1593 Nunit Console Runner 3.2.1 and Mono 4.4 throws RemotingException
219 | * 1597 Move Portable agent to its own repository
220 | * 1605 TeamCity package has no pre-release suffix
221 | * 1607 nunit.nuget.addins discovery pattern is wrong then restored through project.json
222 | * 1617 Load user profile on test runners
223 |
224 | NUnit 3.2.1 - April 19, 2016
225 |
226 | Framework
227 |
228 | * The output and error files are now thread safe when running tests in parallel
229 | * Added a .NET 3.5 build of the framework preventing conflicts with the compatiblity classes in the 2.0 framework
230 | * Added a SingleThreadedAttribute to be added to a TestFixture to indicate all child tests should run on the same thread
231 |
232 | Engine
233 |
234 | * Unless required, run all tests within a fixture on the same thread
235 | * Added an EventListener extension point
236 | * Reduced memory usage
237 |
238 | Console Runner
239 |
240 | * No longer probes for newer versions of the engine, instead uses the engine that is included with the console
241 |
242 | Issues Resolved
243 |
244 | * 332 Add CF to the Appveyor CI build
245 | * 640 Keep CF Build (and other future builds) in Sync
246 | * 773 Upgrade Travis CI from Legacy Infrastructure
247 | * 1141 Explicit Tests get run when using --where with some filters
248 | * 1161 NUnit3-Console should disallow the combination of --inprocess and --x86, giving an error message
249 | * 1208 Apartment on assembly level broken
250 | * 1231 Build may silently fail some tests
251 | * 1247 Potential memory issue
252 | * 1266 SetCultureAttribute does not work if set on assembly level
253 | * 1302 Create EventListener ExtensionPoint for the Engine
254 | * 1317 Getting CF framework unit tests running on CI build
255 | * 1318 NUnit console runner fails with error code -100
256 | * 1327 TestCaseSource in NUnit 3 converts an argument declared as String[] to String
257 | * 1329 Unable to build without Compact Framework
258 | * 1333 Single Thread per Worker
259 | * 1338 BUILDING.txt is outdated
260 | * 1349 Collision on System.Func from nunit.framework with System.Core in .Net 3.5 (CS0433)
261 | * 1352 Tests losing data setup on thread
262 | * 1359 Compilation error in NUnitPortableDriverTests.cs
263 | * 1383 Skip Silverlight build if SDK not installed
264 | * 1386 Bug when using Assert.Equals() with types that explicitly implement IEquatable
265 | * 1390 --testlist with file with blank first line causes IndexOutOfRangeException
266 | * 1399 Fixed NullReference issue introduced by the fix for #681
267 | * 1405 ITestRunner.StopRun throws exception of type 'System.MissingMethodException'
268 | * 1406 TextCapture is not threadsafe but is used to intercept calls that are expected to be threadsafe
269 | * 1410 Make OutFile and ErrFile streamwriters synchronized
270 | * 1413 Switch console to use a local engine
271 |
272 | NUnit 3.2 - March 5, 2016
273 |
274 | Framework
275 |
276 | * Added an Order attribute that defines the order in which tests are run
277 | * Added Assert.ThrowsAsync for testing if async methods throw an exception
278 | * You can now compare unlike collections using Is.EquivalentTo().Using(...)
279 | * Added the ability to add custom message formatters to MsgUtils
280 | * TestCaseSourceAttribute now optionally takes an array of parameters that can be passed to the source method
281 | * Added Is.Zero and Is.Not.Zero to the fluent syntax as a shorter option for Is.EqualTo(0) and Is.Not.EqualTo(0)
282 |
283 | Engine
284 |
285 | * Engine extensions can be installed via NuGet packages
286 |
287 | Issues Resolved
288 |
289 | * 170 Test Order Attribute
290 | * 300 Create an NUnit Visual Studio Template
291 | * 464 Async delegate assertions
292 | * 532 Batch runner for Silverlight tests
293 | * 533 Separate NUnitLite runner and autorunner
294 | * 681 NUnit agent cannot resolve test dependency assemblies when mixed mode initialization runs in the default AppDomain
295 | * 793 Replace CoreEngine by use of Extensions
296 | * 907 Console report tests are too fragile
297 | * 922 Wrap Console in NUnitLite
298 | * 930 Switch from MSBuild based build system to Cake
299 | * 981 Define NUnit Versioning for post-3.0 Development
300 | * 1004 Poor formatting of results for Assert.AreEqual(DateTimeOffset, DateTimeOffset)
301 | * 1018 ArgumentException when 2.x version of NUnit Framework is in the bin directory
302 | * 1022 Support Comparing Unlike Collections using Is.EquivalentTo().Using(...)
303 | * 1044 Re-order Test Summary Errors/Failures
304 | * 1066 ApartmentAttribute and TestCaseAttribute(s) do not work together
305 | * 1103 Can't use TestCaseData from base class
306 | * 1109 NullReferenceException when using inherited property for ValueSource
307 | * 1113 Console runner and xml output consistency
308 | * 1117 Fix misbehaviour of Throws.Exception with non-void returning functions
309 | * 1120 NUnitProject should parse .nunit project files containing Xml Declarations
310 | * 1121 Usage of field set to null as value source leads to somewhat cryptic error
311 | * 1122 Region may be disposed before test delegate is executed
312 | * 1133 Provide a way to install extensions as nuget packages
313 | * 1136 Don't allow V2 framework to update in V2 driver tests
314 | * 1171 A bug when using Assert.That() with Is.Not.Empty
315 | * 1185 Engine finds .NET 4.0 Client Profile twice
316 | * 1187 ITestAssemblyRunner.StopRun as implemented by NUnitTestAssemblyRunner
317 | * 1195 name attribute in test-suite and test-results element of output xml is different to nunit 2.6.4 using nunit2-format
318 | * 1196 Custom value formatter for v3 via MsgUtils
319 | * 1210 Available runtimes issues
320 | * 1230 Add ability for testcasedatasource to have parameters passed to methods
321 | * 1233 Add TestAssemblyRunner tests to both portable and silverlight builds
322 | * 1234 Have default NUnitLite Runner Program.cs return exit code
323 | * 1236 Make Appveyor NuGet feed more useable
324 | * 1246 Introduce Is.Zero syntax to test for zero
325 | * 1252 Exception thrown when any assembly is not found
326 | * 1261 TypeHelper.GetDisplayName generates the wrong name for generic types with nested classes
327 | * 1278 Fix optional parameters in TestCaseAttribute
328 | * 1282 TestCase using Params Behaves Oddly
329 | * 1283 Engine should expose available frameworks.
330 | * 1286 value of the time attribute in nunit2 outputs depends on the machine culture
331 | * 1297 NUnit.Engine nuget package improvements
332 | * 1301 Assert.AreNotSame evaluates ToString unnecessarily
333 |
334 | NUnit 3.0.1 - December 1, 2015
335 |
336 | Console Runner
337 |
338 | * The Nunit.Runners NuGet package was updated to become a meta-package that pulls in the NUnit.Console package
339 | * Reinstated the --pause command line option that will display a message box allowing you to attach a debugger if the --debug option does not work
340 |
341 | Issues Resolved
342 |
343 | * 994 Add max number of Agents to the NUnit project file
344 | * 1014 Ensure NUnit API assembly updates with MSI installs
345 | * 1024 Added --pause flag to console runner
346 | * 1030 Update Nunit.Runners package to 3.0
347 | * 1033 "No arguments were provided" with Theory and Values combination
348 | * 1035 Check null arguments
349 | * 1037 Async tests not working on Windows 10 Universal
350 | * 1041 NUnit2XmlResult Writer is reporting Sucess when test fails
351 | * 1042 NUnit2 reports on 3.0 is different than 2.6.4
352 | * 1046 FloatingPointNumerics.AreAlmostEqualUlps throws OverflowException
353 | * 1049 Cannot select Generic tests from command line
354 | * 1050 Do not expose System.Runtime.CompilerServices.ExtensionAttribute to public
355 | * 1054 Create nuget feeds for CI builds on Appveyor
356 | * 1055 nunit3 console runner --where option does not return error on invalid selection string
357 | * 1060 Remove "Version 3" from NUnit Nuget Package
358 | * 1061 Nunit30Settings.xml becomes corrupted
359 | * 1062 Console.WriteLine statements in "OneTimeSetUp" and "OneTimeTearDown" annotated methods are not directed to the console when using nunit3-console.exe runner
360 | * 1063 Error in Random Test
361 |
362 | NUnit 3.0.0 Final Release - November 15, 2015
363 |
364 | Issues Resolved
365 |
366 | * 635 Mono 4.0 Support
367 |
368 | NUnit 3.0.0 Release Candidate 3 - November 13, 2015
369 |
370 | Engine
371 |
372 | * The engine now only sets the config file for project.nunit to project.config if project.config exists. Otherwise, each assembly uses its own config, provided it is run in a separate AppDomain by itself.
373 |
374 | NOTE: It is not possible for multiple assemblies in the same AppDomain to use different configs. This is not an NUnit limitation, it's just how configs work!
375 |
376 | Issues Resolved
377 |
378 | * 856 Extensions support for third party runners in NUnit 3.0
379 | * 1003 Delete TeamCityEventHandler as it is not used
380 | * 1015 Specifying .nunit project and --framework on command line causes crash
381 | * 1017 Remove Assert.Multiple from framework
382 |
383 | NUnit 3.0.0 Release Candidate 2 - November 8, 2015
384 |
385 | Engine
386 |
387 | * The IDriverFactory extensibility interface has been modified.
388 |
389 | Issues Resolved
390 |
391 | * 970 Define PARALLEL in CF build of nunitlite
392 | * 978 It should be possible to determine version of NUnit using nunit console tool
393 | * 983 Inconsistent return codes depending on ProcessModel
394 | * 986 Update docs for parallel execution
395 | * 988 Don't run portable tests from NUnit Console
396 | * 990 V2 driver is passing invalid filter elements to NUnit
397 | * 991 Mono.Options should not be exposed to public directly
398 | * 993 Give error message when a regex filter is used with NUnit V2
399 | * 997 Add missing XML Documentation
400 | * 1008 NUnitLite namespace not updated in the NuGet Packages
401 |
402 | NUnit 3.0.0 Release Candidate - November 1, 2015
403 |
404 | Framework
405 |
406 | * The portable build now supports ASP.NET 5 and the new Core CLR.
407 |
408 | NOTE: The `nunit3-console` runner cannot run tests that reference the portable build.
409 | You may run such tests using NUnitLite or a platform-specific runner.
410 |
411 | * `TestCaseAttribute` and `TestCaseData` now allow modifying the test name without replacing it entirely.
412 | * The Silverlight packages are now separate downloads.
413 |
414 | NUnitLite
415 |
416 | * The NUnitLite runner now produces the same output display and XML results as the console runner.
417 |
418 | Engine
419 |
420 | * The format of the XML result file has been finalized and documented.
421 |
422 | Console Runner
423 |
424 | * The console runner program is now called `nunit3-console`.
425 | * Console runner output has been modified so that the summary comes at the end, to reduce the need for scrolling.
426 |
427 | Issues Resolved
428 |
429 | * 59 Length of generated test names should be limited
430 | * 68 Customization of test case name generation
431 | * 404 Split tests between nunitlite.runner and nunit.framework
432 | * 575 Add support for ASP.NET 5 and the new Core CLR
433 | * 783 Package separately for Silverlight
434 | * 833 Intermittent failure of WorkItemQueueTests.StopQueue_WithWorkers
435 | * 859 NUnit-Console output - move Test Run Summary to end
436 | * 867 Remove Warnings from Ignored tests
437 | * 868 Review skipped tests
438 | * 887 Move environment and settings elements to the assembly suite in the result file
439 | * 899 Colors for ColorConsole on grey background are too light
440 | * 904 InternalPreserveStackTrace is not supported on all Portable platforms
441 | * 914 Unclear error message from console runner when assembly has no tests
442 | * 916 Console runner dies when test agent dies
443 | * 918 Console runner --where parameter is case sensitive
444 | * 920 Remove addins\nunit.engine.api.dll from NuGet package
445 | * 929 Rename nunit-console.exe
446 | * 931 Remove beta warnings from NuGet packages
447 | * 936 Explicit skipped tests not displayed
448 | * 939 Installer complains about .NET even if already installed
449 | * 940 Confirm or modify list of packages for release
450 | * 947 Breaking API change in ValueSourceAttribute
451 | * 949 Update copyright in NUnit Console
452 | * 954 NUnitLite XML output is not consistent with the engine's
453 | * 955 NUnitLite does not display the where clause
454 | * 959 Restore filter options for NUnitLite portable build
455 | * 960 Intermittent failure of CategoryFilterTests
456 | * 967 Run Settings Report is not being displayed.
457 |
458 | NUnit 3.0.0 Beta 5 - October 16, 2015
459 |
460 | Framework
461 |
462 | * Parameterized test cases now support nullable arguments.
463 | * The NUnit framework may now be built for the .NET Core framework. Note that this is only available through building the source code. A binary will be available in the next release.
464 |
465 | Engine
466 |
467 | * The engine now runs multiple test assemblies in parallel by default
468 | * The output XML now includes more information about the test run, including the text of the command used, any engine settings and the filter used to select tests.
469 | * Extensions may now specify data in an identifying attribute, for use by the engine in deciding whether to load that extension.
470 |
471 |
472 | Console Runner
473 |
474 | * The console now displays all settings used by the engine to run tests as well as the filter used to select tests.
475 | * The console runner accepts a new option --maxagents. If multiple assemblies are run in separate processes, this value may be used to limit the number that are executed simultaneously in parallel.
476 | * The console runner no longer accepts the --include and --exclude options. Instead, the new --where option provides a more general way to express which tests will be executed, such as --where "cat==Fast && Priority==High". See the docs for details of the syntax.
477 | * The new --debug option causes NUnit to break in the debugger immediately before tests are run. This simplifies debugging, especially when the test is run in a separate process.
478 |
479 | Issues Resolved
480 |
481 | * 41 Check for zeroes in Assert messages
482 | * 254 Finalize XML format for test results
483 | * 275 NUnitEqualityComparer fails to compare IEquatable where second object is derived from T
484 | * 304 Run test Assemblies in parallel
485 | * 374 New syntax for selecting tests to be run
486 | * 515 OSPlatform.IsMacOSX doesn't work
487 | * 573 nunit-console hangs on Mac OS X after all tests have run
488 | * 669 TeamCity service message should have assembly name as a part of test name.
489 | * 689 The TeamCity service message "testFinished" should have an integer value in the "duration" attribute
490 | * 713 Include command information in XML
491 | * 719 We have no way to configure tests for several assemblies using NUnit project file and the common installation from msi file
492 | * 735 Workers number in xml report file cannot be found
493 | * 784 Build Portable Framework on Linux
494 | * 790 Allow Extensions to provide data through an attribute
495 | * 794 Make it easier to debug tests as well as NUnit itself
496 | * 801 NUnit calls Dispose multiple times
497 | * 814 Support nullable types with TestCase
498 | * 818 Possible error in Merge Pull Request #797
499 | * 821 Wrapped method results in loss of result information
500 | * 822 Test for Debugger in NUnitTestAssemblyRunner probably should not be in CF build
501 | * 824 Remove unused System.Reflection using statements
502 | * 826 Randomizer uniqueness tests fail randomly!
503 | * 828 Merge pull request #827 (issue 826)
504 | * 830 Add ability to report test results synchronously to test runners
505 | * 837 Enumerators not disposed when comparing IEnumerables
506 | * 840 Add missing copyright notices
507 | * 844 Pull Request #835 (Issue #814) does not build in CF
508 | * 847 Add new --process:inprocess and --inprocess options
509 | * 850 Test runner fails if test name contains invalid xml characters
510 | * 851 'Exclude' console option is not working in NUnit Lite
511 | * 853 Cannot run NUnit Console from another directory
512 | * 860 Use CDATA section for message, stack-trace and output elements of XML
513 | * 863 Eliminate core engine
514 | * 865 Intermittent failures of StopWatchTests
515 | * 869 Tests that use directory separator char to determine platform misreport Linux on MaxOSX
516 | * 870 NUnit Console Runtime Environment misreports on MacOSX
517 | * 874 Add .NET Core Framework
518 | * 878 Cannot exclude MacOSX or XBox platforms when running on CF
519 | * 892 Fixed test runner returning early when executing more than one test run.
520 | * 894 Give nunit.engine and nunit.engine.api assemblies strong names
521 | * 896 NUnit 3.0 console runner not placing test result xml in --work directory
522 |
523 | NUnit 3.0.0 Beta 4 - August 25, 2015
524 |
525 | Framework
526 |
527 | * A new RetryAttribute allows retrying of failing tests.
528 | * New SupersetConstraint and Is.SupersetOf syntax complement SubsetConstraint.
529 | * Tests skipped due to ExplicitAttribute are now reported as skipped.
530 |
531 | Engine
532 |
533 | * We now use Cecil to examine assemblies prior to loading them.
534 | * Extensions are no longer based on Mono.Addins but use our own extension framework.
535 |
536 | Issues Resolved
537 |
538 | * 125 3rd-party dependencies should be downloaded on demand
539 | * 283 What should we do when a user extension does something bad?
540 | * 585 RetryAttribute
541 | * 642 Restructure MSBuild script
542 | * 649 Change how we zip packages
543 | * 654 ReflectionOnlyLoad and ReflectionOnlyLoadFrom
544 | * 664 Invalid "id" attribute in the report for case "test started"
545 | * 685 In the some cases when tests cannot be started NUnit returns exit code "0"
546 | * 728 Missing Assert.That overload
547 | * 741 Explicit Tests get run when using --exclude
548 | * 746 Framework should send events for all tests
549 | * 747 NUnit should apply attributes even if test is non-runnable
550 | * 749 Review Use of Mono.Addins for Engine Extensibility
551 | * 750 Include Explicit Tests in Test Results
552 | * 753 Feature request: Is.SupersetOf() assertion constraint
553 | * 755 TimeOut attribute doesn't work with TestCaseSource Attribute
554 | * 757 Implement some way to wait for execution to complete in ITestEngineRunner
555 | * 760 Packaging targets do not run on Linux
556 | * 766 Added overloads for True()/False() accepting booleans
557 | * 778 Build and build.cmd scripts invoke nuget.exe improperly
558 | * 780 Teamcity fix
559 | * 782 No sources for 2.6.4
560 |
561 | NUnit 3.0.0 Beta 3 - July 15, 2015
562 |
563 | Framework
564 |
565 | * The RangeAttribute has been extended to support more data types including
566 | uint, long and ulong
567 | * Added platform support for Windows 10 and fixed issues with Windows 8 and
568 | 8.1 support
569 | * Added async support to the portable version of NUnit Framework
570 | * The named members of the TestCaseSource and ValueSource attributes must now be
571 | static.
572 | * RandomAttribute has been extended to add support for new data types including
573 | uint, long, ulong, short, ushort, float, byte and sbyte
574 | * TestContext.Random has also been extended to add support for new data types including
575 | uint, long, ulong, short, ushort, float, byte, sbyte and decimal
576 | * Removed the dependency on Microsoft.Bcl.Async from the NUnit Framework assembly
577 | targeting .NET 4.0. If you want to write async tests in .NET 4.0, you will need
578 | to reference the NuGet package yourself.
579 | * Added a new TestFixtureSource attribute which is the equivalent to TestCaseSource
580 | but provides for instantiation of fixtures.
581 | * Significant improvements have been made in how NUnit deduces the type arguments of
582 | generic methods based on the arguments provided.
583 |
584 | Engine
585 |
586 | * If the target framework is not specified, test assemblies that are compiled
587 | to target .NET 4.5 will no longer run in .NET 4.0 compatibility mode
588 |
589 | Console
590 |
591 | * If the console is run without arguments, it will now display help
592 |
593 | Issues Resolved
594 |
595 | * 47 Extensions to RangeAttribute
596 | * 237 System.Uri .ctor works not properly under Nunit
597 | * 244 NUnit should properly distinguish between .NET 4.0 and 4.5
598 | * 310 Target framework not specified on the AppDomain when running against .Net 4.5
599 | * 321 Rationalize how we count tests
600 | * 472 Overflow exception and DivideByZero exception from the RangeAttribute
601 | * 524 int and char do not compare correctly?
602 | * 539 Truncation of string arguments
603 | * 544 AsyncTestMethodTests for 4.5 Framework fails frequently on Travis CI
604 | * 656 Unused parameter in Console.WriteLine found
605 | * 670 Failing Tests in TeamCity Build
606 | * 673 Ensure proper disposal of engine objects
607 | * 674 Engine does not release test assemblies
608 | * 679 Windows 10 Support
609 | * 682 Add Async Support to Portable Framework
610 | * 683 Make FrameworkController available in portable build
611 | * 687 TestAgency does not launch agent process correctly if runtime type is not specified (i.e. v4.0)
612 | * 692 PlatformAttribute_OperatingSystemBitNess fails when running in 32-bit process
613 | * 693 Generic Test Method cannot determine type arguments for fixture when passed as IEnumerable
614 | * 698 Require TestCaseSource and ValueSource named members to be static
615 | * 703 TeamCity non-equal flowid for 'testStarted' and 'testFinished' messages
616 | * 712 Extensions to RandomAttribute
617 | * 715 Provide a data source attribute at TestFixture Level
618 | * 718 RangeConstraint gives error with from and two args of differing types
619 | * 723 Does nunit.nuspec require dependency on Microsoft.Bcl.Async?
620 | * 724 Adds support for Nullable to Assert.IsTrue and Assert.IsFalse
621 | * 734 Console without parameters doesn't show help
622 |
623 | NUnit 3.0.0 Beta 2 - May 12, 2015
624 |
625 | Framework
626 |
627 | * The Compact Framework version of the framework is now packaged separately
628 | and will be distributed as a ZIP file and as a NuGet package.
629 | * The NUnit 2.x RepeatAttribute was added back into the framework.
630 | * Added Throws.ArgumentNullException
631 | * Added GetString methods to NUnit.Framework.Internal.RandomGenerator to
632 | create repeatable random strings for testing
633 | * When checking the equality of DateTimeOffset, you can now use the
634 | WithSameOffset modifier
635 | * Some classes intended for internal usage that were public for testing
636 | have now been made internal. Additional classes will be made internal
637 | for the final 3.0 release.
638 |
639 | Engine
640 |
641 | * Added a core engine which is a non-extensible, minimal engine for use by
642 | devices and similar situations where reduced functionality is compensated
643 | for by reduced size and simplicity of usage. See
644 | https://github.com/nunit/dev/wiki/Core-Engine for more information.
645 |
646 | Issues Resolved
647 |
648 | * 22 Add OSArchitecture Attribute to Environment node in result xml
649 | * 24 Assert on Dictionary Content
650 | * 48 Explicit seems to conflict with Ignore
651 | * 168 Create NUnit 3.0 documentation
652 | * 196 Compare DateTimeOffsets including the offset in the comparison
653 | * 217 New icon for the 3.0 release
654 | * 316 NUnitLite TextUI Runner
655 | * 320 No Tests found: Using parametrized Fixture and TestCaseSource
656 | * 360 Better exception message when using non-BCL class in property
657 | * 454 Rare registry configurations may cause NUnit to fail
658 | * 478 RepeatAttribute
659 | * 481 Testing multiple assemblies in nunitlite
660 | * 538 Potential bug using TestContext in constructors
661 | * 546 Enable Parallel in NUnitLite/CF (or more) builds
662 | * 551 TextRunner not passing the NumWorkers option to the ITestAssemblyRunner
663 | * 556 Executed tests should always return a non-zero duration
664 | * 559 Fix text of NuGet packages
665 | * 560 Fix PackageVersion property on wix install projects
666 | * 562 Program.cs in NUnitLite NuGet package is incorrect
667 | * 564 NUnitLite Nuget package is Beta 1a, Framework is Beta 1
668 | * 565 NUnitLite Nuget package adds Program.cs to a VB Project
669 | * 568 Isolate packaging from building
670 | * 570 ThrowsConstraint failure message should include stack trace of actual exception
671 | * 576 Throws.ArgumentNullException would be nice
672 | * 577 Documentation on some members of Throws falsely claims that they return `TargetInvocationException` constraints
673 | * 579 No documentation for recommended usage of TestCaseSourceAttribute
674 | * 580 TeamCity Service Message Uses Incorrect Test Name with NUnit2Driver
675 | * 582 Test Ids Are Not Unique
676 | * 583 TeamCity service messages to support parallel test execution
677 | * 584 Non-runnable assembly has incorrect ResultState
678 | * 609 Add support for integration with TeamCity
679 | * 611 Remove unused --teamcity option from CF build of NUnitLite
680 | * 612 MaxTime doesn't work when used for TestCase
681 | * 621 Core Engine
682 | * 622 nunit-console fails when use --output
683 | * 628 Modify IService interface and simplify ServiceContext
684 | * 631 Separate packaging for the compact framework
685 | * 646 ConfigurationManager.AppSettings Params Return Null under Beta 1
686 | * 648 Passing 2 or more test assemblies targeting > .NET 2.0 to nunit-console fails
687 |
688 | NUnit 3.0.0 Beta 1 - March 25, 2015
689 |
690 | General
691 |
692 | * There is now a master windows installer for the framework, engine and console runner.
693 |
694 | Framework
695 |
696 | * We no longer create a separate framework build for .NET 3.5. The 2.0 and
697 | 3.5 builds were essentially the same, so the former should now be used
698 | under both runtimes.
699 | * A new Constraint, DictionaryContainsKeyConstraint, may be used to test
700 | that a specified key is present in a dictionary.
701 | * LevelOfParallelizationAttribute has been renamed to LevelOfParallelismAttribute.
702 | * The Silverlight runner now displays output in color and includes any
703 | text output created by the tests.
704 | * The class and method names of each test are included in the output xml
705 | where applicable.
706 | * String arguments used in test case names are now truncated to 40 rather
707 | than 20 characters.
708 |
709 | Engine
710 |
711 | * The engine API has now been finalized. It permits specifying a minimum
712 | version of the engine that a runner is able to use. The best installed
713 | version of the engine will be loaded. Third-party runners may override
714 | the selection process by including a copy of the engine in their
715 | installation directory and specifying that it must be used.
716 | * The V2 framework driver now uses the event listener and test listener
717 | passed to it by the runner. This corrects several outstanding issues
718 | caused by events not being received and allows selecting V2 tests to
719 | be run from the command-line, in the same way that V3 tests are selected.
720 |
721 | Console
722 |
723 | * The console now defaults to not using shadowcopy. There is a new option
724 | --shadowcopy to turn it on if needed.
725 |
726 | Issues Resolved
727 |
728 | * 224 Silverlight Support
729 | * 318 TestActionAttribute: Retrieving the TestFixture
730 | * 428 Add ExpectedExceptionAttribute to C# samples
731 | * 440 Automatic selection of Test Engine to use
732 | * 450 Create master install that includes the framework, engine and console installs
733 | * 477 Assert does not work with ArraySegment
734 | * 482 nunit-console has multiple errors related to -framework option
735 | * 483 Adds constraint for asserting that a dictionary contains a particular key
736 | * 484 Missing file in NUnit.Console nuget package
737 | * 485 Can't run v2 tests with nunit-console 3.0
738 | * 487 NUnitLite can't load assemblies by their file name
739 | * 488 Async setup and teardown still don't work
740 | * 497 Framework installer shold register the portable framework
741 | * 504 Option --workers:0 is ignored
742 | * 508 Travis builds with failure in engine tests show as successful
743 | * 509 Under linux, not all mono profiles are listed as available
744 | * 512 Drop the .NET 3.5 build
745 | * 517 V2 FrameworkDriver does not make use of passed in TestEventListener
746 | * 523 Provide an option to disable shadowcopy in NUnit v3
747 | * 528 V2 FrameworkDriver does not make use of passed in TestFilter
748 | * 530 Color display for Silverlight runner
749 | * 531 Display text output from tests in Silverlight runner
750 | * 534 Add classname and methodname to test result xml
751 | * 541 Console help doesn't indicate defaults
752 |
753 | NUnit 3.0.0 Alpha 5 - January 30, 2015
754 |
755 | General
756 |
757 | * A Windows installer is now included in the release packages.
758 |
759 | Framework
760 |
761 | * TestCaseAttribute now allows arguments with default values to be omitted. Additionaly, it accepts a Platform property to specify the platforms on which the test case should be run.
762 | * TestFixture and TestCase attributes now enforce the requirement that a reason needs to be provided when ignoring a test.
763 | * SetUp, TearDown, OneTimeSetUp and OneTimeTearDown methods may now be async.
764 | * String arguments over 20 characters in length are truncated when used as part of a test name.
765 |
766 | Engine
767 |
768 | * The engine is now extensible using Mono.Addins. In this release, extension points are provided for FrameworkDrivers, ProjectLoaders and OutputWriters. The following addins are bundled as a part of NUnit:
769 | * A FrameworkDriver that allows running NUnit V2 tests under NUnit 3.0.
770 | * ProjectLoaders for NUnit and Visual Studio projects.
771 | * An OutputWriter that creates XML output in NUnit V2 format.
772 | * DomainUsage now defaults to Multiple if not specified by the runner
773 |
774 | Console
775 |
776 | * New options supported:
777 | * --testlist provides a list of tests to run in a file
778 | * --stoponerror indicates that the run should terminate when any test fails.
779 |
780 | Issues Resolved
781 |
782 | * 20 TestCaseAttribute needs Platform property.
783 | * 60 NUnit should support async setup, teardown, fixture setup and fixture teardown.
784 | * 257 TestCaseAttribute should not require parameters with default values to be specified.
785 | * 266 Pluggable framework drivers.
786 | * 368 Create addin model.
787 | * 369 Project loader addins
788 | * 370 OutputWriter addins
789 | * 403 Move ConsoleOptions.cs and Options.cs to Common and share...
790 | * 419 Create Windows Installer for NUnit.
791 | * 427 [TestFixture(Ignore=true)] should not be allowed.
792 | * 437 Errors in tests under Linux due to hard-coded paths.
793 | * 441 NUnit-Console should support --testlist option
794 | * 442 Add --stoponerror option back to nunit-console.
795 | * 456 Fix memory leak in RuntimeFramework.
796 | * 459 Remove the Mixed Platforms build configuration.
797 | * 468 Change default domain usage to multiple.
798 | * 469 Truncate string arguments in test names in order to limit the length.
799 |
800 | NUnit 3.0.0 Alpha 4 - December 30, 2014
801 |
802 | Framework
803 |
804 | * ApartmentAttribute has been added, replacing STAAttribute and MTAAttribute.
805 | * Unnecessary overloads of Assert.That and Assume.That have been removed.
806 | * Multiple SetUpFixtures may be specified in a single namespace.
807 | * Improvements to the Pairwise strategy test case generation algorithm.
808 | * The new NUnitLite runner --testlist option, allows a list of tests to be kept in a file.
809 |
810 | Engine
811 |
812 | * A driver is now included, which allows running NUnit 2.x tests under NUnit 3.0.
813 | * The engine can now load and run tests specified in a number of project formats:
814 | * NUnit (.nunit)
815 | * Visual Studio C# projects (.csproj)
816 | * Visual Studio F# projects (.vjsproj)
817 | * Visual Studio Visual Basic projects (.vbproj)
818 | * Visual Studio solutions (.sln)
819 | * Legacy C++ and Visual JScript projects (.csproj and .vjsproj) are also supported
820 | * Support for the current C++ format (.csxproj) is not yet available
821 | * Creation of output files like TestResult.xml in various formats is now a
822 | service of the engine, available to any runner.
823 |
824 | Console
825 |
826 | * The command-line may now include any number of assemblies and/or supported projects.
827 |
828 | Issues Resolved
829 |
830 | * 37 Multiple SetUpFixtures should be permitted on same namespace
831 | * 210 TestContext.WriteLine in an AppDomain causes an error
832 | * 227 Add support for VS projects and solutions
833 | * 231 Update C# samples to use NUnit 3.0
834 | * 233 Update F# samples to use NUnit 3.0
835 | * 234 Update C++ samples to use NUnit 3.0
836 | * 265 Reorganize console reports for nunit-console and nunitlite
837 | * 299 No full path to assembly in XML file under Compact Framework
838 | * 301 Command-line length
839 | * 363 Make Xml result output an engine service
840 | * 377 CombiningStrategyAttributes don't work correctly on generic methods
841 | * 388 Improvements to NUnitLite runner output
842 | * 390 Specify exactly what happens when a test times out
843 | * 396 ApartmentAttribute
844 | * 397 CF nunitlite runner assembly has the wrong name
845 | * 407 Assert.Pass() with ]]> in message crashes console runner
846 | * 414 Simplify Assert overloads
847 | * 416 NUnit 2.x Framework Driver
848 | * 417 Complete work on NUnit projects
849 | * 420 Create Settings file in proper location
850 |
851 | NUnit 3.0.0 Alpha 3 - November 29, 2014
852 |
853 | Breaking Changes
854 |
855 | * NUnitLite tests must reference both the nunit.framework and nunitlite assemblies.
856 |
857 | Framework
858 |
859 | * The NUnit and NUnitLite frameworks have now been merged. There is no longer any distinction
860 | between them in terms of features, although some features are not available on all platforms.
861 | * The release includes two new framework builds: compact framework 3.5 and portable. The portable
862 | library is compatible with .NET 4.5, Silverlight 5.0, Windows 8, Windows Phone 8.1,
863 | Windows Phone Silverlight 8, Mono for Android and MonoTouch.
864 | * A number of previously unsupported features are available for the Compact Framework:
865 | - Generic methods as tests
866 | - RegexConstraint
867 | - TimeoutAttribute
868 | - FileAssert, DirectoryAssert and file-related constraints
869 |
870 | Engine
871 |
872 | * The logic of runtime selection has now changed so that each assembly runs by default
873 | in a separate process using the runtime for which it was built.
874 | * On 64-bit systems, each test process is automatically created as 32-bit or 64-bit,
875 | depending on the platform specified for the test assembly.
876 |
877 | Console
878 |
879 | * The console runner now runs tests in a separate process per assembly by default. They may
880 | still be run in process or in a single separate process by use of command-line options.
881 | * The console runner now starts in the highest version of the .NET runtime available, making
882 | it simpler to debug tests by specifying that they should run in-process on the command-line.
883 | * The -x86 command-line option is provided to force execution in a 32-bit process on a 64-bit system.
884 | * A writeability check is performed for each output result file before trying to run the tests.
885 | * The -teamcity option is now supported.
886 |
887 | Issues Resolved
888 |
889 | * 12 Compact framework should support generic methods
890 | * 145 NUnit-console fails if test result message contains invalid xml characters
891 | * 155 Create utility classes for platform-specific code
892 | * 223 Common code for NUnitLite console runner and NUnit-Console
893 | * 225 Compact Framework Support
894 | * 238 Improvements to running 32 bit tests on a 64 bit system
895 | * 261 Add portable nunitlite build
896 | * 284 NUnitLite Unification
897 | * 293 CF does not have a CurrentDirectory
898 | * 306 Assure NUnit can write resultfile
899 | * 308 Early disposal of runners
900 | * 309 NUnit-Console should support incremental output under TeamCity
901 | * 325 Add RegexConstraint to compact framework build
902 | * 326 Add TimeoutAttribute to compact framework build
903 | * 327 Allow generic test methods in the compact framework
904 | * 328 Use .NET Stopwatch class for compact framework builds
905 | * 331 Alpha 2 CF does not build
906 | * 333 Add parallel execution to desktop builds of NUnitLite
907 | * 334 Include File-related constraints and syntax in NUnitLite builds
908 | * 335 Re-introduce 'Classic' NUnit syntax in NUnitLite
909 | * 336 Document use of separate obj directories per build in our projects
910 | * 337 Update Standard Defines page for .NET 3.0
911 | * 341 Move the NUnitLite runners to separate assemblies
912 | * 367 Refactor XML Escaping Tests
913 | * 372 CF Build TestAssemblyRunnerTests
914 | * 373 Minor CF Test Fixes
915 | * 378 Correct documentation for PairwiseAttribute
916 | * 386 Console Output Improvements
917 |
918 | NUnit 3.0.0 Alpha 2 - November 2, 2014
919 |
920 | Breaking Changes
921 |
922 | * The console runner no longer displays test results in the debugger.
923 | * The NUnitLite compact framework 2.0 build has been removed.
924 | * All addin support has been removed from the framework. Documentation of NUnit 3.0 extensibility features will be published in time for the beta release. In the interim, please ask for support on the nunit-discuss list.
925 |
926 | General
927 |
928 | * A separate solution has been created for Linux
929 | * We now have continuous integration builds under both Travis and Appveyor
930 | * The compact framework 3.5 build is now working and will be supported in future releases.
931 |
932 | New Features
933 |
934 | * The console runner now automatically detects 32- versus 64-bit test assemblies.
935 | * The NUnitLite report output has been standardized to match that of nunit-console.
936 | * The NUnitLite command-line has been standardized to match that of nunit-console where they share the same options.
937 | * Both nunit-console and NUnitLite now display output in color.
938 | * ActionAttributes now allow specification of multiple targets on the attribute as designed. This didn't work in the first alpha.
939 | * OneTimeSetUp and OneTimeTearDown failures are now shown on the test report. Individual test failures after OneTimeSetUp failure are no longer shown.
940 | * The console runner refuses to run tests build with older versions of NUnit. A plugin will be available to run older tests in the future.
941 |
942 | Issues Resolved
943 |
944 | * 222 Color console for NUnitLite
945 | * 229 Timing failures in tests
946 | * 241 Remove reference to Microslft BCL packages
947 | * 243 Create solution for Linux
948 | * 245 Multiple targets on action attributes not implemented
949 | * 246 C++ tests do not compile in VS2013
950 | * 247 Eliminate trace display when running tests in debug
951 | * 255 Add new result states for more precision in where failures occur
952 | * 256 ContainsConstraint break when used with AndConstraint
953 | * 264 Stacktrace displays too many entries
954 | * 269 Add manifest to nunit-console and nunit-agent
955 | * 270 OneTimeSetUp failure results in too much output
956 | * 271 Invalid tests should be treated as errors
957 | * 274 Command line options should be case insensitive
958 | * 276 NUnit-console should not reference nunit.framework
959 | * 278 New result states (ChildFailure and SetupFailure) break NUnit2XmlOutputWriter
960 | * 282 Get tests for NUnit2XmlOutputWriter working
961 | * 288 Set up Appveyor CI build
962 | * 290 Stack trace still displays too many items
963 | * 315 NUnit 3.0 alpha: Cannot run in console on my assembly
964 | * 319 CI builds are not treating test failures as failures of the build
965 | * 322 Remove Stopwatch tests where they test the real .NET Stopwatch
966 |
967 | NUnit 3.0.0 Alpha 1 - September 22, 2014
968 |
969 | Breaking Changes
970 |
971 | * Legacy suites are no longer supported
972 | * Assert.NullOrEmpty is no longer supported (Use Is.Null.Or.Empty)
973 |
974 | General
975 |
976 | * MsBuild is now used for the build rather than NAnt
977 | * The framework test harness has been removed now that nunit-console is at a point where it can run the tests.
978 |
979 | New Features
980 |
981 | * Action Attributes have been added with the same features as in NUnit 2.6.3.
982 | * TestContext now has a method that allows writing to the XML output.
983 | * TestContext.CurrentContext.Result now provides the error message and stack trace during teardown.
984 | * Does prefix operator supplies several added constraints.
985 |
986 | Issues Resolved
987 |
988 | * 6 Log4net not working with NUnit
989 | * 13 Standardize commandline options for nunitlite runner
990 | * 17 No allowance is currently made for nullable arguents in TestCase parameter conversions
991 | * 33 TestCaseSource cannot refer to a parameterized test fixture
992 | * 54 Store message and stack trace in TestContext for use in TearDown
993 | * 111 Implement Changes to File, Directory and Path Assertions
994 | * 112 Implement Action Attributes
995 | * 156 Accessing multiple AppDomains within unit tests result in SerializationException
996 | * 163 Add --trace option to NUnitLite
997 | * 167 Create interim documentation for the alpha release
998 | * 169 Design and implement distribution of NUnit packages
999 | * 171 Assert.That should work with any lambda returning bool
1000 | * 175 Test Harness should return an error if any tests fail
1001 | * 180 Errors in Linux CI build
1002 | * 181 Replace NAnt with MsBuild / XBuild
1003 | * 183 Standardize commandline options for test harness
1004 | * 188 No output from NUnitLite when selected test is not found
1005 | * 189 Add string operators to Does prefix
1006 | * 193 TestWorkerTests.BusyExecutedIdleEventsCalledInSequence fails occasionally
1007 | * 197 Deprecate or remove Assert.NullOrEmpty
1008 | * 202 Eliminate legacy suites
1009 | * 203 Combine framework, engine and console runner in a single solution and repository
1010 | * 209 Make Ignore attribute's reason mandatory
1011 | * 215 Running 32-bit tests on a 64-bit OS
1012 | * 219 Teardown failures are not reported
1013 |
1014 | Console Issues Resolved (Old nunit-console project, now combined with nunit)
1015 |
1016 | * 2 Failure in TestFixtureSetUp is not reported correctly
1017 | * 5 CI Server for nunit-console
1018 | * 6 System.NullReferenceException on start nunit-console-x86
1019 | * 21 NUnitFrameworkDriverTests fail if not run from same directory
1020 | * 24 'Debug' value for /trace option is deprecated in 2.6.3
1021 | * 38 Confusing Excluded categories output
1022 |
1023 | NUnit 2.9.7 - August 8, 2014
1024 |
1025 | Breaking Changes
1026 |
1027 | * NUnit no longer supports void async test methods. You should use a Task return Type instead.
1028 | * The ExpectedExceptionAttribute is no longer supported. Use Assert.Throws() or Assert.That(..., Throws) instead for a more precise specification of where the exception is expected to be thrown.
1029 |
1030 | New Features
1031 |
1032 | * Parallel test execution is supported down to the Fixture level. Use ParallelizableAttribute to indicate types that may be run in parallel.
1033 | * Async tests are supported for .NET 4.0 if the user has installed support for them.
1034 | * A new FileExistsConstraint has been added along with FileAssert.Exists and FileAssert.DoesNotExist
1035 | * ExpectedResult is now supported on simple (non-TestCase) tests.
1036 | * The Ignore attribute now takes a named parameter Until, which allows specifying a date after which the test is no longer ignored.
1037 | * The following new values are now recognized by PlatformAttribute: Win7, Win8, Win8.1, Win2012Server, Win2012ServerR2, NT6.1, NT6.2, 32-bit, 64-bit
1038 | * TimeoutAttribute is now supported under Silverlight
1039 | * ValuesAttribute may be used without any values on an enum or boolean argument. All possible values are used.
1040 | * You may now specify a tolerance using Within when testing equality of DateTimeOffset values.
1041 | * The XML output now includes a start and end time for each test.
1042 |
1043 | Issues Resolved
1044 |
1045 | * 8 [SetUpFixture] is not working as expected
1046 | * 14 CI Server for NUnit Framework
1047 | * 21 Is.InRange Constraint Ambiguity
1048 | * 27 Values attribute support for enum types
1049 | * 29 Specifying a tolerance with "Within" doesn't work for DateTimeOffset data types
1050 | * 31 Report start and end time of test execution
1051 | * 36 Make RequiresThread, RequiresSTA, RequiresMTA inheritable
1052 | * 45 Need of Enddate together with Ignore
1053 | * 55 Incorrect XML comments for CollectionAssert.IsSubsetOf
1054 | * 62 Matches(Constraint) does not work as expected
1055 | * 63 Async support should handle Task return type without state machine
1056 | * 64 AsyncStateMachineAttribute should only be checked by name
1057 | * 65 Update NUnit Wiki to show the new location of samples
1058 | * 66 Parallel Test Execution within test assemblies
1059 | * 67 Allow Expected Result on simple tests
1060 | * 70 EquivalentTo isn't compatible with IgnoreCase for dictioneries
1061 | * 75 Async tests should be supported for projects that target .NET 4.0
1062 | * 82 nunit-framework tests are timing out on Linux
1063 | * 83 Path-related tests fail on Linux
1064 | * 85 Culture-dependent NUnit tests fail on non-English machine
1065 | * 88 TestCaseSourceAttribute documentation
1066 | * 90 EquivalentTo isn't compatible with IgnoreCase for char
1067 | * 100 Changes to Tolerance definitions
1068 | * 110 Add new platforms to PlatformAttribute
1069 | * 113 Remove ExpectedException
1070 | * 118 Workarounds for missing InternalPreserveStackTrace in mono
1071 | * 121 Test harness does not honor the --worker option when set to zero
1072 | * 129 Standardize Timeout in the Silverlight build
1073 | * 130 Add FileAssert.Exists and FileAssert.DoesNotExist
1074 | * 132 Drop support for void async methods
1075 | * 153 Surprising behavior of DelayedConstraint pollingInterval
1076 | * 161 Update API to support stopping an ongoing test run
1077 |
1078 | NOTE: Bug Fixes below this point refer to the number of the bug in Launchpad.
1079 |
1080 | NUnit 2.9.6 - October 4, 2013
1081 |
1082 | Main Features
1083 |
1084 | * Separate projects for nunit-console and nunit.engine
1085 | * New builds for .NET 4.5 and Silverlight
1086 | * TestContext is now supported
1087 | * External API is now stable; internal interfaces are separate from API
1088 | * Tests may be run in parallel on separate threads
1089 | * Solutions and projects now use VS2012 (except for Compact framework)
1090 |
1091 | Bug Fixes
1092 |
1093 | * 463470 We should encapsulate references to pre-2.0 collections
1094 | * 498690 Assert.That() doesn't like properties with scoped setters
1095 | * 501784 Theory tests do not work correctly when using null parameters
1096 | * 531873 Feature: Extraction of unit tests from NUnit test assembly and calling appropriate one
1097 | * 611325 Allow Teardown to detect if last test failed
1098 | * 611938 Generic Test Instances disappear
1099 | * 655882 Make CategoryAttribute inherited
1100 | * 664081 Add Server2008 R2 and Windows 7 to PlatformAttribute
1101 | * 671432 Upgrade NAnt to Latest Release
1102 | * 676560 Assert.AreEqual does not support IEquatable
1103 | * 691129 Add Category parameter to TestFixture
1104 | * 697069 Feature request: dynamic location for TestResult.xml
1105 | * 708173 NUnit's logic for comparing arrays - use Comparer if it is provided
1106 | * 709062 "System.ArgumentException : Cannot compare" when the element is a list
1107 | * 712156 Tests cannot use AppDomain.SetPrincipalPolicy
1108 | * 719184 Platformdependency in src/ClientUtilities/util/Services/DomainManager.cs:40
1109 | * 719187 Using Path.GetTempPath() causes conflicts in shared temporary folders
1110 | * 735851 Add detection of 3.0, 3.5 and 4.0 frameworks to PlatformAttribute
1111 | * 736062 Deadlock when EventListener performs a Trace call + EventPump synchronisation
1112 | * 756843 Failing assertion does not show non-linear tolerance mode
1113 | * 766749 net-2.0\nunit-console-x86.exe.config should have a element and also enable loadFromRemoteSources
1114 | * 770471 Assert.IsEmpty does not support IEnumerable
1115 | * 785460 Add Category parameter to TestCaseSourceAttribute
1116 | * 787106 EqualConstraint provides inadequate failure information for IEnumerables
1117 | * 792466 TestContext MethodName
1118 | * 794115 HashSet incorrectly reported
1119 | * 800089 Assert.Throws() hides details of inner AssertionException
1120 | * 848713 Feature request: Add switch for console to break on any test case error
1121 | * 878376 Add 'Exactly(n)' to the NUnit constraint syntax
1122 | * 882137 When no tests are run, higher level suites display as Inconclusive
1123 | * 882517 NUnit 2.5.10 doesn't recognize TestFixture if there are only TestCaseSource inside
1124 | * 885173 Tests are still executed after cancellation by user
1125 | * 885277 Exception when project calls for a runtime using only 2 digits
1126 | * 885604 Feature request: Explicit named parameter to TestCaseAttribute
1127 | * 890129 DelayedConstraint doesn't appear to poll properties of objects
1128 | * 892844 Not using Mono 4.0 profile under Windows
1129 | * 893919 DelayedConstraint fails polling properties on references which are initially null
1130 | * 896973 Console output lines are run together under Linux
1131 | * 897289 Is.Empty constraint has unclear failure message
1132 | * 898192 Feature Request: Is.Negative, Is.Positive
1133 | * 898256 IEnumerable for Datapoints doesn't work
1134 | * 899178 Wrong failure message for parameterized tests that expect exceptions
1135 | * 904841 After exiting for timeout the teardown method is not executed
1136 | * 908829 TestCase attribute does not play well with variadic test functions
1137 | * 910218 NUnit should add a trailing separator to the ApplicationBase
1138 | * 920472 CollectionAssert.IsNotEmpty must dispose Enumerator
1139 | * 922455 Add Support for Windows 8 and Windows 2012 Server to PlatformAttribute
1140 | * 928246 Use assembly.Location instead of assembly.CodeBase
1141 | * 958766 For development work under TeamCity, we need to support nunit2 formatted output under direct-runner
1142 | * 1000181 Parameterized TestFixture with System.Type as constructor arguments fails
1143 | * 1000213 Inconclusive message Not in report output
1144 | * 1023084 Add Enum support to RandomAttribute
1145 | * 1028188 Add Support for Silverlight
1146 | * 1029785 Test loaded from remote folder failed to run with exception System.IODirectory
1147 | * 1037144 Add MonoTouch support to PlatformAttribute
1148 | * 1041365 Add MaxOsX and Xbox support to platform attribute
1149 | * 1057981 C#5 async tests are not supported
1150 | * 1060631 Add .NET 4.5 build
1151 | * 1064014 Simple async tests should not return Task
1152 | * 1071164 Support async methods in usage scenarios of Throws constraints
1153 | * 1071343 Runner.Load fails on CF if the test assembly contains a generic method
1154 | * 1071861 Error in Path Constraints
1155 | * 1072379 Report test execution time at a higher resolution
1156 | * 1074568 Assert/Assume should support an async method for the ActualValueDelegate
1157 | * 1082330 Better Exception if SetCulture attribute is applied multiple times
1158 | * 1111834 Expose Random Object as part of the test context
1159 | * 1111838 Include Random Seed in Test Report
1160 | * 1172979 Add Category Support to nunitlite Runner
1161 | * 1203361 Randomizer uniqueness tests sometimes fail
1162 | * 1221712 When non-existing test method is specified in -test, result is still "Tests run: 1, Passed: 1"
1163 | * 1223294 System.NullReferenceException thrown when ExpectedExceptionAttribute is used in a static class
1164 | * 1225542 Standardize commandline options for test harness
1165 |
1166 | Bug Fixes in 2.9.6 But Not Listed Here in the Release
1167 |
1168 | * 541699 Silverlight Support
1169 | * 1222148 /framework switch does not recognize net-4.5
1170 | * 1228979 Theories with all test cases inconclusive are not reported as failures
1171 |
1172 |
1173 | NUnit 2.9.5 - July 30, 2010
1174 |
1175 | Bug Fixes
1176 |
1177 | * 483836 Allow non-public test fixtures consistently
1178 | * 487878 Tests in generic class without proper TestFixture attribute should be invalid
1179 | * 498656 TestCase should show array values in GUI
1180 | * 513989 Is.Empty should work for directories
1181 | * 519912 Thread.CurrentPrincipal Set In TestFixtureSetUp Not Maintained Between Tests
1182 | * 532488 constraints from ConstraintExpression/ConstraintBuilder are not reusable
1183 | * 590717 categorie contains dash or trail spaces is not selectable
1184 | * 590970 static TestFixtureSetUp/TestFixtureTearDown methods in base classes are not run
1185 | * 595683 NUnit console runner fails to load assemblies
1186 | * 600627 Assertion message formatted poorly by PropertyConstraint
1187 | * 601108 Duplicate test using abstract test fixtures
1188 | * 601645 Parametered test should try to convert data type from source to parameter
1189 | * 605432 ToString not working properly for some properties
1190 | * 606548 Deprecate Directory Assert in 2.5 and remove it in 3.0
1191 | * 608875 NUnit Equality Comparer incorrectly defines equality for Dictionary objects
1192 |
1193 | NUnit 2.9.4 - May 4, 2010
1194 |
1195 | Bug Fixes
1196 |
1197 | * 419411 Fixture With No Tests Shows as Non-Runnable
1198 | * 459219 Changes to thread princpal cause failures under .NET 4.0
1199 | * 459224 Culture test failure under .NET 4.0
1200 | * 462019 Line endings needs to be better controlled in source
1201 | * 462418 Assume.That() fails if I specify a message
1202 | * 483845 TestCase expected return value cannot be null
1203 | * 488002 Should not report tests in abstract class as invalid
1204 | * 490679 Category in TestCaseData clashes with Category on ParameterizedMethodSuite
1205 | * 501352 VS2010 projects have not been updated for new directory structure
1206 | * 504018 Automatic Values For Theory Test Parameters Not Provided For bool And enum
1207 | * 505899 'Description' parameter in both TestAttribute and TestCaseAttribute is not allowed
1208 | * 523335 TestFixtureTearDown in static class not executed
1209 | * 556971 Datapoint(s)Attribute should work on IEnumerable as well as on Arrays
1210 | * 561436 SetCulture broken with 2.5.4
1211 | * 563532 DatapointsAttribute should be allowed on properties and methods
1212 |
1213 | NUnit 2.9.3 - October 26, 2009
1214 |
1215 | Main Features
1216 |
1217 | * Created new API for controlling framework
1218 | * New builds for .Net 3.5 and 4.0, compact framework 3.5
1219 | * Support for old style tests has been removed
1220 | * New adhoc runner for testing the framework
1221 |
1222 | Bug Fixes
1223 |
1224 | * 432805 Some Framework Tests don't run on Linux
1225 | * 440109 Full Framework does not support "Contains"
1226 |
1227 | NUnit 2.9.2 - September 19, 2009
1228 |
1229 | Main Features
1230 |
1231 | * NUnitLite code is now merged with NUnit
1232 | * Added NUnitLite runner to the framework code
1233 | * Added Compact framework builds
1234 |
1235 | Bug Fixes
1236 |
1237 | * 430100 Assert.Catch should return T
1238 | * 432566 NUnitLite shows empty string as argument
1239 | * 432573 Mono test should be at runtime
1240 |
1241 | NUnit 2.9.1 - August 27, 2009
1242 |
1243 | General
1244 |
1245 | * Created a separate project for the framework and framework tests
1246 | * Changed license to MIT / X11
1247 | * Created Windows installer for the framework
1248 |
1249 | Bug Fixes
1250 |
1251 | * 400502 NUnitEqualityComparer.StreamsEqual fails for same stream
1252 | * 400508 TestCaseSource attirbute is not working when Type is given
1253 | * 400510 TestCaseData variable length ctor drops values
1254 | * 417557 Add SetUICultureAttribute from NUnit 2.5.2
1255 | * 417559 Add Ignore to TestFixture, TestCase and TestCaseData
1256 | * 417560 Merge Assert.Throws and Assert.Catch changes from NUnit 2.5.2
1257 | * 417564 TimeoutAttribute on Assembly
1258 |
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2017 Charlie Poole
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/NOTICES.txt:
--------------------------------------------------------------------------------
1 | NUnit 3.0 is based on earlier versions of NUnit, with Portions
2 |
3 | Copyright (c) 2002-2014 Charlie Poole or
4 | Copyright (c) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or
5 | Copyright (c) 2000-2002 Philip A. Craig
6 |
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/NUnit.3.6.1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/NUnit.3.6.1.nupkg
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/MonoAndroid/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/MonoAndroid/nunit.framework.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/Xamarin.iOS10/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/Xamarin.iOS10/nunit.framework.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/net20/NUnit.System.Linq.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/net20/NUnit.System.Linq.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/net20/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/net20/nunit.framework.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/net35/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/net35/nunit.framework.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/net40/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/net40/nunit.framework.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/net45/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/net45/nunit.framework.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/netstandard1.6/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/netstandard1.6/nunit.framework.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit.3.6.1/lib/portable-net45+win8+wp8+wpa81/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit.3.6.1/lib/portable-net45+win8+wp8+wpa81/nunit.framework.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015-2016 Charlie Poole
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/NUnit3TestAdapter.3.7.0.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit3TestAdapter.3.7.0/NUnit3TestAdapter.3.7.0.nupkg
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/tools/Mono.Cecil.Mdb.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit3TestAdapter.3.7.0/tools/Mono.Cecil.Mdb.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/tools/Mono.Cecil.Pdb.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit3TestAdapter.3.7.0/tools/Mono.Cecil.Pdb.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/tools/Mono.Cecil.Rocks.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit3TestAdapter.3.7.0/tools/Mono.Cecil.Rocks.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/tools/Mono.Cecil.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit3TestAdapter.3.7.0/tools/Mono.Cecil.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/tools/NUnit3.TestAdapter.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit3TestAdapter.3.7.0/tools/NUnit3.TestAdapter.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/tools/nunit.engine.api.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit3TestAdapter.3.7.0/tools/nunit.engine.api.dll
--------------------------------------------------------------------------------
/csharp/packages/NUnit3TestAdapter.3.7.0/tools/nunit.engine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/NUnit3TestAdapter.3.7.0/tools/nunit.engine.dll
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/Newtonsoft.Json.9.0.1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/Newtonsoft.Json.9.0.1/Newtonsoft.Json.9.0.1.nupkg
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/lib/net20/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/Newtonsoft.Json.9.0.1/lib/net20/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/lib/net35/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/Newtonsoft.Json.9.0.1/lib/net35/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/lib/net40/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/Newtonsoft.Json.9.0.1/lib/net40/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/lib/net45/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/Newtonsoft.Json.9.0.1/lib/net45/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/Newtonsoft.Json.9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/Newtonsoft.Json.9.0.1/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/csharp/packages/Newtonsoft.Json.9.0.1/lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/csharp/packages/Newtonsoft.Json.9.0.1/tools/install.ps1:
--------------------------------------------------------------------------------
1 | param($installPath, $toolsPath, $package, $project)
2 |
3 | # open json.net splash page on package install
4 | # don't open if json.net is installed as a dependency
5 |
6 | try
7 | {
8 | $url = "http://www.newtonsoft.com/json/install?version=" + $package.Version
9 | $dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
10 |
11 | if ($dte2.ActiveWindow.Caption -eq "Package Manager Console")
12 | {
13 | # user is installing from VS NuGet console
14 | # get reference to the window, the console host and the input history
15 | # show webpage if "install-package newtonsoft.json" was last input
16 |
17 | $consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow])
18 |
19 | $props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor `
20 | [System.Reflection.BindingFlags]::NonPublic)
21 |
22 | $prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1
23 | if ($prop -eq $null) { return }
24 |
25 | $hostInfo = $prop.GetValue($consoleWindow)
26 | if ($hostInfo -eq $null) { return }
27 |
28 | $history = $hostInfo.WpfConsole.InputHistory.History
29 |
30 | $lastCommand = $history | select -last 1
31 |
32 | if ($lastCommand)
33 | {
34 | $lastCommand = $lastCommand.Trim().ToLower()
35 | if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json"))
36 | {
37 | $dte2.ItemOperations.Navigate($url) | Out-Null
38 | }
39 | }
40 | }
41 | else
42 | {
43 | # user is installing from VS NuGet dialog
44 | # get reference to the window, then smart output console provider
45 | # show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation
46 |
47 | $instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor `
48 | [System.Reflection.BindingFlags]::NonPublic)
49 |
50 | $consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor `
51 | [System.Reflection.BindingFlags]::NonPublic)
52 |
53 | if ($instanceField -eq $null -or $consoleField -eq $null) { return }
54 |
55 | $instance = $instanceField.GetValue($null)
56 |
57 | if ($instance -eq $null) { return }
58 |
59 | $consoleProvider = $consoleField.GetValue($instance)
60 | if ($consoleProvider -eq $null) { return }
61 |
62 | $console = $consoleProvider.CreateOutputConsole($false)
63 |
64 | $messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor `
65 | [System.Reflection.BindingFlags]::NonPublic)
66 | if ($messagesField -eq $null) { return }
67 |
68 | $messages = $messagesField.GetValue($console)
69 | if ($messages -eq $null) { return }
70 |
71 | $operations = $messages -split "=============================="
72 |
73 | $lastOperation = $operations | select -last 1
74 |
75 | if ($lastOperation)
76 | {
77 | $lastOperation = $lastOperation.ToLower()
78 |
79 | $lines = $lastOperation -split "`r`n"
80 |
81 | $installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json ") } | select -first 1
82 |
83 | if ($installMatch)
84 | {
85 | $dte2.ItemOperations.Navigate($url) | Out-Null
86 | }
87 | }
88 | }
89 | }
90 | catch
91 | {
92 | try
93 | {
94 | $pmPane = $dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Package Manager")
95 |
96 | $selection = $pmPane.TextDocument.Selection
97 | $selection.StartOfDocument($false)
98 | $selection.EndOfDocument($true)
99 |
100 | if ($selection.Text.StartsWith("Attempting to gather dependencies information for package 'Newtonsoft.Json." + $package.Version + "'"))
101 | {
102 | # don't show on upgrade
103 | if (!$selection.Text.Contains("Removed package"))
104 | {
105 | $dte2.ItemOperations.Navigate($url) | Out-Null
106 | }
107 | }
108 | }
109 | catch
110 | {
111 | # stop potential errors from bubbling up
112 | # worst case the splash page won't open
113 | }
114 | }
115 |
116 | # still yolo
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/mwinteringham/api-framework
2 |
3 | go 1.15
4 |
5 | require github.com/stretchr/testify v1.6.1
6 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6 | github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
7 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
8 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
9 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
10 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
11 |
--------------------------------------------------------------------------------
/go/README.md:
--------------------------------------------------------------------------------
1 | # Go API Testing
2 | # Author : Rosie Hamilton
3 |
4 | This an attempt to copy the existing API testing patterns here in Go.
5 |
6 | to run the tests use the following command
7 | 'go test -v'
8 |
--------------------------------------------------------------------------------
/go/api/api.go:
--------------------------------------------------------------------------------
1 | package api
2 |
3 | import (
4 | "bytes"
5 | "encoding/json"
6 | "fmt"
7 | "net/http"
8 | "net/url"
9 |
10 | "github.com/mwinteringham/api-framework/go/payloads"
11 | )
12 |
13 | var baseURL = "https://restful-booker.herokuapp.com"
14 |
15 | func RequestAuth(user, pw string) (*http.Request, error) {
16 | authPayload := payloads.Auth{
17 | Username: user,
18 | Password: pw,
19 | }
20 |
21 | payload, err := json.Marshal(&authPayload)
22 | if err != nil {
23 | return nil, err
24 | }
25 |
26 | reqURL, err := url.Parse(baseURL)
27 | if err != nil {
28 | return nil, err
29 | }
30 |
31 | reqURL.Path = "auth"
32 | req, err := http.NewRequest("POST", reqURL.String(), bytes.NewBuffer(payload))
33 | if err != nil {
34 | return nil, err
35 | }
36 |
37 | req.Header.Add("Content-Type", "application/json")
38 | return req, nil
39 | }
40 |
41 | //RequestAllBookings returns a GET request to https://restful-booker.herokuapp.com/booking
42 | func RequestAllBookings() (*http.Request, error) {
43 | reqURL, err := url.Parse(baseURL)
44 | if err != nil {
45 | return nil, err
46 | }
47 |
48 | reqURL.Path = "booking"
49 | req, err := http.NewRequest("GET", reqURL.String(), nil)
50 | if err != nil {
51 | return nil, err
52 | }
53 |
54 | return req, nil
55 | }
56 |
57 | //RequestSpecificBooking returns a GET request to https://restful-booker.herokuapp.com/booking/{ID}
58 | func RequestSpecificBooking(bookingID string) (*http.Request, error) {
59 | reqURL, err := url.Parse(baseURL)
60 | if err != nil {
61 | return nil, err
62 | }
63 |
64 | reqURL.Path = fmt.Sprintf("booking/%s", bookingID)
65 | req, err := http.NewRequest("GET", reqURL.String(), nil)
66 | if err != nil {
67 | return nil, err
68 | }
69 |
70 | req.Header.Add("Accept", "application/json")
71 | return req, nil
72 | }
73 |
74 | //RequestCreateBooking returns a POST request to https://restful-booker.herokuapp.com/booking
75 | func RequestCreateBooking(bookingPayload payloads.Booking) (*http.Request, error) {
76 |
77 | payload, err := json.Marshal(&bookingPayload)
78 | if err != nil {
79 | return nil, err
80 | }
81 |
82 | reqURL, err := url.Parse(baseURL)
83 | if err != nil {
84 | return nil, err
85 | }
86 |
87 | reqURL.Path = "booking"
88 | req, err := http.NewRequest("POST", reqURL.String(), bytes.NewBuffer(payload))
89 | if err != nil {
90 | return nil, err
91 | }
92 |
93 | req.Header.Add("Accept", "application/json")
94 | req.Header.Add("Content-Type", "application/json")
95 |
96 | return req, nil
97 | }
98 |
99 | //RequestUpdateBooking returns a PUT request to https://restful-booker.herokuapp.com/booking/{ID}
100 | func RequestUpdateBooking(bookingPayload payloads.Booking, bookingID string) (*http.Request, error) {
101 |
102 | payload, err := json.Marshal(&bookingPayload)
103 | if err != nil {
104 | return nil, err
105 | }
106 |
107 | reqURL, err := url.Parse(baseURL)
108 | if err != nil {
109 | return nil, err
110 | }
111 |
112 | reqURL.Path = fmt.Sprintf("booking/%s", bookingID)
113 |
114 | req, err := http.NewRequest("PUT", reqURL.String(), bytes.NewBuffer(payload))
115 | if err != nil {
116 | return nil, err
117 | }
118 |
119 | req.Header.Add("Accept", "application/json")
120 | req.Header.Add("Content-Type", "application/json")
121 |
122 | return req, nil
123 | }
124 |
--------------------------------------------------------------------------------
/go/booking_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "net/http"
6 | "testing"
7 |
8 | "github.com/mwinteringham/api-framework/go/api"
9 | "github.com/mwinteringham/api-framework/go/payloads"
10 | "github.com/stretchr/testify/assert"
11 | )
12 |
13 | type createReqFunc func(payloads.Booking) (*http.Request, error)
14 | type updateReqFunc func(payloads.Booking, string) (*http.Request, error)
15 |
16 | func TestAllBookings(t *testing.T) {
17 | req, err := api.RequestAllBookings()
18 | if err != nil {
19 | fmt.Println(err)
20 | }
21 | statusCode, _ := DoRequest(req)
22 | assert.Equal(t, 200, statusCode)
23 | }
24 |
25 | func TestSpecificBooking(t *testing.T) {
26 | req, err := api.RequestSpecificBooking("1")
27 | if err != nil {
28 | fmt.Println(err)
29 | }
30 | statusCode, _ := DoRequest(req)
31 | assert.Equal(t, 200, statusCode)
32 | }
33 |
34 | func TestCreateBookings(t *testing.T) {
35 | validBooking := payloads.Booking{
36 | Firstname: "Jim",
37 | Lastname: "Brown",
38 | TotalPrice: 111,
39 | DepositPaid: true,
40 | BookingDates: payloads.BookingDates{
41 | CheckIn: "2018-01-01",
42 | CheckOut: "2019-01-01",
43 | },
44 | }
45 |
46 | validBookingWithBreakfast := payloads.Booking{
47 | Firstname: "Jim",
48 | Lastname: "Brown",
49 | TotalPrice: 111,
50 | DepositPaid: true,
51 | BookingDates: payloads.BookingDates{
52 | CheckIn: "2018-01-01",
53 | CheckOut: "2019-01-01",
54 | },
55 | AdditionalNeeds: "Breakfast",
56 | }
57 |
58 | invalidBooking := payloads.Booking{
59 | TotalPrice: 111,
60 | }
61 |
62 | tests := []struct {
63 | reqFunc createReqFunc
64 | payload payloads.Booking
65 | ExpectedStatusCode int
66 | }{
67 | {api.RequestCreateBooking, validBooking, 200},
68 | {api.RequestCreateBooking, validBookingWithBreakfast, 200},
69 | {api.RequestCreateBooking, invalidBooking, 500},
70 | }
71 |
72 | for _, test := range tests {
73 | req, err := test.reqFunc(test.payload)
74 |
75 | if err != nil {
76 | fmt.Println(err)
77 | }
78 | statusCode, _ := DoRequest(req)
79 | assert.Equal(t, test.ExpectedStatusCode, statusCode)
80 | }
81 | }
82 |
83 | func TestUpdateBooking(t *testing.T) {
84 |
85 | validBooking := payloads.Booking{
86 | Firstname: "Jim",
87 | Lastname: "Brown",
88 | TotalPrice: 111,
89 | DepositPaid: true,
90 | BookingDates: payloads.BookingDates{
91 | CheckIn: "2018-01-01",
92 | CheckOut: "2019-01-01",
93 | },
94 | }
95 |
96 | validBookingWithBreakfast := payloads.Booking{
97 | Firstname: "Jim",
98 | Lastname: "Brown",
99 | TotalPrice: 111,
100 | DepositPaid: true,
101 | BookingDates: payloads.BookingDates{
102 | CheckIn: "2018-01-01",
103 | CheckOut: "2019-01-01",
104 | },
105 | AdditionalNeeds: "Breakfast",
106 | }
107 |
108 | invalidBooking := payloads.Booking{
109 | TotalPrice: 111,
110 | }
111 |
112 | tests := []struct {
113 | reqFunc updateReqFunc
114 | payload payloads.Booking
115 | id string
116 | ExpectedStatusCode int
117 | }{
118 | {api.RequestUpdateBooking, validBooking, "1", 200},
119 | {api.RequestUpdateBooking, validBookingWithBreakfast, "1", 200},
120 | {api.RequestUpdateBooking, invalidBooking, "1", 400},
121 | }
122 |
123 | for _, test := range tests {
124 | req, err := test.reqFunc(test.payload, test.id)
125 | if err != nil {
126 | fmt.Println(err)
127 | }
128 |
129 | req.Header.Add("Cookie", authCookie)
130 |
131 | statusCode, _ := DoRequest(req)
132 | assert.Equal(t, test.ExpectedStatusCode, statusCode)
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/go/main_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "bytes"
5 | "encoding/json"
6 | "flag"
7 | "fmt"
8 |
9 | "net/http"
10 | "os"
11 | "testing"
12 | "time"
13 |
14 | "github.com/mwinteringham/api-framework/go/api"
15 | "github.com/mwinteringham/api-framework/go/payloads"
16 | )
17 |
18 | func TestMain(m *testing.M) {
19 |
20 | flag.Parse()
21 | // Test setup
22 |
23 | // Run tests
24 | exitCode := m.Run()
25 |
26 | // Test teardown
27 | os.Exit(exitCode)
28 | }
29 |
30 | var (
31 | client *http.Client
32 | authCookie string
33 | )
34 |
35 | func init() {
36 | client = &http.Client{
37 | Timeout: 10 * time.Second,
38 | }
39 |
40 | tokenReq, err := api.RequestAuth("admin", "password123")
41 | if err != nil {
42 | fmt.Println(err)
43 | }
44 |
45 | _, body := DoRequest(tokenReq)
46 |
47 | var authResp payloads.AuthResponse
48 | json.Unmarshal([]byte(body), &authResp)
49 | authCookie = fmt.Sprintf("token=%s", authResp.Token)
50 | }
51 |
52 | // DoRequest makes a request returning the Status Code and the Response
53 | func DoRequest(req *http.Request) (statuscode int, reponse string) {
54 | resp, err := client.Do(req)
55 | if err != nil {
56 | fmt.Println(err)
57 | }
58 | defer resp.Body.Close()
59 | var buffer bytes.Buffer
60 | if _, err := buffer.ReadFrom(resp.Body); err != nil {
61 | fmt.Println(err)
62 | }
63 |
64 | return resp.StatusCode, buffer.String()
65 | }
66 |
--------------------------------------------------------------------------------
/go/payloads/payloads.go:
--------------------------------------------------------------------------------
1 | package payloads
2 |
3 | // Auth represents an authorisation payload
4 | type Auth struct {
5 | Username string `json:"username"`
6 | Password string `json:"password"`
7 | }
8 |
9 | // AuthResponse is used to unmarshal an authorisation response
10 | type AuthResponse struct {
11 | Token string `json:"token"`
12 | }
13 |
14 | //Booking represents a booking
15 | type Booking struct {
16 | Firstname string `json:"firstname,omitempty"`
17 | Lastname string `json:"lastname,omitempty"`
18 | TotalPrice float64 `json:"totalprice,omitempty"`
19 | DepositPaid bool `json:"depositpaid,omitempty"`
20 | BookingDates BookingDates `json:"bookingdates,omitempty"`
21 | AdditionalNeeds string `json:"additionalneeds,omitempty"`
22 | }
23 |
24 | // BookingDates represents a CheckIn and a CheckOut date
25 | type BookingDates struct {
26 | CheckIn string `json:"checkin"`
27 | CheckOut string `json:"checkout"`
28 | }
29 |
--------------------------------------------------------------------------------
/java/restassured/README.md:
--------------------------------------------------------------------------------
1 | # Java
2 |
3 | Requires Java and Maven. To run simply clone the repo down and run ```mvn test```
4 |
--------------------------------------------------------------------------------
/java/restassured/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.automationintesting
8 | api-checks
9 | 1.0-SNAPSHOT
10 |
11 |
12 |
13 |
14 | org.apache.maven.plugins
15 | maven-compiler-plugin
16 | 2.3.2
17 |
18 | 18
19 | 18
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | org.junit.jupiter
28 | junit-jupiter
29 | 5.9.1
30 |
31 |
32 | io.rest-assured
33 | rest-assured
34 | 5.3.0
35 |
36 |
37 | com.fasterxml.jackson.core
38 | jackson-databind
39 | 2.14.1
40 |
41 |
42 | com.fasterxml.jackson.core
43 | jackson-core
44 | 2.14.1
45 |
46 |
47 | com.approvaltests
48 | approvaltests
49 | 18.5.0
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/java/restassured/src/main/java/com/restfulbooker/api/api/AuthApi.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.api;
2 |
3 | import com.restfulbooker.api.payloads.Auth;
4 | import io.restassured.http.ContentType;
5 | import io.restassured.response.Response;
6 |
7 | import static io.restassured.RestAssured.given;
8 |
9 | public class AuthApi extends BaseApi {
10 |
11 | private static final String apiUrl = baseUrl + "auth/";
12 |
13 | public static Response postAuth(Auth payload){
14 | return given()
15 | .contentType(ContentType.JSON)
16 | .body(payload)
17 | .when()
18 | .post(apiUrl);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/java/restassured/src/main/java/com/restfulbooker/api/api/BaseApi.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.api;
2 |
3 | public class BaseApi {
4 |
5 | protected static final String baseUrl = "https://restful-booker.herokuapp.com/";
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/java/restassured/src/main/java/com/restfulbooker/api/api/BookingApi.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.api;
2 |
3 | import com.restfulbooker.api.payloads.Booking;
4 | import io.restassured.http.ContentType;
5 | import io.restassured.response.Response;
6 |
7 | import static io.restassured.RestAssured.given;
8 |
9 | public class BookingApi extends BaseApi {
10 |
11 | private static final String apiUrl = baseUrl + "booking/";
12 |
13 | public static Response getBookings(){
14 | return given().get(apiUrl);
15 | }
16 |
17 | public static Response getBooking(int id, String mediaType) {
18 | return given()
19 | .header("Accept", mediaType)
20 | .get(apiUrl + Integer.toString(id));
21 | }
22 |
23 | public static Response postBooking(Booking payload) {
24 | return given()
25 | .contentType(ContentType.JSON)
26 | .body(payload)
27 | .when()
28 | .post(apiUrl);
29 | }
30 |
31 | public static Response deleteBooking(int id, String tokenValue) {
32 | return given()
33 | .header("Cookie", "token=" + tokenValue)
34 | .delete(apiUrl + Integer.toString(id));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/java/restassured/src/main/java/com/restfulbooker/api/payloads/Auth.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class Auth {
6 |
7 | @JsonProperty
8 | private String username;
9 | @JsonProperty
10 | private String password;
11 |
12 | public String getUsername() {
13 | return username;
14 | }
15 |
16 | public String getPassword() {
17 | return password;
18 | }
19 |
20 | private Auth(String username, String password) {
21 | this.username = username;
22 | this.password = password;
23 | }
24 |
25 | public static class Builder {
26 |
27 | private String username;
28 | private String password;
29 |
30 | public Builder setUsername(String username) {
31 | this.username = username;
32 | return this;
33 | }
34 |
35 | public Builder setPassword(String password) {
36 | this.password = password;
37 | return this;
38 | }
39 |
40 | public Auth build(){
41 | return new Auth(username, password);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/java/restassured/src/main/java/com/restfulbooker/api/payloads/AuthResponse.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class AuthResponse {
6 |
7 | @JsonProperty
8 | private String token;
9 |
10 | public String getToken() {
11 | return token;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/java/restassured/src/main/java/com/restfulbooker/api/payloads/Booking.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class Booking {
6 |
7 | @JsonProperty
8 | private String firstname;
9 | @JsonProperty
10 | private String lastname;
11 | @JsonProperty
12 | private int totalprice;
13 | @JsonProperty
14 | private boolean depositpaid;
15 | @JsonProperty
16 | private BookingDates bookingdates;
17 | @JsonProperty
18 | private String additionalneeds;
19 |
20 | public String getFirstname() {
21 | return firstname;
22 | }
23 |
24 | public String getLastname() {
25 | return lastname;
26 | }
27 |
28 | public int getTotalprice() {
29 | return totalprice;
30 | }
31 |
32 | public boolean isDepositpaid() {
33 | return depositpaid;
34 | }
35 |
36 | public BookingDates getBookingdates() {
37 | return bookingdates;
38 | }
39 |
40 | public String getAdditionalneeds() {
41 | return additionalneeds;
42 | }
43 |
44 | // default constructor required by Jackson
45 | private Booking() {
46 | // nothing here
47 | }
48 |
49 | private Booking(String firstname, String lastname, int totalprice, boolean depositpaid, BookingDates bookingdates, String additionalneeds) {
50 | this.firstname = firstname;
51 | this.lastname = lastname;
52 | this.totalprice = totalprice;
53 | this.depositpaid = depositpaid;
54 | this.bookingdates = bookingdates;
55 | this.additionalneeds = additionalneeds;
56 | }
57 |
58 | public static class Builder {
59 |
60 | private String firstname;
61 | private String lastname;
62 | private int totalprice;
63 | private boolean depositpaid;
64 | private BookingDates bookingdates;
65 | private String additionalneeds;
66 |
67 | public Builder setFirstname(String firstname) {
68 | this.firstname = firstname;
69 | return this;
70 | }
71 |
72 | public Builder setLastname(String lastname) {
73 | this.lastname = lastname;
74 | return this;
75 | }
76 |
77 | public Builder setTotalprice(int totalprice) {
78 | this.totalprice = totalprice;
79 | return this;
80 | }
81 |
82 | public Builder setDepositpaid(boolean depositpaid) {
83 | this.depositpaid = depositpaid;
84 | return this;
85 | }
86 |
87 | public Builder setBookingdates(BookingDates bookingdates) {
88 | this.bookingdates = bookingdates;
89 | return this;
90 | }
91 |
92 | public Builder setAdditionalneeds(String additionalneeds) {
93 | this.additionalneeds = additionalneeds;
94 | return this;
95 | }
96 |
97 | public Booking build(){
98 | return new Booking(firstname, lastname, totalprice, depositpaid, bookingdates, additionalneeds);
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/java/restassured/src/main/java/com/restfulbooker/api/payloads/BookingDates.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | import java.util.Date;
6 |
7 | public class BookingDates {
8 |
9 | @JsonProperty
10 | private Date checkin;
11 | @JsonProperty
12 | private Date checkout;
13 |
14 | public Date getCheckin() {
15 | return checkin;
16 | }
17 |
18 | public Date getCheckout() {
19 | return checkout;
20 | }
21 |
22 | // default constructor required by Jackson
23 | private BookingDates() {
24 | // nothing here
25 | }
26 |
27 | private BookingDates(Date checkin, Date checkout){
28 | this.checkin = checkin;
29 | this.checkout = checkout;
30 | }
31 |
32 | public static class Builder {
33 |
34 | private Date checkin;
35 | private Date checkout;
36 |
37 | public Builder setCheckin(Date checkin) {
38 | this.checkin = checkin;
39 | return this;
40 | }
41 |
42 | public Builder setCheckout(Date checkout) {
43 | this.checkout = checkout;
44 | return this;
45 | }
46 |
47 | public BookingDates build() {
48 | return new BookingDates(checkin, checkout);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/java/restassured/src/main/java/com/restfulbooker/api/payloads/BookingResponse.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class BookingResponse {
6 |
7 | @JsonProperty
8 | private int bookingid;
9 | @JsonProperty
10 | private Booking booking;
11 |
12 | public int getBookingid() {
13 | return bookingid;
14 | }
15 |
16 | public Booking getBooking() {
17 | return booking;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/java/restassured/src/test/java/com/restfulbooker/api/ApiTest.deleteBookingReturns201.approved.txt:
--------------------------------------------------------------------------------
1 | 201
2 |
--------------------------------------------------------------------------------
/java/restassured/src/test/java/com/restfulbooker/api/ApiTest.getBookingIdShouldReturn200.approved.txt:
--------------------------------------------------------------------------------
1 | 200
2 |
--------------------------------------------------------------------------------
/java/restassured/src/test/java/com/restfulbooker/api/ApiTest.getBookingIdWithBadAcceptShouldReturn418.approved.txt:
--------------------------------------------------------------------------------
1 | 418
2 |
--------------------------------------------------------------------------------
/java/restassured/src/test/java/com/restfulbooker/api/ApiTest.getBookingShouldReturn200.approved.txt:
--------------------------------------------------------------------------------
1 | 200
2 |
--------------------------------------------------------------------------------
/java/restassured/src/test/java/com/restfulbooker/api/ApiTest.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api;
2 |
3 | import com.restfulbooker.api.api.AuthApi;
4 | import com.restfulbooker.api.api.BookingApi;
5 | import com.restfulbooker.api.payloads.*;
6 | import io.restassured.response.Response;
7 | import org.approvaltests.Approvals;
8 | import org.junit.jupiter.api.Test;
9 |
10 | import java.util.Date;
11 |
12 | public class ApiTest {
13 |
14 | @Test
15 | public void getBookingShouldReturn200(){
16 | Response response = BookingApi.getBookings();
17 |
18 | Approvals.verify(response.getStatusCode());
19 | }
20 |
21 | @Test
22 | public void getBookingIdShouldReturn200(){
23 | Response response = BookingApi.getBooking(1, "application/json");
24 |
25 | Approvals.verify(response.getStatusCode());
26 | }
27 |
28 | @Test
29 | public void getBookingIdWithBadAcceptShouldReturn418(){
30 | Response response = BookingApi.getBooking(1, "text/plain");
31 |
32 | Approvals.verify(response.getStatusCode());
33 | }
34 |
35 | @Test
36 | public void postBookingReturns200(){
37 | BookingDates dates = new BookingDates.Builder()
38 | .setCheckin(new Date())
39 | .setCheckout(new Date())
40 | .build();
41 |
42 | Booking payload = new Booking.Builder()
43 | .setFirstname("Mary")
44 | .setLastname("White")
45 | .setTotalprice(200)
46 | .setDepositpaid(true)
47 | .setBookingdates(dates)
48 | .setAdditionalneeds("None")
49 | .build();
50 |
51 | Response response = BookingApi.postBooking(payload);
52 |
53 | Approvals.verify(response.getStatusCode());
54 | }
55 |
56 | @Test
57 | public void deleteBookingReturns201(){
58 | BookingDates dates = new BookingDates.Builder()
59 | .setCheckin(new Date())
60 | .setCheckout(new Date())
61 | .build();
62 |
63 | Booking payload = new Booking.Builder()
64 | .setFirstname("Mary")
65 | .setLastname("White")
66 | .setTotalprice(200)
67 | .setDepositpaid(true)
68 | .setBookingdates(dates)
69 | .setAdditionalneeds("None")
70 | .build();
71 |
72 | BookingResponse createdBookingResponse = BookingApi.postBooking(payload).as(BookingResponse.class);
73 |
74 | Auth auth = new Auth.Builder()
75 | .setUsername("admin")
76 | .setPassword("password123")
77 | .build();
78 |
79 | AuthResponse authResponse = AuthApi.postAuth(auth).as(AuthResponse.class);
80 |
81 | Response deleteResponse = BookingApi.deleteBooking(
82 | createdBookingResponse.getBookingid(),
83 | authResponse.getToken());
84 |
85 | Approvals.verify(deleteResponse.getStatusCode());
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/java/restassured/src/test/java/com/restfulbooker/api/ApiTest.postBookingReturns200.approved.txt:
--------------------------------------------------------------------------------
1 | 200
2 |
--------------------------------------------------------------------------------
/java/springmvc/README.md:
--------------------------------------------------------------------------------
1 | # Java
2 |
3 | Requires Java and Maven. To run simply clone the repo down and run ```mvn test```
4 |
--------------------------------------------------------------------------------
/java/springmvc/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.automationintesting
8 | api-checks
9 | 1.0-SNAPSHOT
10 |
11 |
12 |
13 |
14 | org.apache.maven.plugins
15 | maven-compiler-plugin
16 | 2.3.2
17 |
18 | 18
19 | 18
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | org.junit.jupiter
28 | junit-jupiter
29 | 5.9.1
30 |
31 |
32 | org.springframework
33 | spring-webmvc
34 | 6.0.2
35 |
36 |
37 | com.fasterxml.jackson.core
38 | jackson-databind
39 | 2.14.1
40 |
41 |
42 | com.fasterxml.jackson.core
43 | jackson-core
44 | 2.14.1
45 |
46 |
47 | com.approvaltests
48 | approvaltests
49 | 18.5.0
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/api/Auth.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.api;
2 |
3 | import com.restfulbooker.api.payloads.request.AuthPayload;
4 | import com.restfulbooker.api.payloads.response.AuthResponse;
5 | import org.springframework.http.*;
6 | import org.springframework.web.client.RestTemplate;
7 |
8 | public class Auth {
9 |
10 | private static RestTemplate restTemplate = new RestTemplate();
11 |
12 | public static ResponseEntity postAuth(AuthPayload payload){
13 | HttpHeaders requestHeaders = new HttpHeaders();
14 | requestHeaders.setContentType(MediaType.APPLICATION_JSON);
15 |
16 | HttpEntity httpEntity = new HttpEntity(payload, requestHeaders);
17 |
18 | return restTemplate.exchange("https://restful-booker.herokuapp.com/auth", HttpMethod.POST, httpEntity, AuthResponse.class);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/api/Booking.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.api;
2 |
3 | import com.restfulbooker.api.payloads.request.BookingPayload;
4 | import com.restfulbooker.api.payloads.response.BookingResponse;
5 | import org.springframework.http.*;
6 | import org.springframework.web.client.HttpClientErrorException;
7 | import org.springframework.web.client.RestTemplate;
8 |
9 | import java.util.Collections;
10 |
11 | public class Booking {
12 |
13 | private static RestTemplate restTemplate = new RestTemplate();
14 | private static String baseUrl = "https://restful-booker.herokuapp.com";
15 |
16 | public static ResponseEntity getBookings(){
17 | return restTemplate.getForEntity(baseUrl + "/booking", String.class);
18 | }
19 |
20 | public static ResponseEntity getBooking(int id, MediaType accept) throws HttpClientErrorException {
21 | HttpHeaders requestHeaders = new HttpHeaders();
22 | requestHeaders.setAccept(Collections.singletonList(accept));
23 |
24 | HttpEntity httpEntity = new HttpEntity(requestHeaders);
25 |
26 | return restTemplate.exchange(baseUrl + "/booking/" + Integer.toString(id), HttpMethod.GET, httpEntity, String.class);
27 | }
28 |
29 | public static ResponseEntity postBooking(BookingPayload payload) {
30 | HttpHeaders requestHeaders = new HttpHeaders();
31 | requestHeaders.setContentType(MediaType.APPLICATION_JSON);
32 | requestHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
33 |
34 | HttpEntity httpEntity = new HttpEntity(payload, requestHeaders);
35 |
36 | return restTemplate.exchange(baseUrl + "/booking", HttpMethod.POST, httpEntity, BookingResponse.class);
37 | }
38 |
39 | public static ResponseEntity deleteBooking(int id, String tokenValue) {
40 | HttpHeaders requestHeaders = new HttpHeaders();
41 | requestHeaders.set("Cookie","token=" + tokenValue);
42 |
43 | HttpEntity httpEntity = new HttpEntity(requestHeaders);
44 |
45 | return restTemplate.exchange(baseUrl + "/booking/" + Integer.toString(id), HttpMethod.DELETE, httpEntity, String.class);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/payloads/request/AuthPayload.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads.request;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class AuthPayload {
6 |
7 | @JsonProperty
8 | private String username;
9 | @JsonProperty
10 | private String password;
11 |
12 | private AuthPayload(String username, String password) {
13 | this.username = username;
14 | this.password = password;
15 | }
16 |
17 | public String getUsername() {
18 | return username;
19 | }
20 |
21 | public String getPassword() {
22 | return password;
23 | }
24 |
25 | public static class AuthPayloadBuilder{
26 |
27 | private String username;
28 | private String password;
29 |
30 | public AuthPayloadBuilder setUsername(String username) {
31 | this.username = username;
32 | return this;
33 | }
34 |
35 | public AuthPayloadBuilder setPassword(String password) {
36 | this.password = password;
37 | return this;
38 | }
39 |
40 | public AuthPayload build(){
41 | return new AuthPayload(username, password);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/payloads/request/BookingDatesPayload.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads.request;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | import java.util.Date;
6 |
7 | public class BookingDatesPayload {
8 |
9 | @JsonProperty
10 | private Date checkin;
11 | @JsonProperty
12 | private Date checkout;
13 |
14 | public BookingDatesPayload(Date checkin, Date checkout){
15 | this.checkin = checkin;
16 | this.checkout = checkout;
17 | }
18 |
19 | public Date getCheckin() {
20 | return checkin;
21 | }
22 |
23 | public Date getCheckout() {
24 | return checkout;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/payloads/request/BookingPayload.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads.request;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | import java.util.Date;
6 |
7 | public class BookingPayload {
8 |
9 | @JsonProperty
10 | private String firstname;
11 | @JsonProperty
12 | private String lastname;
13 | @JsonProperty
14 | private int totalprice;
15 | @JsonProperty
16 | private boolean depositpaid;
17 | @JsonProperty
18 | private BookingDatesPayload bookingdates;
19 | @JsonProperty
20 | private String additionalneeds;
21 |
22 | public String getFirstname() {
23 | return firstname;
24 | }
25 |
26 | public String getLastname() {
27 | return lastname;
28 | }
29 |
30 | public int getTotalprice() {
31 | return totalprice;
32 | }
33 |
34 | public boolean isDepositpaid() {
35 | return depositpaid;
36 | }
37 |
38 | public BookingDatesPayload getBookingdates() {
39 | return bookingdates;
40 | }
41 |
42 | public String getAdditionalneeds() {
43 | return additionalneeds;
44 | }
45 |
46 | private BookingPayload(String firstname, String lastname, int totalprice, boolean depositpaid, BookingDatesPayload bookingdates, String additionalneeds) {
47 | this.firstname = firstname;
48 | this.lastname = lastname;
49 | this.totalprice = totalprice;
50 | this.depositpaid = depositpaid;
51 | this.bookingdates = bookingdates;
52 | this.additionalneeds = additionalneeds;
53 | }
54 |
55 | public static class BookingPayloadBuilder {
56 |
57 | private String firstname;
58 | private String lastname;
59 | private int totalprice;
60 | private boolean depositpaid;
61 | private Date checkin;
62 | private Date checkout;
63 | private String additionalneeds;
64 |
65 | public BookingPayloadBuilder setFirstname(String firstname) {
66 | this.firstname = firstname;
67 | return this;
68 | }
69 |
70 | public BookingPayloadBuilder setLastname(String lastname) {
71 | this.lastname = lastname;
72 | return this;
73 | }
74 |
75 | public BookingPayloadBuilder setTotalprice(int totalprice) {
76 | this.totalprice = totalprice;
77 | return this;
78 | }
79 |
80 | public BookingPayloadBuilder setDepositpaid(boolean depositpaid) {
81 | this.depositpaid = depositpaid;
82 | return this;
83 | }
84 |
85 | public BookingPayloadBuilder setCheckin(Date checkin) {
86 | this.checkin = checkin;
87 | return this;
88 | }
89 |
90 | public BookingPayloadBuilder setCheckout(Date checkout) {
91 | this.checkout = checkout;
92 | return this;
93 | }
94 |
95 | public BookingPayloadBuilder setAdditionalneeds(String additionalneeds) {
96 | this.additionalneeds = additionalneeds;
97 | return this;
98 | }
99 |
100 | public BookingPayload build(){
101 | BookingDatesPayload bookingDates = new BookingDatesPayload(checkin, checkout);
102 | return new BookingPayload(firstname, lastname, totalprice, depositpaid, bookingDates, additionalneeds);
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/payloads/response/AuthResponse.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads.response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | @JsonIgnoreProperties(ignoreUnknown = true)
7 | public class AuthResponse {
8 |
9 | @JsonProperty
10 | private String token;
11 |
12 | public String getToken() {
13 | return token;
14 | }
15 |
16 | public void setToken(String token) {
17 | this.token = token;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/payloads/response/BookingDetails.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads.response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | @JsonIgnoreProperties(ignoreUnknown = true)
7 | public class BookingDetails {
8 |
9 | @JsonProperty
10 | private String firstname;
11 | @JsonProperty
12 | private String lastname;
13 | @JsonProperty
14 | private int totalprice;
15 | @JsonProperty
16 | private boolean depositpaid;
17 | @JsonProperty
18 | private BookingDetailsDates bookingdates;
19 | @JsonProperty
20 | private String additionalneeds;
21 |
22 | public void setFirstname(String firstname) {
23 | this.firstname = firstname;
24 | }
25 |
26 | public void setLastname(String lastname) {
27 | this.lastname = lastname;
28 | }
29 |
30 | public void setTotalprice(int totalprice) {
31 | this.totalprice = totalprice;
32 | }
33 |
34 | public void setDepositpaid(boolean depositpaid) {
35 | this.depositpaid = depositpaid;
36 | }
37 |
38 | public void setBookingdates(BookingDetailsDates bookingdates) {
39 | this.bookingdates = bookingdates;
40 | }
41 |
42 | public void setAdditionalneeds(String additionalneeds) {
43 | this.additionalneeds = additionalneeds;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/payloads/response/BookingDetailsDates.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads.response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | import java.util.Date;
7 |
8 | @JsonIgnoreProperties(ignoreUnknown = true)
9 | public class BookingDetailsDates {
10 |
11 | @JsonProperty
12 | private Date checkin;
13 | @JsonProperty
14 | private Date checkout;
15 |
16 | public Date getCheckin() {
17 | return checkin;
18 | }
19 |
20 | public Date getCheckout() {
21 | return checkout;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/java/springmvc/src/main/java/com/restfulbooker/api/payloads/response/BookingResponse.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api.payloads.response;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | @JsonIgnoreProperties(ignoreUnknown = true)
7 | public class BookingResponse {
8 |
9 | @JsonProperty
10 | private int bookingid;
11 | @JsonProperty
12 | private BookingDetails booking;
13 |
14 | public void setBookingid(int bookingid) {
15 | this.bookingid = bookingid;
16 | }
17 |
18 | public void setBooking(BookingDetails booking) {
19 | this.booking = booking;
20 | }
21 |
22 | public int getBookingid() {
23 | return bookingid;
24 | }
25 |
26 | public BookingDetails getBooking() {
27 | return booking;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/java/springmvc/src/test/java/com/restfulbooker/api/ApiTest.deleteBookingReturns201.approved.txt:
--------------------------------------------------------------------------------
1 | 201 CREATED
2 |
--------------------------------------------------------------------------------
/java/springmvc/src/test/java/com/restfulbooker/api/ApiTest.getBookingIdShouldReturn200.approved.txt:
--------------------------------------------------------------------------------
1 | 200 OK
2 |
--------------------------------------------------------------------------------
/java/springmvc/src/test/java/com/restfulbooker/api/ApiTest.getBookingIdWithBadAcceptShouldReturn418.approved.txt:
--------------------------------------------------------------------------------
1 | 418 I_AM_A_TEAPOT
2 |
--------------------------------------------------------------------------------
/java/springmvc/src/test/java/com/restfulbooker/api/ApiTest.getBookingShouldReturn200.approved.txt:
--------------------------------------------------------------------------------
1 | 200 OK
2 |
--------------------------------------------------------------------------------
/java/springmvc/src/test/java/com/restfulbooker/api/ApiTest.java:
--------------------------------------------------------------------------------
1 | package com.restfulbooker.api;
2 |
3 | import com.restfulbooker.api.api.Auth;
4 | import com.restfulbooker.api.api.Booking;
5 | import com.restfulbooker.api.payloads.request.AuthPayload;
6 | import com.restfulbooker.api.payloads.request.BookingPayload;
7 | import com.restfulbooker.api.payloads.response.AuthResponse;
8 | import com.restfulbooker.api.payloads.response.BookingResponse;
9 | import org.approvaltests.Approvals;
10 | import org.junit.jupiter.api.Test;
11 | import org.springframework.http.MediaType;
12 | import org.springframework.http.ResponseEntity;
13 | import org.springframework.web.client.HttpClientErrorException;
14 |
15 | import java.util.Date;
16 |
17 | import static org.junit.jupiter.api.Assertions.fail;
18 |
19 | public class ApiTest {
20 |
21 | @Test
22 | public void getBookingShouldReturn200(){
23 | ResponseEntity response = Booking.getBookings();
24 |
25 | Approvals.verify(response.getStatusCode());
26 | }
27 |
28 | @Test
29 | public void getBookingIdShouldReturn200(){
30 | ResponseEntity response = Booking.getBooking(1, MediaType.APPLICATION_JSON);
31 |
32 | Approvals.verify(response.getStatusCode());
33 | }
34 |
35 | @Test
36 | public void getBookingIdWithBadAcceptShouldReturn418(){
37 | try{
38 | Booking.getBooking(1, MediaType.TEXT_PLAIN);
39 |
40 | fail("HttpClientError not thrown");
41 | } catch (HttpClientErrorException e){
42 | Approvals.verify(e.getStatusCode());
43 | }
44 | }
45 |
46 | @Test
47 | public void postBookingReturns200(){
48 | BookingPayload payload = new BookingPayload.BookingPayloadBuilder()
49 | .setFirstname("Mary")
50 | .setLastname("White")
51 | .setTotalprice(200)
52 | .setDepositpaid(true)
53 | .setCheckin(new Date())
54 | .setCheckout(new Date())
55 | .setAdditionalneeds("None")
56 | .build();
57 |
58 | ResponseEntity response = Booking.postBooking(payload);
59 |
60 | Approvals.verify(response.getStatusCode());
61 | }
62 |
63 | @Test
64 | public void deleteBookingReturns201(){
65 | BookingPayload payload = new BookingPayload.BookingPayloadBuilder()
66 | .setFirstname("Mary")
67 | .setLastname("White")
68 | .setTotalprice(200)
69 | .setDepositpaid(true)
70 | .setCheckin(new Date())
71 | .setCheckout(new Date())
72 | .setAdditionalneeds("None")
73 | .build();
74 |
75 | ResponseEntity createdBookingResponse = Booking.postBooking(payload);
76 |
77 | AuthPayload authPayload = new AuthPayload.AuthPayloadBuilder()
78 | .setUsername("admin")
79 | .setPassword("password123")
80 | .build();
81 |
82 | ResponseEntity authResponse = Auth.postAuth(authPayload);
83 |
84 | ResponseEntity deleteResponse = Booking.deleteBooking(
85 | createdBookingResponse.getBody().getBookingid(),
86 | authResponse.getBody().getToken());
87 |
88 | Approvals.verify(deleteResponse.getStatusCode());
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/java/springmvc/src/test/java/com/restfulbooker/api/ApiTest.postBookingReturns200.approved.txt:
--------------------------------------------------------------------------------
1 | 200 OK
2 |
--------------------------------------------------------------------------------
/js/README.md:
--------------------------------------------------------------------------------
1 | # Node/JS based framework
2 |
3 | Steps to install
4 | 1. Run ```npm install mocha -g```
5 | 1. Run ```npm install```
6 | 2. With the installation complete run ```npm test```
7 |
--------------------------------------------------------------------------------
/js/api/authorise.js:
--------------------------------------------------------------------------------
1 | request = require('supertest-as-promised')
2 |
3 | exports.post_credentials = function(payload){
4 | return request('https://restful-booker.herokuapp.com')
5 | .post('/auth')
6 | .send(payload)
7 | };
8 |
--------------------------------------------------------------------------------
/js/api/booking.js:
--------------------------------------------------------------------------------
1 | request = require('supertest-as-promised')
2 |
3 | exports.all_bookings = function(){
4 | return request('https://restful-booker.herokuapp.com')
5 | .get('/booking')
6 | };
7 |
8 | exports.specific_booking = function(identifier, accept){
9 | return request('https://restful-booker.herokuapp.com')
10 | .get('/booking/' + identifier)
11 | .set('accept', accept)
12 | };
13 |
14 | exports.create_booking = function(payload, contentType){
15 | return request('https://restful-booker.herokuapp.com')
16 | .post('/booking')
17 | .set('accept', 'application/json')
18 | .set('Content-type', contentType)
19 | .send(payload)
20 | };
21 |
22 | exports.deleteBooking = function(identifier, token){
23 | return request('https://restful-booker.herokuapp.com')
24 | .delete('/booking/' + identifier)
25 | .set('Cookie', 'token=' + token)
26 | }
27 |
--------------------------------------------------------------------------------
/js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "integration-tests",
3 | "version": "1.0.0",
4 | "private": true,
5 | "scripts": {
6 | "test": "mocha test"
7 | },
8 | "dependencies": {
9 | "mocha": "^10.2.0",
10 | "supertest": "^6.3.3",
11 | "supertest-as-promised": "^2.0.2"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/js/payloads/auth_payload.js:
--------------------------------------------------------------------------------
1 | exports.create = function(username, password){
2 | return {
3 | 'username': username,
4 | 'password': password
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/js/payloads/booking_payload.js:
--------------------------------------------------------------------------------
1 | exports.create = function(firstname, lastname, totalprice, depositpaid, additionalneeds, checkin, checkout){
2 | return {
3 | 'firstname': firstname,
4 | 'lastname': lastname,
5 | 'totalprice': totalprice,
6 | 'depositpaid': depositpaid,
7 | 'bookingdates': {
8 | 'checkin': checkin,
9 | 'checkout': checkout
10 | },
11 | 'additionalneeds': additionalneeds
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/js/test/integration_tests.js:
--------------------------------------------------------------------------------
1 | var Booking = require('../api/booking'),
2 | Authorise = require('../api/authorise'),
3 | BookingPayload = require('../payloads/booking_payload'),
4 | AuthPayload = require('../payloads/auth_payload');
5 |
6 | describe('restful-booker', function(){
7 |
8 | it('returns a 200 when getting bookings', function testAllBookings(done) {
9 | Booking.all_bookings()
10 | .expect(200, done);
11 | });
12 |
13 | it('returns a 200 when getting a specific bookings', function testSpecificBooking(done) {
14 | Booking.specific_booking(1, 'application/json')
15 | .expect(200, done);
16 | });
17 |
18 | it('returns a 418 when getting a specific bookings with a bad heading', function testSpecificBookingBadHeading(done) {
19 | Booking.specific_booking(1, 'text/html')
20 | .expect(418, done);
21 | });
22 |
23 | it('returns a 200 when creating a booking', function testCreatingABooking(done){
24 | var payload = BookingPayload.create('Sally', 'Brown', 111, true, 'Breakfast', '2013-02-01', '2013-02-04');
25 |
26 | Booking.create_booking(payload, 'application/json')
27 | .expect(200, done);
28 | });
29 |
30 | it('returns a 200 when a DELETE is carried out on a booking', function deleteBooking(done){
31 | var booking_payload = BookingPayload.create('Sally', 'Brown', 111, true, 'Breakfast', '2013-02-01', '2013-02-04');
32 | var authorisation_payload = AuthPayload.create('admin', 'password123');
33 |
34 | Booking.create_booking(booking_payload, 'application/json')
35 | .then(function(res){
36 | var identifier = res.body.bookingid;
37 | Authorise.post_credentials(authorisation_payload)
38 | .then(function(res){
39 | Booking.deleteBooking(identifier, res.body.token)
40 | .expect(201, done);
41 | });
42 | })
43 | });
44 |
45 | });
46 |
--------------------------------------------------------------------------------
/python/README.md:
--------------------------------------------------------------------------------
1 | # Phython based framework
2 |
3 | Steps to install
4 | 1. Install dependencies ```pip install -r requirements.txt```
5 | 2. Update package manager ```pip install --upgrade pip```
6 | 3. With the installation complete run ```py.test```
7 |
--------------------------------------------------------------------------------
/python/api/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/python/api/__init__.py
--------------------------------------------------------------------------------
/python/api/authorise.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from .endpoints import *
3 |
4 |
5 | def post_credentials(payload):
6 | headers = {
7 | 'Content-type': 'application/json'
8 | }
9 |
10 | return requests.post(
11 | url=f'{restful_booker}/{Endpoint.auth}',
12 | json=payload,
13 | headers=headers
14 | )
15 |
--------------------------------------------------------------------------------
/python/api/booking.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from .endpoints import *
3 |
4 |
5 | def all_bookings():
6 | return requests.get(
7 | url=restful_booker
8 | )
9 |
10 |
11 | def specific_booking(identifier, accept):
12 | headers = {
13 | 'Accept': accept
14 | }
15 |
16 | return requests.get(
17 | url=f'{restful_booker}/{Endpoint.booking}/{identifier}',
18 | headers=headers
19 | )
20 |
21 |
22 | def create_booking(payload, content_type):
23 | headers = {
24 | 'Accept': 'application/json',
25 | 'Content-type': content_type
26 | }
27 |
28 | return requests.post(
29 | url=f'{restful_booker}/{Endpoint.booking}',
30 | json=payload,
31 | headers=headers
32 | )
33 |
34 |
35 | def delete_booking(identifier, token):
36 | headers = {
37 | 'Cookie': f'token={token}'
38 | }
39 |
40 | return requests.delete(
41 | url=f'{restful_booker}/{Endpoint.booking}/{identifier}',
42 | headers=headers
43 | )
44 |
45 |
--------------------------------------------------------------------------------
/python/api/endpoints.py:
--------------------------------------------------------------------------------
1 | from enum import StrEnum
2 |
3 | restful_booker = 'https://restful-booker.herokuapp.com'
4 |
5 |
6 | class Endpoint(StrEnum):
7 | auth = 'auth'
8 | booking = 'booking'
9 |
--------------------------------------------------------------------------------
/python/payloads/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mwinteringham/api-framework/f33c7d8243af5561e5b18b0b2fb2f8a86e209a2b/python/payloads/__init__.py
--------------------------------------------------------------------------------
/python/payloads/authorise_payload.py:
--------------------------------------------------------------------------------
1 | class AuthorisePayload:
2 | def __init__(self, username, password):
3 | self.username = username
4 | self.password = password
5 |
6 | def build(self):
7 | return {
8 | "username": self.username,
9 | "password": self.password
10 | }
11 |
--------------------------------------------------------------------------------
/python/payloads/booking_payload.py:
--------------------------------------------------------------------------------
1 | class BookingPayload:
2 | def __init__(self, firstname, lastname, totalprice, depositpaid, checkin, checkout, additionalneeds):
3 | self.firstname = firstname
4 | self.lastname = lastname
5 | self.totalprice = totalprice
6 | self.depositpaid = depositpaid
7 | self.checkin = checkin
8 | self.checkout = checkout
9 | self.additionalneeds = additionalneeds
10 |
11 | def build(self):
12 | return {
13 | "firstname": self.firstname,
14 | "lastname": self.lastname,
15 | "totalprice": self.totalprice,
16 | "depositpaid": self.depositpaid,
17 | "bookingdates": {
18 | "checkin": self.checkin,
19 | "checkout": self.checkout
20 | },
21 | "additionalneeds": self.additionalneeds
22 | }
23 |
--------------------------------------------------------------------------------
/python/requirements.txt:
--------------------------------------------------------------------------------
1 | pytest==8.2.0
2 | requests==2.31.0
--------------------------------------------------------------------------------
/python/test_integration.py:
--------------------------------------------------------------------------------
1 | import json
2 | from api.booking import *
3 | from api.authorise import *
4 | from payloads.booking_payload import BookingPayload
5 | from payloads.authorise_payload import AuthorisePayload
6 |
7 |
8 | def test_get_booking():
9 | response = all_bookings()
10 | assert response.status_code == 200
11 |
12 |
13 | def test_get_specific_booking():
14 | response = specific_booking(
15 | 1,
16 | 'application/json'
17 | )
18 |
19 | assert response.status_code == 200
20 |
21 |
22 | def test_get_returns_418_with_bad_heading():
23 | response = specific_booking(
24 | 1,
25 | 'text/html'
26 | )
27 |
28 | assert response.status_code == 418
29 |
30 |
31 | def test_post_returns_200():
32 | payload = BookingPayload(
33 | 'Sally',
34 | 'Anne',
35 | 123,
36 | 'true',
37 | '2016-01-01',
38 | '2016-01-02',
39 | 'breakfast'
40 | )
41 |
42 | response = create_booking(
43 | payload.build(),
44 | 'application/json'
45 | )
46 |
47 | assert response.status_code == 200
48 |
49 |
50 | def test_delete_booking():
51 | payload = BookingPayload(
52 | 'Sally',
53 | 'Anne',
54 | 123,
55 | 'true',
56 | '2016-01-01',
57 | '2016-01-02',
58 | 'breakfast'
59 | )
60 |
61 | created_response = create_booking(
62 | payload.build(),
63 | 'application/json'
64 | )
65 |
66 | payload_id = json.loads(created_response.content)['bookingid']
67 |
68 | auth_payload = AuthorisePayload(
69 | 'admin',
70 | 'password123'
71 | )
72 |
73 | auth_response = post_credentials(auth_payload.build())
74 |
75 | auth_token = json.loads(auth_response.content)['token']
76 |
77 | delete_response = delete_booking(payload_id, auth_token)
78 | assert delete_response.status_code == 201
79 |
80 |
--------------------------------------------------------------------------------
/ruby/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | gem 'rspec', '~> 3.12.0'
4 | gem 'rest-client', '~> 2.1.0'
5 | gem 'rake', '~> 13.0.6'
6 |
--------------------------------------------------------------------------------
/ruby/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | diff-lcs (1.5.0)
5 | domain_name (0.5.20190701)
6 | unf (>= 0.0.5, < 1.0.0)
7 | http-accept (1.7.0)
8 | http-cookie (1.0.5)
9 | domain_name (~> 0.5)
10 | mime-types (3.4.1)
11 | mime-types-data (~> 3.2015)
12 | mime-types-data (3.2022.0105)
13 | netrc (0.11.0)
14 | rake (13.0.6)
15 | rest-client (2.1.0)
16 | http-accept (>= 1.7.0, < 2.0)
17 | http-cookie (>= 1.0.2, < 2.0)
18 | mime-types (>= 1.16, < 4.0)
19 | netrc (~> 0.8)
20 | rspec (3.12.0)
21 | rspec-core (~> 3.12.0)
22 | rspec-expectations (~> 3.12.0)
23 | rspec-mocks (~> 3.12.0)
24 | rspec-core (3.12.0)
25 | rspec-support (~> 3.12.0)
26 | rspec-expectations (3.12.0)
27 | diff-lcs (>= 1.2.0, < 2.0)
28 | rspec-support (~> 3.12.0)
29 | rspec-mocks (3.12.1)
30 | diff-lcs (>= 1.2.0, < 2.0)
31 | rspec-support (~> 3.12.0)
32 | rspec-support (3.12.0)
33 | unf (0.1.4)
34 | unf_ext
35 | unf_ext (0.0.8.2)
36 |
37 | PLATFORMS
38 | ruby
39 |
40 | DEPENDENCIES
41 | rake (~> 13.0.6)
42 | rest-client (~> 2.1.0)
43 | rspec (~> 3.12.0)
44 |
45 | BUNDLED WITH
46 | 1.17.3
47 |
--------------------------------------------------------------------------------
/ruby/README.md:
--------------------------------------------------------------------------------
1 | # api-integration
2 |
3 | Source code for the framework that was built as part of the blog post series on creating an automated API test framework [http://www.mwtestconsultancy.co.uk/category/api-web-service-testing/](http://www.mwtestconsultancy.co.uk/category/api-web-service-testing/)
--------------------------------------------------------------------------------
/ruby/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rspec/core/rake_task'
2 |
3 | RSpec::Core::RakeTask.new(:spec)
4 |
5 | task :default => :spec
--------------------------------------------------------------------------------
/ruby/api/authorise.rb:
--------------------------------------------------------------------------------
1 | require 'rest-client'
2 |
3 | module Authorise
4 |
5 | def post_credentials(payload)
6 | RestClient.post 'https://restful-booker.herokuapp.com/auth', payload, content_type: :json
7 | rescue => e
8 | e.to_s
9 | end
10 |
11 | end
--------------------------------------------------------------------------------
/ruby/api/booking.rb:
--------------------------------------------------------------------------------
1 | require 'rest-client'
2 |
3 | module Booking
4 |
5 | def all_bookings
6 | RestClient.get 'https://restful-booker.herokuapp.com/booking'
7 | rescue => e
8 | e.response
9 | end
10 |
11 | def specific_booking(id, accept)
12 | RestClient.get "https://restful-booker.herokuapp.com/booking/#{id}", accept: accept
13 | rescue => e
14 | e.response
15 | end
16 |
17 | def create_booking(payload, content_type)
18 | RestClient.post 'https://restful-booker.herokuapp.com/booking', payload, accept: :json, content_type: content_type
19 | rescue => e
20 | e.response
21 | end
22 |
23 | def delete_booking(id, token)
24 | RestClient.delete "https://restful-booker.herokuapp.com/booking/#{id}", cookie: "token=#{token}"
25 | rescue => e
26 | e.response
27 | end
28 |
29 | end
--------------------------------------------------------------------------------
/ruby/payloads/authorise_payload.rb:
--------------------------------------------------------------------------------
1 | class AuthorisePayload
2 |
3 | attr_accessor :username, :password
4 |
5 | def initialize(&block)
6 | instance_eval &block if block_given?
7 | end
8 |
9 | def to_json
10 | {username: username,
11 | password: password}.to_json
12 | end
13 |
14 | end
--------------------------------------------------------------------------------
/ruby/payloads/booking_payload.rb:
--------------------------------------------------------------------------------
1 | class BookingPayload
2 |
3 | attr_accessor :firstname, :lastname, :totalprice, :depositpaid, :checkin, :checkout, :additionalneeds
4 |
5 | def initialize(&block)
6 | instance_eval &block if block_given?
7 | end
8 |
9 | def to_json
10 | {firstname: firstname,
11 | lastname: lastname,
12 | totalprice: totalprice,
13 | depositpaid: depositpaid,
14 | bookingdates: {checkin: checkin,
15 | checkout: checkout},
16 | additionalneeds: additionalneeds}.to_json
17 | end
18 |
19 | end
--------------------------------------------------------------------------------
/ruby/spec/integration_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | include Booking
4 | include Authorise
5 |
6 | describe('Restful-booker') do
7 |
8 | it('GET /booking should return a 200') do
9 | response = Booking.all_bookings
10 |
11 | expect(response.code).to be(200)
12 | end
13 |
14 | it('GET /booking/{id} should return a 200') do
15 | response = Booking.specific_booking(1, :json)
16 |
17 | expect(response.code).to be(200)
18 | end
19 |
20 | it('GET /booking/{id} should return a 418 when sent a bad accept header') do
21 | response = Booking.specific_booking(1, :text)
22 |
23 | expect(response.code).to be(418)
24 | end
25 |
26 | it('POST /booking should return a 200') do
27 | payload = BookingPayload.new do
28 | self.firstname = 'Sally'
29 | self.lastname = 'Jenkins'
30 | self.totalprice = 111
31 | self.depositpaid = true
32 | self.checkin = '11-11-2010'
33 | self.checkout = '12-11-2010'
34 | self.additionalneeds = 'Breakfast'
35 | end
36 |
37 | response = Booking.create_booking(payload.to_json, :json)
38 |
39 | expect(response.code).to be(200)
40 | end
41 |
42 | it('DELETE /booking/{id} should return a 200') do
43 | payload = BookingPayload.new do
44 | self.firstname = 'Sally'
45 | self.lastname = 'Jenkins'
46 | self.totalprice = 111
47 | self.depositpaid = true
48 | self.checkin = '11-11-2010'
49 | self.checkout = '12-11-2010'
50 | self.additionalneeds = 'Breakfast'
51 | end
52 |
53 | created_response = Booking.create_booking(payload.to_json, :json)
54 |
55 | auth_payload = AuthorisePayload.new do
56 | self.username = "admin"
57 | self.password = "password123"
58 | end
59 |
60 | auth_response = Authorise.post_credentials(auth_payload.to_json)
61 |
62 | delete_response = Booking.delete_booking(JSON.parse(created_response.body)["bookingid"].to_i, JSON.parse(auth_response.body)["token"])
63 |
64 | expect(delete_response.code).to be(201)
65 | end
66 |
67 | end
--------------------------------------------------------------------------------
/ruby/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'rspec'
2 | require 'json'
3 | require './api/booking'
4 | require './api/authorise'
5 | require './payloads/booking_payload'
6 | require './payloads/authorise_payload'
--------------------------------------------------------------------------------